summaryrefslogtreecommitdiffhomepage
path: root/interface.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-10-21 02:16:39 +0200
committerFelix Fietkau <nbd@openwrt.org>2011-10-21 02:16:39 +0200
commitd76dbcf653fc15719cd9d6bb2ab258b94eada46a (patch)
treea02e8dfe7c2abb5c2f3bf69076d09f51c71862e5 /interface.c
parent14f7651a6e61ccd870be78dd6b303057ea982414 (diff)
clean up interface state change handling
Diffstat (limited to 'interface.c')
-rw-r--r--interface.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/interface.c b/interface.c
index 0f54d51..ca641ae 100644
--- a/interface.c
+++ b/interface.c
@@ -93,6 +93,8 @@ interface_flush_state(struct interface *iface)
interface_ip_flush(&iface->proto_ip);
if (iface->main_dev.dev)
device_release(&iface->main_dev);
+ if (iface->l3_dev != &iface->main_dev && iface->l3_dev->dev)
+ device_release(iface->l3_dev);
}
static void
@@ -243,9 +245,6 @@ interface_do_reload(struct interface *iface)
interface_claim_device(iface);
proto_init_interface(iface, iface->config);
-
- if (iface->autostart && !config_init)
- interface_set_up(iface);
}
static void
@@ -259,8 +258,10 @@ interface_handle_config_change(struct interface *iface)
break;
case IFC_REMOVE:
interface_do_free(iface);
- break;
+ return;
}
+ if (iface->autostart && iface->available)
+ interface_set_up(iface);
}
static void
@@ -290,10 +291,6 @@ interface_proto_cb(struct interface_proto_state *state, enum interface_proto_eve
system_flush_routes();
mark_interface_down(iface);
interface_handle_config_change(iface);
- if (iface->l3_dev->dev)
- device_release(iface->l3_dev);
- if (iface->autostart && iface->available)
- __interface_set_up(iface);
break;
case IFPEV_LINK_LOST:
if (iface->state != IFS_UP)