]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: do not configure anything when running in test mode
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 29 Sep 2021 09:19:38 +0000 (18:19 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 29 Sep 2021 11:50:37 +0000 (20:50 +0900)
src/network/networkd-link.c

index 39a87296c34397042f6723e6c39b5039ba9b1b3b..4ec585a4146cd77ce8feea5d7ad64f0a0e9f889e 100644 (file)
@@ -1392,6 +1392,12 @@ static int link_initialized_and_synced(Link *link) {
         assert(link->ifname);
         assert(link->manager);
 
+        if (link->manager->test_mode) {
+                log_link_debug(link, "Running in test mode, refusing to enter initialized state.");
+                link_set_state(link, LINK_STATE_UNMANAGED);
+                return 0;
+        }
+
         /* We may get called either from the asynchronous netlink callback,
          * or directly from link_check_initialized() if running in a container. */
         if (!IN_SET(link->state, LINK_STATE_PENDING, LINK_STATE_INITIALIZED))