From 34c5d1fd9f567e921618f7e70a813d476be2faef Mon Sep 17 00:00:00 2001 From: Guillaume Nault Date: Thu, 21 Jun 2018 09:52:54 +0200 Subject: 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 --- accel-pppd/extra/pppd_compat.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 -- cgit v1.2.3