diff options
author | François Cachereul <f.cachereul@alphalink.fr> | 2016-07-12 15:57:03 +0200 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2016-07-14 20:48:16 +0300 |
commit | 33757db5ed54d22eaf4ab3911c70d51176f055c0 (patch) | |
tree | 6bc1037b0dc46d0b3fb057971ac44af5794df117 /accel-pppd | |
parent | ef06cf0c864cbaafcaa7d3c93d5bd86c93a6e9f8 (diff) | |
download | accel-ppp-33757db5ed54d22eaf4ab3911c70d51176f055c0.tar.gz accel-ppp-33757db5ed54d22eaf4ab3911c70d51176f055c0.zip |
ppp: fix bug when using unit cache with interfaces in another netns
Signed-off-by: François Cachereul <f.cachereul@alphalink.fr>
Diffstat (limited to 'accel-pppd')
-rw-r--r-- | accel-pppd/ppp/ppp.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/accel-pppd/ppp/ppp.c b/accel-pppd/ppp/ppp.c index cfc6aca..d39e39d 100644 --- a/accel-pppd/ppp/ppp.c +++ b/accel-pppd/ppp/ppp.c @@ -247,10 +247,22 @@ static void destablish_ppp(struct ppp_t *ppp) if (conf_unit_cache) { struct ifreq ifr; + if (ppp->ses.net != def_net) { + if (net->move_link(def_net, ppp->ses.ifindex)) { + log_ppp_warn("failed to attach to default namespace\n"); + triton_md_unregister_handler(&ppp->unit_hnd, 1); + ap_session_finished(&ppp->ses); + goto skip; + } + ppp->ses.net = def_net; + net = def_net; + } + sprintf(ifr.ifr_newname, "ppp%i", ppp->ses.unit_idx); if (strcmp(ifr.ifr_newname, ppp->ses.ifname)) { strncpy(ifr.ifr_name, ppp->ses.ifname, IFNAMSIZ); if (net->sock_ioctl(SIOCSIFNAME, &ifr)) { + log_ppp_warn("failed to rename ppp to default name\n"); triton_md_unregister_handler(&ppp->unit_hnd, 1); ap_session_finished(&ppp->ses); goto skip; |