diff options
-rw-r--r-- | accel-pppd/accel-ppp.conf.5 | 2 | ||||
-rw-r--r-- | accel-pppd/ctrl/ipoe/ipoe.c | 15 | ||||
-rw-r--r-- | accel-pppd/ctrl/ipoe/ipoe.h | 1 |
3 files changed, 18 insertions, 0 deletions
diff --git a/accel-pppd/accel-ppp.conf.5 b/accel-pppd/accel-ppp.conf.5 index d49b65fb..54595179 100644 --- a/accel-pppd/accel-ppp.conf.5 +++ b/accel-pppd/accel-ppp.conf.5 @@ -302,6 +302,8 @@ parameter. .BI "" [,src=x.x.x.x] .BI "" [,proxy-arp=0|1|2] .BI "" [,username=ifname|lua:function] +.BI "" [,ipv6=0|1] +.BI "" [,mtu=N] .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 d8e95e3d..08478425 100644 --- a/accel-pppd/ctrl/ipoe/ipoe.c +++ b/accel-pppd/ctrl/ipoe/ipoe.c @@ -547,6 +547,9 @@ static int ipoe_create_interface(struct ipoe_session *ses) ses->ses.ifindex = ses->ifindex; ses->ses.unit_idx = ses->ifindex; + if (ses->serv->opt_mtu) + iplink_set_mtu(ses->ses.ifindex, ses->serv->opt_mtu); + log_ppp_info2("create interface %s parent %s\n", ifr.ifr_name, ses->serv->ifname); return 0; @@ -2501,6 +2504,7 @@ static void add_interface(const char *ifname, int ifindex, const char *opt, int int opt_username = conf_username; int opt_ipv6 = conf_ipv6; int opt_auto = conf_auto; + int opt_mtu = 0; #ifdef USE_LUA char *opt_lua_username_func = NULL; #endif @@ -2568,6 +2572,8 @@ static void add_interface(const char *ifname, int ifindex, const char *opt, int opt_arp = atoi(ptr1); } else if (strcmp(str, "ipv6") == 0) { opt_ipv6 = atoi(ptr1); + } else if (strcmp(str, "mtu") == 0) { + opt_mtu = atoi(ptr1); } else if (strcmp(str, "username") == 0) { if (strcmp(ptr1, "ifname") == 0) opt_username = USERNAME_IFNAME; @@ -2656,6 +2662,11 @@ static void add_interface(const char *ifname, int ifindex, const char *opt, int } else if (!serv->arp && conf_arp) serv->arp = arpd_start(serv); + if (serv->opt_mtu != opt_mtu && opt_mtu) { + iplink_set_mtu(serv->ifindex, opt_mtu); + serv->opt_mtu = opt_mtu; + } + serv->opt_up = opt_up; serv->opt_auto = opt_auto; serv->opt_mode = opt_mode; @@ -2749,6 +2760,7 @@ static void add_interface(const char *ifname, int ifindex, const char *opt, int serv->opt_arp = opt_arp; serv->opt_username = opt_username; serv->opt_ipv6 = opt_ipv6; + serv->opt_mtu = opt_mtu; #ifdef USE_LUA serv->opt_lua_username_func = opt_lua_username_func; #endif @@ -2781,6 +2793,9 @@ static void add_interface(const char *ifname, int ifindex, const char *opt, int set_vlan_timeout(serv); } + if (opt_mtu) + iplink_set_mtu(ifindex, opt_mtu); + if (serv->opt_auto && !serv->opt_shared) triton_context_call(&serv->ctx, (triton_event_func)ipoe_session_create_auto, serv); diff --git a/accel-pppd/ctrl/ipoe/ipoe.h b/accel-pppd/ctrl/ipoe/ipoe.h index e398648e..e49ab921 100644 --- a/accel-pppd/ctrl/ipoe/ipoe.h +++ b/accel-pppd/ctrl/ipoe/ipoe.h @@ -52,6 +52,7 @@ struct ipoe_serv { uint32_t opt_src; int opt_arp; int opt_username; + int opt_mtu; #ifdef USE_LUA char *opt_lua_username_func; #endif |