summaryrefslogtreecommitdiff
path: root/accel-pppd/ctrl/ipoe
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2018-05-25 12:57:26 +0300
committerDmitry Kozlov <xeb@mail.ru>2018-05-25 12:57:26 +0300
commita35e2a0084ef07ebc6ef834fa4ff3e2cfd97ec0b (patch)
tree37b57673f96cda59866a9cbc703d430628727bd5 /accel-pppd/ctrl/ipoe
parentacc53d157ba6b69ca038e6d21be60ce75334f477 (diff)
downloadaccel-ppp-a35e2a0084ef07ebc6ef834fa4ff3e2cfd97ec0b.tar.gz
accel-ppp-a35e2a0084ef07ebc6ef834fa4ff3e2cfd97ec0b.zip
ipoe: introduced ip-unnumbered per-interface option
Diffstat (limited to 'accel-pppd/ctrl/ipoe')
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.c11
-rw-r--r--accel-pppd/ctrl/ipoe/ipoe.h1
2 files changed, 9 insertions, 3 deletions
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;