diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2017-09-25 17:54:39 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2017-09-25 17:54:39 +0300 |
commit | dd4cf1cc8ea87eddc5d2559bdb330759f3b8a511 (patch) | |
tree | 4bada23ba15e5fc4103d8a2ca2f117ad75630892 /accel-pppd/ctrl/ipoe | |
parent | 2d6a28574b93875d8ca5577f447d886cc60c0b1a (diff) | |
download | accel-ppp-dd4cf1cc8ea87eddc5d2559bdb330759f3b8a511.tar.gz accel-ppp-dd4cf1cc8ea87eddc5d2559bdb330759f3b8a511.zip |
ipoe: introduced interface option mtu=N
Diffstat (limited to 'accel-pppd/ctrl/ipoe')
-rw-r--r-- | accel-pppd/ctrl/ipoe/ipoe.c | 15 | ||||
-rw-r--r-- | accel-pppd/ctrl/ipoe/ipoe.h | 1 |
2 files changed, 16 insertions, 0 deletions
diff --git a/accel-pppd/ctrl/ipoe/ipoe.c b/accel-pppd/ctrl/ipoe/ipoe.c index 8687d1f..80d06a6 100644 --- a/accel-pppd/ctrl/ipoe/ipoe.c +++ b/accel-pppd/ctrl/ipoe/ipoe.c @@ -563,6 +563,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; @@ -2659,6 +2662,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 @@ -2726,6 +2730,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; @@ -2817,6 +2823,11 @@ static void add_interface(const char *ifname, int ifindex, const char *opt, int } else if (!serv->arp && opt_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; @@ -2910,6 +2921,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 @@ -2943,6 +2955,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 f8bc82b..2b04ea0 100644 --- a/accel-pppd/ctrl/ipoe/ipoe.h +++ b/accel-pppd/ctrl/ipoe/ipoe.h @@ -53,6 +53,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 |