summaryrefslogtreecommitdiff
path: root/accel-pppd
diff options
context:
space:
mode:
authorGuillaume Nault <g.nault@alphalink.fr>2018-06-21 09:52:54 +0200
committerDmitry Kozlov <xeb@mail.ru>2018-06-24 20:19:08 +0300
commit34c5d1fd9f567e921618f7e70a813d476be2faef (patch)
tree676d3093d881ff1e4741596f23df42d8691a46aa /accel-pppd
parent308a6d0c3ba6f22d00b7a360a8621db5e5f9647a (diff)
downloadaccel-ppp-34c5d1fd9f567e921618f7e70a813d476be2faef.tar.gz
accel-ppp-34c5d1fd9f567e921618f7e70a813d476be2faef.zip
pppd_compat: run scripts in the PPP device netns
If the PPP device is set up into a specific network namespace, all the configuration that goes with it belongs to this same netns. Therefore, we need to run the up/down scripts in that namespace too. Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Diffstat (limited to 'accel-pppd')
-rw-r--r--accel-pppd/extra/pppd_compat.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/accel-pppd/extra/pppd_compat.c b/accel-pppd/extra/pppd_compat.c
index 915ef71d..56dba5e9 100644
--- a/accel-pppd/extra/pppd_compat.c
+++ b/accel-pppd/extra/pppd_compat.c
@@ -269,7 +269,10 @@ static void ev_ses_pre_up(struct ap_session *ses)
sigfillset(&set);
pthread_sigmask(SIG_UNBLOCK, &set, NULL);
+ net->enter_ns();
execve(conf_ip_pre_up, argv, env);
+ net->exit_ns();
+
log_emerg("pppd_compat: exec '%s': %s\n", conf_ip_pre_up, strerror(errno));
_exit(EXIT_FAILURE);
} else
@@ -316,7 +319,10 @@ static void ev_ses_started(struct ap_session *ses)
sigfillset(&set);
pthread_sigmask(SIG_UNBLOCK, &set, NULL);
+ net->enter_ns();
execve(conf_ip_up, argv, env);
+ net->exit_ns();
+
log_emerg("pppd_compat: exec '%s': %s\n", conf_ip_up, strerror(errno));
_exit(EXIT_FAILURE);
} else
@@ -373,7 +379,10 @@ static void ev_ses_finished(struct ap_session *ses)
sigfillset(&set);
pthread_sigmask(SIG_UNBLOCK, &set, NULL);
+ net->enter_ns();
execve(conf_ip_down, argv, env);
+ net->exit_ns();
+
log_emerg("pppd_compat: exec '%s': %s\n", conf_ip_down, strerror(errno));
_exit(EXIT_FAILURE);
} else
@@ -459,7 +468,10 @@ static void ev_radius_coa(struct ev_radius_t *ev)
if (!ev->res)
ev->res = pd->res;
} else if (pid == 0) {
+ net->enter_ns();
execve(conf_ip_change, argv, env);
+ net->exit_ns();
+
log_emerg("pppd_compat: exec '%s': %s\n", conf_ip_change, strerror(errno));
_exit(EXIT_FAILURE);
} else