diff options
author | Felix Fietkau <nbd@openwrt.org> | 2012-03-23 15:45:43 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2012-03-23 15:45:43 +0200 |
commit | 9b40d469c858d9ce4cacfa0aca37ba2ac69d2f96 (patch) | |
tree | 59281a24e69559c30f7ec5a2b6968e06b71d9a42 /proto-shell.c | |
parent | 76d5b041afff56375bb88a18eff33e50acceb1d8 (diff) |
allow proto handlers to attach data items in notify
Diffstat (limited to 'proto-shell.c')
-rw-r--r-- | proto-shell.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/proto-shell.c b/proto-shell.c index b5d436a..aba7298 100644 --- a/proto-shell.c +++ b/proto-shell.c @@ -222,6 +222,16 @@ proto_shell_parse_route_list(struct interface *iface, struct blob_attr *attr, } } +static void +proto_shell_parse_data(struct interface *iface, struct blob_attr *attr) +{ + struct blob_attr *cur; + int rem; + + blobmsg_for_each_attr(cur, attr, rem) + interface_add_data(iface, cur); +} + static struct device * proto_shell_create_tunnel(const char *name, struct blob_attr *attr) { @@ -250,6 +260,7 @@ enum { NOTIFY_ROUTES, NOTIFY_ROUTES6, NOTIFY_TUNNEL, + NOTIFY_DATA, __NOTIFY_LAST }; @@ -266,6 +277,7 @@ static const struct blobmsg_policy notify_attr[__NOTIFY_LAST] = { [NOTIFY_ROUTES] = { .name = "routes", .type = BLOBMSG_TYPE_ARRAY }, [NOTIFY_ROUTES6] = { .name = "routes6", .type = BLOBMSG_TYPE_ARRAY }, [NOTIFY_TUNNEL] = { .name = "tunnel", .type = BLOBMSG_TYPE_TABLE }, + [NOTIFY_DATA] = { .name = "data", .type = BLOBMSG_TYPE_TABLE }, }; static int @@ -327,6 +339,9 @@ proto_shell_update_link(struct proto_shell_state *state, struct blob_attr *data, state->proto.proto_event(&state->proto, IFPEV_UP); + if ((cur = tb[NOTIFY_DATA])) + proto_shell_parse_data(state->proto.iface, cur); + return 0; } |