summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Streetman <ddstreet@canonical.com>2020-04-27 06:38:40 -0400
committerDan Streetman <ddstreet@canonical.com>2020-05-26 08:47:41 -0400
commitbd0d471c8f127972b2a02dcd5a47b3634baaa1d7 (patch)
tree07f1a32b3c93edaabad93e20dc77ad6246b6e514
parent253acc229cecc19a46d86cc7c329a238a552aa7e (diff)
downloadsystemd-bd0d471c8f127972b2a02dcd5a47b3634baaa1d7.tar.gz
network: Change IgnoreCarrierLoss default to value of ConfigureWithoutCarrier
It doesn't make much sense to have ConfigureWithoutCarrier set, but not IgnoreCarrierLoss; all the configuration added during initial interface bring-up will be lost at the first carrier up/down.
-rw-r--r--man/systemd.network.xml8
-rw-r--r--src/network/networkd-network-gperf.gperf2
-rw-r--r--src/network/networkd-network.c5
-rw-r--r--src/network/networkd-network.h2
4 files changed, 12 insertions, 5 deletions
diff --git a/man/systemd.network.xml b/man/systemd.network.xml
index f9e8fa5c25..2de59f2d7d 100644
--- a/man/systemd.network.xml
+++ b/man/systemd.network.xml
@@ -828,15 +828,17 @@
<term><varname>ConfigureWithoutCarrier=</varname></term>
<listitem>
<para>Takes a boolean. Allows networkd to configure a specific link even if it has no carrier.
- Defaults to false.
+ Defaults to false. If <option>IgnoreCarrierLoss=</option> is not explicitly set, it will
+ default to this value.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>IgnoreCarrierLoss=</varname></term>
<listitem>
- <para>A boolean. Allows networkd to retain both the static and dynamic configuration of the
- interface even if its carrier is lost. Defaults to false.
+ <para>Takes a boolean. Allows networkd to retain both the static and dynamic configuration
+ of the interface even if its carrier is lost. When unset, the value specified with
+ <option>ConfigureWithoutCarrier=</option> is used.
</para>
</listitem>
</varlistentry>
diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf
index a2dd5479b2..6f9d7dead7 100644
--- a/src/network/networkd-network-gperf.gperf
+++ b/src/network/networkd-network-gperf.gperf
@@ -102,7 +102,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)
+Network.IgnoreCarrierLoss, config_parse_tristate, 0, offsetof(Network, ignore_carrier_loss)
Network.KeepConfiguration, config_parse_keep_configuration, 0, offsetof(Network, keep_configuration)
Address.Address, config_parse_address, 0, 0
Address.Peer, config_parse_address, 0, 0
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index 1b4083febf..74e383b540 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -271,6 +271,9 @@ int network_verify(Network *network) {
if (network->dhcp_use_gateway < 0)
network->dhcp_use_gateway = network->dhcp_use_routes;
+ if (network->ignore_carrier_loss < 0)
+ network->ignore_carrier_loss = network->configure_without_carrier;
+
if (network->dhcp_critical >= 0) {
if (network->keep_configuration >= 0)
log_warning("%s: Both KeepConfiguration= and deprecated CriticalConnection= are set. "
@@ -460,6 +463,8 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
.ipv6_accept_ra_route_table_set = false,
.ipv6_accept_ra_start_dhcp6_client = true,
+ .configure_without_carrier = false,
+ .ignore_carrier_loss = -1,
.keep_configuration = _KEEP_CONFIGURATION_INVALID,
.ipv6_address_gen_mode = _LINK_IPV6_ADDRESS_GEN_MODE_INVALID,
.can_triple_sampling = -1,
diff --git a/src/network/networkd-network.h b/src/network/networkd-network.h
index 362ef6508f..912ecd0a2e 100644
--- a/src/network/networkd-network.h
+++ b/src/network/networkd-network.h
@@ -257,7 +257,7 @@ struct Network {
int allmulticast;
bool unmanaged;
bool configure_without_carrier;
- bool ignore_carrier_loss;
+ int ignore_carrier_loss;
KeepConfiguration keep_configuration;
LinkIPv6AddressGenMode ipv6_address_gen_mode;
uint32_t iaid;