diff options
author | Daniel Golle <daniel@makrotopia.org> | 2021-10-11 23:51:08 +0100 |
---|---|---|
committer | Daniel Golle <daniel@makrotopia.org> | 2021-10-13 00:30:13 +0100 |
commit | be8cd8fd4d6fd320bf668482fb49c4e0426c9d28 (patch) | |
tree | f4b9ffc178a33f8d234b7d03fc043e59e045b7dd | |
parent | 448ffc154fe78ee1c8e4b2cda1a479f0d8af8b37 (diff) | |
download | netifd-be8cd8fd4d6fd320bf668482fb49c4e0426c9d28.tar.gz |
interface: don't fork() to start jail interface
As we got a persistent per-netns-jail instance of netifd now which
handles interface configuration we no longer need to fork() the host
netifd to bring up jail interfaces.
The follow-up commit will deal with stopping jail interfaces.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
-rw-r--r-- | interface.c | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/interface.c b/interface.c index 6cf0d30..f60b545 100644 --- a/interface.c +++ b/interface.c @@ -1181,40 +1181,6 @@ interface_start_jail(const char *jail, const pid_t netns_pid) } close(netns_fd); - - pr = fork(); - if (pr) { - waitpid(pr, &wstatus, WUNTRACED | WCONTINUED); - return; - } - - /* child process */ - netns_fd = system_netns_open(netns_pid); - if (netns_fd < 0) - return; - - system_netns_set(netns_fd); - system_init(); - vlist_for_each_element(&interfaces, iface, node) { - if (!iface->jail || strcmp(iface->jail, jail)) - continue; - - /* - * The interface has already been renamed and is inside target - * namespace, hence overwrite ifname with jail_ifname for - * interface_set_up(). - * We are inside a fork which got it's own copy of the interfaces - * list, so we can mess with it :) - */ - if (iface->jail_ifname) - iface->device = iface->jail_ifname; - - interface_do_reload(iface); - interface_set_up(iface); - } - - close(netns_fd); - _exit(0); } void |