X-Git-Url: http://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=discover%2Fnetwork.c;h=cf340dad86b6540c712c9110c30b2b38babe8650;hp=0490be9074486355ce436c173aeabb181affac64;hb=416647ec10a0ca505de35348620391fde80043c0;hpb=9239fd1ec121fc6c6eda49ef5c2dab081a026785 diff --git a/discover/network.c b/discover/network.c index 0490be9..cf340da 100644 --- a/discover/network.c +++ b/discover/network.c @@ -219,6 +219,9 @@ static void configure_interface_dhcp(struct interface *interface) pb_system_apps.udhcpc, "-R", "-n", + "-O", "pxeconffile", + "-O", "pxepathprefix", + "-x", "0x5d:000a", "-p", pidfile, "-i", interface->name, NULL, @@ -415,14 +418,15 @@ static int network_handle_nlmsg(struct network *network, struct nlmsghdr *nlmsg) memcpy(interface->hwaddr, ifaddr, sizeof(interface->hwaddr)); strncpy(interface->name, ifname, sizeof(interface->name) - 1); add_interface(network, interface); - - /* tell the sysinfo code about this interface */ - if (strcmp(interface->name, "lo")) - system_info_register_interface( - sizeof(interface->hwaddr), - interface->hwaddr, interface->name); } + /* notify the sysinfo code about changes to this interface */ + if (strcmp(interface->name, "lo")) + system_info_register_interface( + sizeof(interface->hwaddr), + interface->hwaddr, interface->name, + info->ifi_flags & IFF_LOWER_UP); + configure_interface(network, interface, info->ifi_flags & IFF_UP, info->ifi_flags & IFF_LOWER_UP); @@ -546,8 +550,8 @@ struct network *network_init(struct device_handler *handler, network = talloc(handler, struct network); list_init(&network->interfaces); network->handler = handler; - network->manual_config = false; network->dry_run = dry_run; + network->manual_config = config_get()->network.n_interfaces != 0; network_init_dns(network); @@ -580,8 +584,13 @@ int network_shutdown(struct network *network) if (network->waiter) waiter_remove(network->waiter); - list_for_each_entry(&network->interfaces, interface, list) + list_for_each_entry(&network->interfaces, interface, list) { + if (interface->state == IFSTATE_IGNORED) + continue; + if (!strcmp(interface->name, "lo")) + continue; interface_down(interface); + } close(network->netlink_sd); talloc_free(network);