diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2015-07-02 15:01:37 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2015-07-02 15:01:37 +0300 |
commit | 2883c323268800fc09fe1535d12528c8f054904d (patch) | |
tree | e2e7e8ebea9f2aea043529976ce10cee8fa0cf98 /accel-pppd | |
parent | b8b91d8b087312c91a9941dacd11a98692679ec8 (diff) | |
download | accel-ppp-2883c323268800fc09fe1535d12528c8f054904d.tar.gz accel-ppp-2883c323268800fc09fe1535d12528c8f054904d.zip |
ipoe: introduced option "check-mac-change"
Default behaviour of accel-ppp when it receives DHCP request with same Option 82 but different MAC address
is termination of old session (with previous MAC address).
This option can turn off such behaviour, so multiple sessions with same Option 82 but different MAC may coesist.
Diffstat (limited to 'accel-pppd')
-rw-r--r-- | accel-pppd/accel-ppp.conf | 1 | ||||
-rw-r--r-- | accel-pppd/accel-ppp.conf.5 | 3 | ||||
-rw-r--r-- | accel-pppd/ctrl/ipoe/ipoe.c | 17 |
3 files changed, 16 insertions, 5 deletions
diff --git a/accel-pppd/accel-ppp.conf b/accel-pppd/accel-ppp.conf index 35688722..3102e20f 100644 --- a/accel-pppd/accel-ppp.conf +++ b/accel-pppd/accel-ppp.conf @@ -137,6 +137,7 @@ start=dhcpv4 #idle-timeout=0 #session-timeout=0 #soft-terminate=0 +#check-mac-change=1 interface=eth0 diff --git a/accel-pppd/accel-ppp.conf.5 b/accel-pppd/accel-ppp.conf.5 index 773bfe53..b5c5e881 100644 --- a/accel-pppd/accel-ppp.conf.5 +++ b/accel-pppd/accel-ppp.conf.5 @@ -387,6 +387,9 @@ By default vlan-name=%I.%N. .TP .BI "soft-terminate=" 0|1 Turns on soft terminate mode. Soft terminate means that session won't be terminated immediately, but when next lease renewal request will be received. +.TP +.BI "check-mac-change=" 0|1 +If enabled accel-ppp will terminate session when detects change of mac address of client (by default it is enabled). .SH [dns] .TP .BI "dns1=" x.x.x.x diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c index 765996f7..1f904bf6 100644 --- a/accel-pppd/ctrl/ipoe/ipoe.c +++ b/accel-pppd/ctrl/ipoe/ipoe.c @@ -150,6 +150,7 @@ static int conf_proto; static LIST_HEAD(conf_offer_delay); static const char *conf_vlan_name; static int conf_ip_unnumbered; +static int conf_check_mac_change; static int conf_soft_terminate; static unsigned int stat_starting; @@ -199,13 +200,13 @@ static struct ipoe_session *ipoe_session_lookup(struct ipoe_serv *serv, struct d if (opt82_ses) *opt82_ses = NULL; - if (pack->relay_agent && dhcpv4_parse_opt82(pack->relay_agent, &agent_circuit_id, &agent_remote_id)) { + if (!conf_check_mac_change || (pack->relay_agent && dhcpv4_parse_opt82(pack->relay_agent, &agent_circuit_id, &agent_remote_id))) { agent_circuit_id = NULL; agent_remote_id = NULL; } list_for_each_entry(ses, &serv->sessions, entry) { - opt82_match = pack->relay_agent != NULL; + opt82_match = conf_check_mac_change && pack->relay_agent != NULL; if (agent_circuit_id && !ses->agent_circuit_id) opt82_match = 0; @@ -1322,7 +1323,7 @@ static void ipoe_ses_recv_dhcpv4(struct dhcpv4_serv *dhcpv4, struct dhcpv4_packe opt82_match = 0; } - if (pack->relay_agent && !opt82_match) { + if (conf_check_mac_change && pack->relay_agent && !opt82_match) { log_ppp_info2("port change detected\n"); if (pack->msg_type == DHCPREQUEST) dhcpv4_send_nak(dhcpv4, pack); @@ -1595,7 +1596,7 @@ static void __ipoe_recv_dhcpv4(struct dhcpv4_serv *dhcpv4, struct dhcpv4_packet goto out; } - if ((opt82_ses && ses != opt82_ses) || (!opt82_ses && pack->relay_agent)) { + if (conf_check_mac_change && ((opt82_ses && ses != opt82_ses) || (!opt82_ses && pack->relay_agent))) { dhcpv4_packet_ref(pack); triton_context_call(&ses->ctx, (triton_event_func)port_change_detected, pack); if (opt82_ses) @@ -1634,7 +1635,7 @@ static void __ipoe_recv_dhcpv4(struct dhcpv4_serv *dhcpv4, struct dhcpv4_packet goto out; } - if ((opt82_ses && ses != opt82_ses) || (!opt82_ses && pack->relay_agent)) { + if (conf_check_mac_change && ((opt82_ses && ses != opt82_ses) || (!opt82_ses && pack->relay_agent))) { dhcpv4_packet_ref(pack); triton_context_call(&ses->ctx, (triton_event_func)port_change_detected, pack); if (opt82_ses) @@ -3281,6 +3282,12 @@ static void load_config(void) else conf_soft_terminate = 0; + opt = conf_get_opt("ipoe", "check-mac-change"); + if (opt) + conf_check_mac_change = atoi(opt); + else + conf_check_mac_change = 1; + #ifdef RADIUS if (triton_module_loaded("radius")) load_radius_attrs(); |