diff options
author | xebd <xeb@mail.ru> | 2020-04-07 10:51:00 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-07 10:51:00 +0300 |
commit | 7a9e1de558c188d420e39165119e92915af2b3d7 (patch) | |
tree | bba16b319ec62157cf77f12049d4491b900f63a2 /accel-pppd/session.c | |
parent | 33470e3e838b36fa30b3d6283b16562868735dfa (diff) | |
parent | c4c85030efdba8a927bbca7f8b010a0152f823cb (diff) | |
download | accel-ppp-7a9e1de558c188d420e39165119e92915af2b3d7.tar.gz accel-ppp-7a9e1de558c188d420e39165119e92915af2b3d7.zip |
Merge pull request #122 from laarmen/dev/fix/netns_reindex
Refresh interface index when moving to another netns
Diffstat (limited to 'accel-pppd/session.c')
-rw-r--r-- | accel-pppd/session.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/accel-pppd/session.c b/accel-pppd/session.c index 8ef569e..1411f24 100644 --- a/accel-pppd/session.c +++ b/accel-pppd/session.c @@ -88,21 +88,11 @@ void __export ap_session_set_ifindex(struct ap_session *ses) int __export ap_session_starting(struct ap_session *ses) { - struct ifreq ifr; - if (ap_shutdown) return -1; - if (ses->ifindex == -1 && ses->ifname[0]) { - memset(&ifr, 0, sizeof(ifr)); - strcpy(ifr.ifr_name, ses->ifname); - - if (net->sock_ioctl(SIOCGIFINDEX, &ifr)) { - log_ppp_error("ioctl(SIOCGIFINDEX): %s\n", strerror(errno)); - return -1; - } - ses->ifindex = ifr.ifr_ifindex; - } + if (ses->ifindex == -1 && ses->ifname[0]) + ses->ifindex = net->get_ifindex(ses->ifname); if (ses->ifindex != -1) ap_session_set_ifindex(ses); |