From dad2d78e1a43a46565e24ee436c979b48bf02fcd Mon Sep 17 00:00:00 2001 From: Susant Sahani Date: Wed, 6 Sep 2017 14:57:04 +0000 Subject: [PATCH] networkd: Allow configure a specific link even if it has no carrier. (#6740) This work allows to configure a specific link even if it has no carrier. Closes #6645. --- man/systemd.network.xml | 8 ++++++++ src/network/networkd-link.c | 4 ++-- src/network/networkd-network-gperf.gperf | 1 + src/network/networkd-network.h | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/man/systemd.network.xml b/man/systemd.network.xml index 28a00109f8..8b0f7363df 100644 --- a/man/systemd.network.xml +++ b/man/systemd.network.xml @@ -718,6 +718,14 @@ + + ConfigureWithoutCarrier= + + A boolean. Allows networkd to configure a specific link even if it has no carrier. + Defaults to false. + + + diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index cba0873871..2ad10d2743 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -2138,7 +2138,7 @@ static int link_joined(Link *link) { /* Skip setting up addresses until it gets carrier, or it would try to set addresses twice, which is bad for non-idempotent steps. */ - if (!link_has_carrier(link)) + if (!link_has_carrier(link) && !link->network->configure_without_carrier) return 0; return link_enter_set_addresses(link); @@ -2647,7 +2647,7 @@ static int link_configure(Link *link) { return r; } - if (link_has_carrier(link)) { + if (link_has_carrier(link) || link->network->configure_without_carrier) { r = link_acquire_conf(link); if (r < 0) return r; diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf index a225836598..54385b59d7 100644 --- a/src/network/networkd-network-gperf.gperf +++ b/src/network/networkd-network-gperf.gperf @@ -70,6 +70,7 @@ Network.IPv4ProxyARP, config_parse_tristate, Network.ProxyARP, config_parse_tristate, 0, offsetof(Network, proxy_arp) 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) 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 3f81e20b91..d55e6f73f9 100644 --- a/src/network/networkd-network.h +++ b/src/network/networkd-network.h @@ -201,6 +201,7 @@ struct Network { size_t mtu; int arp; bool unmanaged; + bool configure_without_carrier; uint32_t iaid; DUID duid;