From f1c22cf4dad5fa960bd8a63b297c3b9bfa7b363e Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sun, 5 Sep 2021 17:14:36 +0900 Subject: [PATCH] network: do not try to drop addresses or routes of unmanaged interfaces on carrier lost 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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 4afd540d201..a7414b2a5d0 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -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); -- 2.47.3