]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: do not try to drop addresses or routes of unmanaged interfaces on carrier...
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 5 Sep 2021 08:14:36 +0000 (17:14 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 10 Sep 2021 10:40:27 +0000 (19:40 +0900)
Currently, link_stop_engines(), link_drop_config(), and link_drop_foreign_config()
do nothing when the interface is unmanaged. So this does not change anything.
But returning earlier should be clear and safer for protecting configs
on unmanaged interfaces.

src/network/networkd-link.c

index 4afd540d201512f97c196341543bef40abc18f18..a7414b2a5d0aed511ee590d6fd66f1442c33e579 100644 (file)
@@ -1617,7 +1617,10 @@ static int link_carrier_lost(Link *link) {
                 /* let's shortcut things for CAN which doesn't need most of what's done below. */
                 return 0;
 
-        if (link->network && link->network->ignore_carrier_loss)
+        if (!link->network)
+                return 0;
+
+        if (link->network->ignore_carrier_loss)
                 return 0;
 
         r = link_stop_engines(link, false);