From a9cc0189aa69a5fa1bcbacbdc69740fa3e5353db Mon Sep 17 00:00:00 2001 From: Susant Sahani Date: Fri, 1 Jun 2018 15:04:49 +0530 Subject: [PATCH] networkd: Allow to retain configs even if carrier is lost Closes #9111 --- man/systemd.network.xml | 9 +++++++++ src/network/networkd-link.c | 2 +- src/network/networkd-network-gperf.gperf | 1 + src/network/networkd-network.h | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/man/systemd.network.xml b/man/systemd.network.xml index 64b9232689f87..2e64c5f83efa9 100644 --- a/man/systemd.network.xml +++ b/man/systemd.network.xml @@ -772,6 +772,15 @@ + + IgnoreCarrierLoss= + + A boolean. Allows networkd to retain the configure even if no carrier. + Defaults to false. + + + + diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 32bcc4c459627..1407183898475 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -3157,7 +3157,7 @@ static int link_carrier_lost(Link *link) { /* Some devices reset itself while setting the MTU. This causes the DHCP client fall into a loop. setting_mtu keep track whether the device got reset because of setting MTU and does not drop the configuration and stop the clients as well. */ - if (link->setting_mtu) + if (link->setting_mtu || link->network->ignore_carrier_loss) return 0; r = link_stop_clients(link); diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf index 26e3f452ef365..1df197019358c 100644 --- a/src/network/networkd-network-gperf.gperf +++ b/src/network/networkd-network-gperf.gperf @@ -78,6 +78,7 @@ Network.ProxyARP, config_parse_tristate, Network.IPv6ProxyNDPAddress, config_parse_ipv6_proxy_ndp_address, 0, 0 Network.BindCarrier, config_parse_strv, 0, offsetof(Network, bind_carrier) Network.ConfigureWithoutCarrier, config_parse_bool, 0, offsetof(Network, configure_without_carrier) +Network.IgnoreCarrierLoss, config_parse_bool, 0, offsetof(Network, ignore_carrier_loss) Address.Address, config_parse_address, 0, 0 Address.Peer, config_parse_address, 0, 0 Address.Broadcast, config_parse_broadcast, 0, 0 diff --git a/src/network/networkd-network.h b/src/network/networkd-network.h index 86e97909c9883..dac61049134ca 100644 --- a/src/network/networkd-network.h +++ b/src/network/networkd-network.h @@ -216,6 +216,7 @@ struct Network { int multicast; bool unmanaged; bool configure_without_carrier; + bool ignore_carrier_loss; uint32_t iaid; DUID duid;