summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
3325aa0)
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
+static void add_interface(struct network *network,
+ struct interface *interface)
+{
+ list_add(&network->interfaces, &interface->list);
+}
+
+static void remove_interface(struct interface *interface)
+{
+ list_remove(&interface->list);
+ talloc_free(interface);
+}
+
static int interface_change(struct interface *interface, bool up)
{
const char *statestr = up ? "up" : "down";
static int interface_change(struct interface *interface, bool up)
{
const char *statestr = up ? "up" : "down";
if (!interface)
return 0;
pb_log("network: interface %s removed\n", interface->name);
if (!interface)
return 0;
pb_log("network: interface %s removed\n", interface->name);
- list_remove(&interface->list);
- talloc_free(interface);
+ remove_interface(interface);
interface->state = IFSTATE_NEW;
memcpy(interface->hwaddr, ifaddr, sizeof(interface->hwaddr));
strncpy(interface->name, ifname, sizeof(interface->name) - 1);
interface->state = IFSTATE_NEW;
memcpy(interface->hwaddr, ifaddr, sizeof(interface->hwaddr));
strncpy(interface->name, ifname, sizeof(interface->name) - 1);
+ add_interface(network, interface);
}
configure_interface(network, interface,
}
configure_interface(network, interface,