[OpenWrt-Devel] [PATCH procd 2/2] jail: unnamed jails can not have netns (fix segfault)

Leonardo Mörlein me at irrelefant.net
Thu May 7 20:58:25 EDT 2020


Signed-off-by: Leonardo Mörlein <me at irrelefant.net>
---
 jail/jail.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/jail/jail.c b/jail/jail.c
index 67d4cad..a52c264 100644
--- a/jail/jail.c
+++ b/jail/jail.c
@@ -841,6 +841,10 @@ int main(int argc, char **argv)
 		}
 
 		if (opts.namespace & CLONE_NEWNET) {
+			if (!opts.name) {
+				ERROR("netns needs a named jail\n");
+				return -1;
+			}
 			netns_fd = netns_open_pid(jail_process.pid);
 			netns_updown(jail_process.pid, true);
 		}
-- 
2.26.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list