summaryrefslogtreecommitdiffhomepage
path: root/proto-shell.c
diff options
context:
space:
mode:
authorHelmut Schaa <helmut.schaa@googlemail.com>2014-03-20 16:26:23 +0100
committerFelix Fietkau <nbd@openwrt.org>2014-03-21 16:05:20 +0100
commit3d317e90f15eec480b23f4dcddb841c292bef690 (patch)
tree23bd42c83bd676a029fe4536d68de414a606d7c9 /proto-shell.c
parent559df99f259e88edaa7e45826a0ff436f2a07d1a (diff)
netifd: Reload proto on topology change
Introduce a new device event "topology change" that gets signaled by bridges on adding/removing members. On "topology changes" the proto handlers are requested to "renew" which is most useful for DHCP. Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Diffstat (limited to 'proto-shell.c')
-rw-r--r--proto-shell.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/proto-shell.c b/proto-shell.c
index 9041045..de1b084 100644
--- a/proto-shell.c
+++ b/proto-shell.c
@@ -159,6 +159,10 @@ proto_shell_handler(struct interface_proto_state *proto,
state->last_error = -1;
proto_shell_clear_host_dep(state);
state->sm = S_SETUP;
+ } else if (cmd == PROTO_CMD_RENEW) {
+ if (!(handler->proto.flags & PROTO_FLAG_RENEW_AVAILABLE))
+ return 0;
+ action = "renew";
} else {
if (state->sm == S_TEARDOWN)
return 0;
@@ -761,6 +765,10 @@ proto_shell_add_handler(const char *script, const char *name, json_object *obj)
if (tmp && json_object_get_boolean(tmp))
handler->proto.flags |= PROTO_FLAG_INIT_AVAILABLE;
+ tmp = json_get_field(obj, "renew-handler", json_type_boolean);
+ if (tmp && json_object_get_boolean(tmp))
+ handler->proto.flags |= PROTO_FLAG_RENEW_AVAILABLE;
+
config = json_get_field(obj, "config", json_type_array);
if (config)
handler->config_buf = netifd_handler_parse_config(&handler->config, config);