chiark / gitweb /
networkd-wait-online: improve interoptability and enable by default
[elogind.git] / src / network / networkd-link.c
index fb873a9089416f21fae4a7250d29346465bac414..015a82d0d6022e4f83270afdc8eb3c9b9e1cc0d0 100644 (file)
@@ -30,6 +30,7 @@
 #include "bus-util.h"
 #include "network-internal.h"
 
+#include "network-util.h"
 #include "dhcp-lease-internal.h"
 
 static int ipv4ll_address_update(Link *link, bool deprecate);
@@ -1098,20 +1099,6 @@ static int link_acquire_conf(Link *link) {
         return 0;
 }
 
-static bool link_has_carrier(unsigned flags, uint8_t operstate) {
-        /* see Documentation/networking/operstates.txt in the kernel sources */
-
-        if (operstate == IF_OPER_UP)
-                return true;
-
-        if (operstate == IF_OPER_UNKNOWN)
-                /* operstate may not be implemented, so fall back to flags */
-                if ((flags & IFF_LOWER_UP) && !(flags & IFF_DORMANT))
-                        return true;
-
-        return false;
-}
-
 static int link_update_flags(Link *link, sd_rtnl_message *m) {
         unsigned flags, flags_added, flags_removed, generic_flags;
         uint8_t operstate;
@@ -1509,9 +1496,11 @@ static int link_configure(Link *link) {
         }
 
         if (link_has_carrier(link->flags, link->operstate))
+        {
                 r = link_acquire_conf(link);
                 if (r < 0)
                         return r;
+        }
 
         return link_enter_enslave(link);
 }