From 1d6f68a518cd7f8cc182080b57d76ed16dc3973a Mon Sep 17 00:00:00 2001 From: Dmitry Kozlov Date: Wed, 27 Dec 2017 13:19:48 +0300 Subject: ipoe: implemented new load balancing mechanism new config options: [ipoe] weight=N - global weight interface=ethX,weight=N - per-interface weight How it works: On reception of DHCPDISCOVER accel-ppp sends broadcast DHCP message to port 67 with same xid and add special vendor-specific option where encodes its current session count multipled by weight. On reception of such message accel-ppp searches session with same xid and compares weight. If received weight is less than session's weight then it terminates this session. per-interface weight=0 has special meaning as backup (fail-over) interface, f.e. it terminates session on any received weight. By default weight based load balancing is disabled. To enable need to specify global or/and per-interface weight. --- accel-pppd/ctrl/ipoe/dhcpv4.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'accel-pppd/ctrl/ipoe/dhcpv4.h') diff --git a/accel-pppd/ctrl/ipoe/dhcpv4.h b/accel-pppd/ctrl/ipoe/dhcpv4.h index a7fa5a90..ebb67cfb 100644 --- a/accel-pppd/ctrl/ipoe/dhcpv4.h +++ b/accel-pppd/ctrl/ipoe/dhcpv4.h @@ -32,6 +32,8 @@ #define DHCPRELEASE 7 #define DHCPINFORM 8 +#define ACCEL_PPP_MAGIC 0xfd56b60a + struct dhcpv4_hdr { uint8_t op; uint8_t htype; @@ -117,6 +119,8 @@ int dhcpv4_relay_send_release(struct dhcpv4_relay *relay, uint8_t *chaddr, uint3 int dhcpv4_send_reply(int msg_type, struct dhcpv4_serv *serv, struct dhcpv4_packet *req, uint32_t yiaddr, uint32_t siaddr, uint32_t router, uint32_t mask, int lease_time, int renew_time, struct dhcpv4_packet *relay_reply); int dhcpv4_send_nak(struct dhcpv4_serv *serv, struct dhcpv4_packet *req); +void dhcpv4_send_notify(struct dhcpv4_serv *serv, struct dhcpv4_packet *req, unsigned int weight); + void dhcpv4_packet_ref(struct dhcpv4_packet *pack); struct dhcpv4_option *dhcpv4_packet_find_opt(struct dhcpv4_packet *pack, int type); int dhcpv4_packet_insert_opt82(struct dhcpv4_packet *pack, const char *agent_circuit_id, const char *agent_remote_id); -- cgit v1.2.3