]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/network/networkd-wait-online-manager.c
tree-wide: expose "p"-suffix unref calls in public APIs to make gcc cleanup easy
[thirdparty/systemd.git] / src / network / networkd-wait-online-manager.c
index 1fc724f5a43da6e5f11b7678ff65fa83ed6e95b9..c70b37001205b41f57711ba950d40d987d01ac4c 100644 (file)
 #include <linux/if.h>
 #include <fnmatch.h>
 
+#include "alloc-util.h"
 #include "netlink-util.h"
-
 #include "network-internal.h"
 #include "networkd-wait-online-link.h"
 #include "networkd-wait-online.h"
-
-#include "util.h"
 #include "time-util.h"
+#include "util.h"
 
 bool manager_ignore_link(Manager *m, Link *link) {
         char **ignore;
@@ -38,9 +37,15 @@ bool manager_ignore_link(Manager *m, Link *link) {
         assert(m);
         assert(link);
 
+        /* always ignore the loopback interface */
         if (link->flags & IFF_LOOPBACK)
                 return true;
 
+        /* if interfaces are given on the command line, ignore all others */
+        if (m->interfaces && !strv_contains(m->interfaces, link->ifname))
+                return true;
+
+        /* ignore interfaces we explicitly are asked to ignore */
         STRV_FOREACH(ignore, m->ignore)
                 if (fnmatch(*ignore, link->ifname, 0) == 0)
                         return true;
@@ -77,7 +82,7 @@ bool manager_all_configured(Manager *m) {
                         return false;
                 }
 
-                if (streq(l->state, "configuring")) {
+                if (STR_IN_SET(l->state, "configuring", "pending")) {
                         log_debug("link %s is being processed by networkd",
                                   l->ifname);
                         return false;
@@ -170,7 +175,7 @@ static int on_rtnl_event(sd_netlink *rtnl, sd_netlink_message *mm, void *userdat
 }
 
 static int manager_rtnl_listen(Manager *m) {
-        _cleanup_netlink_message_unref_ sd_netlink_message *req = NULL, *reply = NULL;
+        _cleanup_(sd_netlink_message_unrefp) sd_netlink_message *req = NULL, *reply = NULL;
         sd_netlink_message *i;
         int r;