diff options
author | Hans Dedecker <dedeckeh@gmail.com> | 2016-02-01 10:56:29 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2016-02-01 11:09:58 +0100 |
commit | abbea9ebe8a8b56032e0f85b8572f0671dc094e5 (patch) | |
tree | 08e964c7f96ca12e6827c07c7a198d4300d5fc93 /device.c | |
parent | fa624787a83347039ff690ec0a8e209fd1642c2e (diff) |
device: Support multicast config option
Make multicast device flag configurable by extending device attributes
with the multicast attribute
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Signed-off-by: Nick Podolak <nicholas.podolak@dtechlabs.com>
Diffstat (limited to 'device.c')
-rw-r--r-- | device.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -50,6 +50,7 @@ static const struct blobmsg_policy dev_attrs[__DEV_ATTR_MAX] = { [DEV_ATTR_DADTRANSMITS] = { .name = "dadtransmits", .type = BLOBMSG_TYPE_INT32 }, [DEV_ATTR_MULTICAST_TO_UNICAST] = { .name = "multicast_to_unicast", .type = BLOBMSG_TYPE_BOOL }, [DEV_ATTR_MULTICAST_ROUTER] = { .name = "multicast_router", .type = BLOBMSG_TYPE_INT32 }, + [DEV_ATTR_MULTICAST] = { .name ="multicast", .type = BLOBMSG_TYPE_BOOL }, }; const struct uci_blob_param_list device_attr_list = { @@ -172,6 +173,8 @@ device_merge_settings(struct device *dev, struct device_settings *n) s->neigh6reachabletime : os->neigh6reachabletime; n->dadtransmits = s->flags & DEV_OPT_DADTRANSMITS ? s->dadtransmits : os->dadtransmits; + n->multicast = s->flags & DEV_OPT_MULTICAST ? + s->multicast : os->multicast; n->multicast_to_unicast = s->multicast_to_unicast; n->multicast_router = s->multicast_router; n->flags = s->flags | os->flags | os->valid_flags; @@ -287,6 +290,11 @@ device_init_settings(struct device *dev, struct blob_attr **tb) DPRINTF("Invalid value: %d - (Use 0: never, 1: learn, 2: always)\n", blobmsg_get_u32(cur)); } + if ((cur = tb[DEV_ATTR_MULTICAST])) { + s->multicast = blobmsg_get_bool(cur); + s->flags |= DEV_OPT_MULTICAST; + } + device_set_disabled(dev, disabled); } @@ -922,6 +930,8 @@ device_dump_status(struct blob_buf *b, struct device *dev) blobmsg_add_u8(b, "multicast_to_unicast", st.multicast_to_unicast); if (st.flags & DEV_OPT_MULTICAST_ROUTER) blobmsg_add_u32(b, "multicast_router", st.multicast_router); + if (st.flags & DEV_OPT_MULTICAST) + blobmsg_add_u8(b, "multicast", st.multicast); } s = blobmsg_open_table(b, "statistics"); |