+ /* wait for networkd to be aware of all the links given on the commandline */
+ STRV_FOREACH(ifname, arg_interfaces) {
+ _cleanup_rtnl_message_unref_ sd_rtnl_message *message = NULL, *reply = NULL;
+ bool found = false;
+ int index;
+
+ r = sd_rtnl_message_new_link(m->rtnl, &message, RTM_GETLINK, 0);
+ if (r < 0) {
+ log_warning("colud not create GETLINK message: %s", strerror(-r));
+ return false;
+ }
+
+ r = sd_rtnl_message_append_string(message, IFLA_IFNAME, *ifname);
+ if (r < 0) {
+ log_warning("could not attach ifname to GETLINK message: %s", strerror(-r));
+ return false;
+ }
+
+ r = sd_rtnl_call(m->rtnl, message, 0, &reply);
+ if (r < 0) {
+ if (r != -ENODEV)
+ log_warning("could not get link info for %s: %s", *ifname,
+ strerror(-r));
+
+ /* link does not yet exist */
+ return false;
+ }
+
+ r = sd_rtnl_message_link_get_ifindex(reply, &index);
+ if (r < 0) {
+ log_warning("could not get ifindex: %s", strerror(-r));
+ return false;
+ }
+
+ if (index <= 0) {
+ log_warning("invalid ifindex %d for %s", index, *ifname);
+ return false;
+ }
+
+ for (i = 0; i < n; i++) {
+ if (indices[i] == (unsigned) index) {
+ found = true;
+ break;
+ }
+ }
+
+ if (!found) {
+ /* link exists, but networkd is not yet aware of it */
+ return false;
+ }
+ }
+
+ /* wait for all links networkd manages to be in admin state 'configured'
+ and at least one link to gain a carrier */