* We are inside a fork which got it's own copy of the interfaces
* list, so we can mess with it :)
*/
- iface->ifname = iface->jail_ifname;
+ if (iface->jail_ifname)
+ iface->ifname = iface->jail_ifname;
+
interface_do_reload(iface);
interface_set_up(iface);
}
int wstatus;
pid_t parent_pid = getpid();
pid_t pr = 0;
+ const char *orig_ifname;
pr = fork();
if (pr) {
if (!iface->jail || strcmp(iface->jail, jail))
continue;
+ orig_ifname = iface->ifname;
+ if (iface->jail_ifname)
+ iface->ifname = iface->jail_ifname;
+
+ interface_do_reload(iface);
interface_set_down(iface);
- system_link_netns_move(iface->jail_ifname, root_netns, iface->ifname);
+ system_link_netns_move(iface->ifname, root_netns, orig_ifname);
}
close(root_netns);