diff options
author | Felix Fietkau <nbd@openwrt.org> | 2011-10-13 15:11:32 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2011-10-13 15:11:32 +0200 |
commit | 05c1f3b0c2058a579ca1a6e2b06329b8c814e5bd (patch) | |
tree | e54c1194e9613e54bd7d7183eaff21cbb42effaa /proto-shell.c | |
parent | 2ac630138173e111e16b9c544d9da53f3af97f2e (diff) |
proto-shell: fix updating settings, only issue ifup event after configuration has been applied
Diffstat (limited to 'proto-shell.c')
-rw-r--r-- | proto-shell.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/proto-shell.c b/proto-shell.c index 3ed4b8e..3dcfb69 100644 --- a/proto-shell.c +++ b/proto-shell.c @@ -331,21 +331,23 @@ proto_shell_update_link(struct proto_shell_state *state, struct blob_attr **tb) return UBUS_STATUS_INVALID_ARGUMENT; up = blobmsg_get_bool(tb[NOTIFY_LINK_UP]); - if (up) { - if (!tb[NOTIFY_IFNAME]) - return UBUS_STATUS_INVALID_ARGUMENT; - - if (!state->l3_dev.dev) { - device_add_user(&state->l3_dev, - device_get(blobmsg_data(tb[NOTIFY_IFNAME]), true)); - device_claim(&state->l3_dev); - state->proto.iface->l3_dev = &state->l3_dev; - } - state->proto.proto_event(&state->proto, IFPEV_UP); - } else { + if (!up) { state->proto.proto_event(&state->proto, IFPEV_LINK_LOST); + return 0; } + if (!tb[NOTIFY_IFNAME]) + return UBUS_STATUS_INVALID_ARGUMENT; + + if (!state->l3_dev.dev) { + device_add_user(&state->l3_dev, + device_get(blobmsg_data(tb[NOTIFY_IFNAME]), true)); + device_claim(&state->l3_dev); + state->proto.iface->l3_dev = &state->l3_dev; + } + + interface_ip_update_start(state->proto.iface); + if ((cur = tb[NOTIFY_ADDR_EXT]) != NULL) addr_ext = blobmsg_get_bool(cur); @@ -364,6 +366,10 @@ proto_shell_update_link(struct proto_shell_state *state, struct blob_attr **tb) if ((cur = tb[NOTIFY_DNS]) != NULL) interface_add_dns_server_list(state->proto.iface, cur); + interface_ip_update_complete(state->proto.iface); + + state->proto.proto_event(&state->proto, IFPEV_UP); + return 0; } |