]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
nspawn: allow combination of private-network and network-namespace-path
authorShengjing Zhu <i@zhsj.me>
Sun, 8 Dec 2019 19:00:01 +0000 (03:00 +0800)
committerLennart Poettering <lennart@poettering.net>
Thu, 12 Dec 2019 18:26:32 +0000 (19:26 +0100)
Fixes: #14289
src/nspawn/nspawn.c
test/TEST-13-NSPAWN-SMOKE/test.sh

index 00adbcb61a2b7e775978b06b9a58421a1db63c81..4661dd9475610709099cc4eb5b43265e37c297e6 100644 (file)
@@ -1562,13 +1562,13 @@ static int verify_arguments(void) {
         if (arg_userns_chown && arg_volatile_mode != VOLATILE_NO)
                 return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "--volatile= and --private-users-chown may not be combined.");
 
-        /* If --network-namespace-path is given with any other network-related option, we need to error out,
-         * to avoid conflicts between different network options. */
+        /* If --network-namespace-path is given with any other network-related option (except --private-network),
+         * we need to error out, to avoid conflicts between different network options. */
         if (arg_network_namespace_path &&
                 (arg_network_interfaces || arg_network_macvlan ||
                  arg_network_ipvlan || arg_network_veth_extra ||
                  arg_network_bridge || arg_network_zone ||
-                 arg_network_veth || arg_private_network))
+                 arg_network_veth))
                 return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "--network-namespace-path= cannot be combined with other network options.");
 
         if (arg_network_bridge && arg_network_zone)
index 747d30d952f6eef77f75717505282a1abeaef8b6..de504df63214d07bad42f0d1656e4da8a396dae1 100755 (executable)
@@ -150,7 +150,8 @@ function run {
        return 1
     fi
 
-    if SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" "$_netns_opt" --private-network -b; then
+    # allow combination of --network-namespace-path and --private-network
+    if ! SYSTEMD_NSPAWN_UNIFIED_HIERARCHY="$1" SYSTEMD_NSPAWN_USE_CGNS="$2" SYSTEMD_NSPAWN_API_VFS_WRITABLE="$3" systemd-nspawn --register=no -D "$_root" "$_netns_opt" --private-network -b; then
        return 1
     fi