diff options
-rw-r--r-- | accel-pppd/accel-ppp.conf.5 | 30 | ||||
-rw-r--r-- | accel-pppd/ctrl/ipoe/ipoe.c | 18 | ||||
-rw-r--r-- | accel-pppd/ctrl/pppoe/pppoe.c | 8 |
3 files changed, 40 insertions, 16 deletions
diff --git a/accel-pppd/accel-ppp.conf.5 b/accel-pppd/accel-ppp.conf.5 index 26e32fe..93856fa 100644 --- a/accel-pppd/accel-ppp.conf.5 +++ b/accel-pppd/accel-ppp.conf.5 @@ -484,7 +484,7 @@ List must to be sorted by count key. Specified timeout waiting DHCP-Request from client in seconds (default 10). .TP .BI "vlan-mon=" [re:]name[,filter] -Starts vlan monitor on specified interface (requires ipoe kernel module). +Starts vlan monitor on specified interface (requires vlan_mon kernel module). .br The .B filter @@ -493,7 +493,7 @@ parameter specifies list of vlans or ranges of vlans to monitor for and may be i vlan-mon=eth1,2,5,10,20-30 .TP .BI "vlan-timeout=" n -Specifies time of vlan inactivity before it will be removed (seconds). +Specifies time of vlan inactivity before it will be removed in seconds (default 60). A value of 0 disables removal of inactive vlan. .TP .BI "vlan-name=" pattern Specifies pattern of vlan interface name. Pattern may contain following macros: @@ -602,6 +602,32 @@ then ifname is considered as regular expression. Optional .B padi-limit parameter specifies limit of PADI packets to reply on this interface in 1 second period. .TP +.BI "vlan-mon=" [re:]name[,filter] +Starts vlan monitor on specified interface (requires vlan_mon kernel module). +.br +The +.B filter +parameter specifies list of vlans or ranges of vlans to monitor for and may be in following form: +.br +vlan-mon=eth1,2,5,10,20-30 +.TP +.BI "vlan-timeout=" n +Specifies time of vlan inactivity before it will be removed in seconds (default 60). A value of 0 disables removal of inactive vlan. +.TP +.BI "vlan-name=" pattern +Specifies pattern of vlan interface name. Pattern may contain following macros: +.br +.B %I +- name of pattern interface. +.br +.B %N +- number of vlan. +.br +.B %P +- number of vlan of parent interface. +.br +By default vlan-name=%I.%N. +.TP .BI "ac-name=" ac-name Specifies AC-Name tag value. If absent tag will not be sent. .TP diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c index dde3f21..e1b37a6 100644 --- a/accel-pppd/ctrl/ipoe/ipoe.c +++ b/accel-pppd/ctrl/ipoe/ipoe.c @@ -150,7 +150,7 @@ static const char *conf_attr_dhcp_opt82_circuit_id; static int conf_l4_redirect_table; static int conf_l4_redirect_on_reject; static const char *conf_l4_redirect_ipset; -static int conf_vlan_timeout; +static int conf_vlan_timeout = 60; static int conf_max_request = 3; static int conf_session_timeout; static int conf_idle_timeout; @@ -2650,7 +2650,7 @@ static void ipoe_serv_release(struct ipoe_serv *serv) if (!serv->opt_auto) ipoe_nl_del_interface(serv->ifindex); - if (serv->vlan_mon) { + if (serv->vlan_mon && conf_vlan_timeout) { log_info2("ipoe: remove vlan %s\n", serv->ifname); iplink_vlan_del(serv->ifindex); vlan_mon_add_vid(serv->parent_ifindex, ETH_P_IP, serv->vid); @@ -2786,11 +2786,13 @@ static int get_offer_delay() static void set_vlan_timeout(struct ipoe_serv *serv) { - serv->timer.expire = ipoe_serv_timeout; - serv->timer.expire_tv.tv_sec = conf_vlan_timeout; + if(conf_vlan_timeout) { + serv->timer.expire = ipoe_serv_timeout; + serv->timer.expire_tv.tv_sec = conf_vlan_timeout; - if (list_empty(&serv->sessions)) - triton_timer_add(&serv->ctx, &serv->timer, 0); + if (list_empty(&serv->sessions)) + triton_timer_add(&serv->ctx, &serv->timer, 0); + } } void ipoe_vlan_mon_notify(int ifindex, int vid, int vlan_ifindex) @@ -4049,10 +4051,8 @@ static void load_config(void) conf_proto = 3; opt = conf_get_opt("ipoe", "vlan-timeout"); - if (opt && atoi(opt) > 0) + if (opt && atoi(opt) >= 0) conf_vlan_timeout = atoi(opt); - else - conf_vlan_timeout = 60; opt = conf_get_opt("ipoe", "offer-timeout"); if (opt && atoi(opt) > 0) diff --git a/accel-pppd/ctrl/pppoe/pppoe.c b/accel-pppd/ctrl/pppoe/pppoe.c index 78cc64a..7668428 100644 --- a/accel-pppd/ctrl/pppoe/pppoe.c +++ b/accel-pppd/ctrl/pppoe/pppoe.c @@ -106,7 +106,7 @@ enum {CSID_MAC, CSID_IFNAME, CSID_IFNAME_MAC}; static int conf_called_sid; static int conf_cookie_timeout; static const char *conf_vlan_name; -static int conf_vlan_timeout; +static int conf_vlan_timeout = 60; static mempool_t conn_pool; static mempool_t pado_pool; @@ -1610,7 +1610,7 @@ void pppoe_server_free(struct pppoe_serv_t *serv) if (serv->timer.tpd) triton_timer_del(&serv->timer); - if (serv->vlan_mon) { + if (serv->vlan_mon && conf_vlan_timeout) { log_info2("pppoe: remove vlan %s\n", serv->ifname); iplink_vlan_del(serv->ifindex); vlan_mon_add_vid(serv->parent_ifindex, ETH_P_PPP_DISC, serv->vid); @@ -2084,10 +2084,8 @@ static void load_config(void) conf_vlan_name = "%I.%N"; opt = conf_get_opt("pppoe", "vlan-timeout"); - if (opt && atoi(opt) > 0) + if (opt && atoi(opt) >= 0) conf_vlan_timeout = atoi(opt); - else - conf_vlan_timeout = 60; load_vlan_mon(s); } |