diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2016-03-18 11:05:40 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2016-03-18 11:05:40 +0300 |
commit | 58b5c504ea4bbc8202ad16708a71d7c48dedf32f (patch) | |
tree | fbb1efc5d5945e122d77b025c27d86d8813bbf4c /accel-pppd/ctrl/pppoe | |
parent | 6322800aa555f42942a554cadd1cb6b7e9c99ff3 (diff) | |
download | accel-ppp-58b5c504ea4bbc8202ad16708a71d7c48dedf32f.tar.gz accel-ppp-58b5c504ea4bbc8202ad16708a71d7c48dedf32f.zip |
pppoe: fixed vlan creation by vlan-mon
Diffstat (limited to 'accel-pppd/ctrl/pppoe')
-rw-r--r-- | accel-pppd/ctrl/pppoe/pppoe.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/accel-pppd/ctrl/pppoe/pppoe.c b/accel-pppd/ctrl/pppoe/pppoe.c index b649b0b7..8a4ce5a5 100644 --- a/accel-pppd/ctrl/pppoe/pppoe.c +++ b/accel-pppd/ctrl/pppoe/pppoe.c @@ -1359,7 +1359,7 @@ static void __pppoe_server_start(const char *ifname, const char *opt, void *cli, goto out_err; } - if (!ifr.ifr_flags & IFF_UP) { + if (!(ifr.ifr_flags & IFF_UP)) { ifr.ifr_flags |= IFF_UP; net->sock_ioctl(SIOCSIFFLAGS, &ifr); } @@ -1564,7 +1564,13 @@ void pppoe_vlan_mon_notify(int ifindex, int vid, int vlan_ifindex) svid = iplink_vlan_get_vid(ifindex); - if (make_vlan_name(conf_vlan_name, ifr.ifr_name, svid, vid, ifname)) { +#ifdef USE_LUA + if (!memcmp(conf_vlan_name, "lua:", 4)) + r = ipoe_lua_make_vlan_name(conf_vlan_name + 4, ifr.ifr_name, svid, vid, ifname); + else +#endif + r = make_vlan_name(conf_vlan_name, ifr.ifr_name, svid, vid, ifname); + if (r) { log_error("pppoe: vlan-mon: %s.%i: interface name is too long\n", ifr.ifr_name, vid); return; } @@ -1610,12 +1616,12 @@ void pppoe_vlan_mon_notify(int ifindex, int vid, int vlan_ifindex) } else { log_info2("pppoe: create vlan %s parent %s\n", ifname, ifr.ifr_name); - if (iplink_vlan_add(ifr.ifr_name, ifindex, vid)) + if (iplink_vlan_add(ifname, ifindex, vid)) return; } - strcpy(ifr.ifr_name, ifname); len = strlen(ifname); + memcpy(ifr.ifr_name, ifname, len + 1); if (ioctl(sock_fd, SIOCGIFINDEX, &ifr, sizeof(ifr))) { log_error("pppoe: vlan-mon: %s: failed to get interface index\n", ifr.ifr_name); |