summaryrefslogtreecommitdiff
path: root/accel-pppd/ppp
diff options
context:
space:
mode:
authorFrançois Cachereul <f.cachereul@alphalink.fr>2016-07-12 15:57:03 +0200
committerDmitry Kozlov <xeb@mail.ru>2016-07-14 20:48:16 +0300
commit33757db5ed54d22eaf4ab3911c70d51176f055c0 (patch)
tree6bc1037b0dc46d0b3fb057971ac44af5794df117 /accel-pppd/ppp
parentef06cf0c864cbaafcaa7d3c93d5bd86c93a6e9f8 (diff)
downloadaccel-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/ppp')
-rw-r--r--accel-pppd/ppp/ppp.c12
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;