networkd: Allow configure a specific link even if it has no carrier. (#6740)
authorSusant Sahani <ssahani@users.noreply.github.com>
Wed, 6 Sep 2017 14:57:04 +0000 (14:57 +0000)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 6 Sep 2017 14:57:04 +0000 (16:57 +0200)
This work allows to configure a specific link even if it has no carrier.

Closes #6645.

man/systemd.network.xml
src/network/networkd-link.c
src/network/networkd-network-gperf.gperf
src/network/networkd-network.h

index 28a0010..8b0f736 100644 (file)
           </para>
         </listitem>
       </varlistentry>
+      <varlistentry>
+        <term><varname>ConfigureWithoutCarrier=</varname></term>
+        <listitem>
+          <para>A boolean. Allows networkd to configure a specific link even if it has no carrier.
+          Defaults to false.
+          </para>
+        </listitem>
+      </varlistentry>
       </variablelist>
 
   </refsect1>
index cba0873..2ad10d2 100644 (file)
@@ -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;
index a225836..54385b5 100644 (file)
@@ -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
index 3f81e20..d55e6f7 100644 (file)
@@ -201,6 +201,7 @@ struct Network {
         size_t mtu;
         int arp;
         bool unmanaged;
+        bool configure_without_carrier;
         uint32_t iaid;
         DUID duid;