networkd: Allow to retain configs even if carrier is lost

When there is bad link in the network the carrier goes up/down.
This makes networkd stops all the clients and drop config.
But if the remote router/dhcpserver running a prevention
of DHCP Starvation attack or DHCP Flood attack it does not allow
networkd to take a DHCP lease resulting failure in configuration.
This patch allows to keep the client running and keep the conf
also for this scenario.

Closes #9111
This commit is contained in:
Susant Sahani 2018-06-01 15:04:49 +05:30 committed by Yu Watanabe
parent 2b3943a02b
commit 93b4dab57e
5 changed files with 15 additions and 0 deletions

View File

@ -800,6 +800,15 @@
</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>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

View File

@ -3500,6 +3500,9 @@ static int link_carrier_lost(Link *link) {
assert(link);
if (link->network->ignore_carrier_loss)
return 0;
/* 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. */

View File

@ -81,6 +81,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

View File

@ -224,6 +224,7 @@ struct Network {
int allmulticast;
bool unmanaged;
bool configure_without_carrier;
bool ignore_carrier_loss;
uint32_t iaid;
DUID duid;

View File

@ -116,6 +116,7 @@ VLAN=
DHCPServer=
BindCarrier=
VRF=
IgnoreCarrierLoss=
[IPv6Prefix]
Prefix=
OnLink=