summaryrefslogtreecommitdiff
path: root/system-dummy.c
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2019-12-30 14:57:47 +0200
committerDaniel Golle <daniel@makrotopia.org>2020-01-18 13:39:45 +0200
commit1321c1bd8fe921986c4eb39c3783ddd827b79543 (patch)
tree89c1af96541324a445e683ea978f8f4aede3f2ee /system-dummy.c
parent64f4eb79fe2977320660f8940bc908fa4def807b (diff)
downloadnetifd-1321c1bd8fe921986c4eb39c3783ddd827b79543.tar.gz
add basic support for jail network namespaces
Prepare netifd for handling procd service jails having their own network namespace. Intefaces having the jail attribute will only be brought inside the jail's network namespace by procd calling the newly introduced ubus method 'netns_updown'. Currently proto 'static' is supported and configuration changes are not yet being handled (ie. you'll have to restart the jailed service for changes to take effect). Example /etc/config/network snippet: config device 'veth0' option type 'veth' option name 'vhost0' option peer_name 'virt0' config interface 'virt' option type 'bridge' list ifname 'vhost0' option proto 'static' option ipaddr '10.0.0.1' option netmask '255.255.255.0' config interface 'virt0' option ifname 'virt0' option proto 'static' option ipaddr '10.0.0.2' option netmask '255.255.255.0' option gateway '10.0.0.1' option dns '10.0.0.1' option jail 'transmission' Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'system-dummy.c')
-rw-r--r--system-dummy.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/system-dummy.c b/system-dummy.c
index 58fd2d0..9c37bd5 100644
--- a/system-dummy.c
+++ b/system-dummy.c
@@ -54,6 +54,24 @@ int system_bridge_delif(struct device *bridge, struct device *dev)
return 0;
}
+int system_link_netns_move(const char *ifname, int netns_fd)
+{
+ D(SYSTEM, "ip link %s netns %d\n", ifname, netns_fd);
+ return 0;
+}
+
+int system_netns_open(const pid_t target_ns)
+{
+ D(SYSTEM, "open netns of pid %d\n", target_ns);
+ return 1;
+}
+
+int system_netns_set(int netns_fd)
+{
+ D(SYSTEM, "set netns %d\n", netns_fd);
+ return 0;
+}
+
int system_vlan_add(struct device *dev, int id)
{
D(SYSTEM, "vconfig add %s %d\n", dev->ifname, id);