diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2018-05-25 12:57:26 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2018-05-25 12:57:26 +0300 |
commit | a35e2a0084ef07ebc6ef834fa4ff3e2cfd97ec0b (patch) | |
tree | 37b57673f96cda59866a9cbc703d430628727bd5 /accel-pppd | |
parent | acc53d157ba6b69ca038e6d21be60ce75334f477 (diff) | |
download | accel-ppp-a35e2a0084ef07ebc6ef834fa4ff3e2cfd97ec0b.tar.gz accel-ppp-a35e2a0084ef07ebc6ef834fa4ff3e2cfd97ec0b.zip |
ipoe: introduced ip-unnumbered per-interface option
Diffstat (limited to 'accel-pppd')
-rw-r--r-- | accel-pppd/accel-ppp.conf.5 | 10 | ||||
-rw-r--r-- | accel-pppd/ctrl/ipoe/ipoe.c | 11 | ||||
-rw-r--r-- | accel-pppd/ctrl/ipoe/ipoe.h | 1 |
3 files changed, 19 insertions, 3 deletions
diff --git a/accel-pppd/accel-ppp.conf.5 b/accel-pppd/accel-ppp.conf.5 index 97e7ed5b..805220e4 100644 --- a/accel-pppd/accel-ppp.conf.5 +++ b/accel-pppd/accel-ppp.conf.5 @@ -302,6 +302,15 @@ parameter. .BI "weight=" n Specifies global weight of this server (used for load balancing) .TP +.BI "ip-unnumbered=" 0|1 +Specifies default value for per-interface +.B ip-unnumbered +parameter. +.br +If ip-unnumbered=1 accel-ppp will always assign /32 mask. +.br +Default value is 1. +.TP .BI "interface=" [re:]name[,mode=L2|L3][,shared=0|1][,start=dhcpv4|up|auto] .BI "" [,range=x.x.x.x/mask][,ifcfg=0|1] .BI "" [,relay=x.x.x.x] @@ -312,6 +321,7 @@ Specifies global weight of this server (used for load balancing) .BI "" [,ipv6=0|1] .BI "" [,mtu=N] .BI "" [,weight=N] +.BI "" [,ip-unnumbered=0|1] .br Specifies interface to listen dhcp or unclassified packets. You may specify multiple .B interface diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c index acfc62ce..8bedfc47 100644 --- a/accel-pppd/ctrl/ipoe/ipoe.c +++ b/accel-pppd/ctrl/ipoe/ipoe.c @@ -957,7 +957,7 @@ static void __ipoe_session_activate(struct ipoe_session *ses) ses->ipv4.addr = ses->siaddr; } - ses->ses.ipv4->mask = conf_ip_unnumbered ? 32 : ses->mask; + ses->ses.ipv4->mask = serv->opt_ip_unnumbered ? 32 : ses->mask; if (ses->ifindex != -1 || serv->opt_ifcfg) ses->ctrl.dont_ifcfg = 0; @@ -980,7 +980,7 @@ static void __ipoe_session_activate(struct ipoe_session *ses) ap_session_activate(&ses->ses); if (ses->ifindex == -1 && !serv->opt_ifcfg) { - if (!conf_ip_unnumbered) + if (serv->opt_ip_unnumbered == 0) iproute_add(serv->ifindex, ses->router, ses->yiaddr, 0, conf_proto, ses->mask, 0); else if (!serv->opt_ifcfg) iproute_add(serv->ifindex, serv->opt_src ?: ses->router, ses->yiaddr, 0, conf_proto, 32, 0); @@ -1165,7 +1165,7 @@ static void ipoe_session_finished(struct ap_session *s) ipoe_nl_delete(ses->ifindex); } else if (ses->started) { if (!serv->opt_ifcfg) { - if (conf_ip_unnumbered) + if (serv->opt_ip_unnumbered) iproute_del(serv->ifindex, ses->yiaddr, conf_proto, 32, 0); else iproute_del(serv->ifindex, ses->yiaddr, conf_proto, ses->mask, 0); @@ -2808,6 +2808,7 @@ static void add_interface(const char *ifname, int ifindex, const char *opt, int int opt_auto = conf_auto; int opt_mtu = 0; int opt_weight = -1; + int opt_ip_unnumbered = conf_ip_unnumbered; #ifdef USE_LUA char *opt_lua_username_func = NULL; #endif @@ -2879,6 +2880,8 @@ static void add_interface(const char *ifname, int ifindex, const char *opt, int opt_mtu = atoi(ptr1); } else if (strcmp(str, "weight") == 0) { opt_weight = atoi(ptr1); + } else if (strcmp(str, "ip-unnumbered") == 0) { + opt_ip_unnumbered = atoi(ptr1); } else if (strcmp(str, "username") == 0) { if (strcmp(ptr1, "ifname") == 0) opt_username = USERNAME_IFNAME; @@ -2985,6 +2988,7 @@ static void add_interface(const char *ifname, int ifindex, const char *opt, int serv->opt_username = opt_username; serv->opt_ipv6 = opt_ipv6; serv->opt_weight = opt_weight; + serv->opt_ip_unnumbered = opt_ip_unnumbered; #ifdef USE_LUA if (serv->opt_lua_username_func && (!opt_lua_username_func || strcmp(serv->opt_lua_username_func, opt_lua_username_func))) { _free(serv->opt_lua_username_func); @@ -3071,6 +3075,7 @@ static void add_interface(const char *ifname, int ifindex, const char *opt, int serv->opt_ipv6 = opt_ipv6; serv->opt_mtu = opt_mtu; serv->opt_weight = opt_weight; + serv->opt_ip_unnumbered = opt_ip_unnumbered; #ifdef USE_LUA serv->opt_lua_username_func = opt_lua_username_func; #endif diff --git a/accel-pppd/ctrl/ipoe/ipoe.h b/accel-pppd/ctrl/ipoe/ipoe.h index 94da45db..0be99ea4 100644 --- a/accel-pppd/ctrl/ipoe/ipoe.h +++ b/accel-pppd/ctrl/ipoe/ipoe.h @@ -66,6 +66,7 @@ struct ipoe_serv { int opt_ifcfg:1; int opt_nat:1; int opt_ipv6:1; + int opt_ip_unnumbered:1; int need_close:1; int active:1; int vlan_mon:1; |