- case '?':
- return -EINVAL;
-
- default:
- assert_not_reached("Unhandled option");
- }
- }
-
- return 1;
-}
-
-static bool all_configured(Manager *m) {
- _cleanup_free_ unsigned *indices = NULL;
- char **ifname;
- bool one_ready = false;
- int r, n, i;
-
- n = sd_network_get_ifindices(&indices);
- if (n <= 0)
- return false;
-
- /* 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;
- }