]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: Allow to retain configs even if carrier is lost
authorSusant Sahani <susant@redhat.com>
Fri, 1 Jun 2018 09:34:49 +0000 (15:04 +0530)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 6 Feb 2019 12:35:11 +0000 (13:35 +0100)
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

man/systemd.network.xml
src/network/networkd-link.c
src/network/networkd-network-gperf.gperf
src/network/networkd-network.h
test/fuzz/fuzz-network-parser/directives.network

index ee464ffff4c7b4ae4d212fb150c141c0c7126298..25a6bc1467cca3b2388a9056c620d04f58156b1d 100644 (file)
           </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>
index 736373ae347d4bc71b97c29193dcdc804ffe9220..463c20774e10a384075eac4d893c6bf678350765 100644 (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. */
index 5d8aede59303dd52e8a9c9d9809eb1fe11cac272..0a0c24c69af8bb28c777e16cb2146629279bd240 100644 (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
index f6e62cdd79930ec1be853f203201675e22549d93..d1cdba55a6f0aff8f68f90bf01b38e728c8cfb86 100644 (file)
@@ -224,6 +224,7 @@ struct Network {
         int allmulticast;
         bool unmanaged;
         bool configure_without_carrier;
+        bool ignore_carrier_loss;
         uint32_t iaid;
         DUID duid;
 
index 209132f239a42b9399e492703854b7a390c5fedf..3fb785baa9e2a9b13e478aa99be4bd0d4b634672 100644 (file)
@@ -116,6 +116,7 @@ VLAN=
 DHCPServer=
 BindCarrier=
 VRF=
+IgnoreCarrierLoss=
 [IPv6Prefix]
 Prefix=
 OnLink=