summaryrefslogtreecommitdiff
path: root/device.c
diff options
context:
space:
mode:
authorLinus Lüssing <linus.luessing@c0d3.blue>2015-08-23 17:19:28 +0200
committerFelix Fietkau <nbd@openwrt.org>2015-08-25 08:48:36 +0200
commite057fcb4a260c70f0271f8fdcd7140775a09791f (patch)
treedce1a7e96e814543c693f1b660de3f12ef823958 /device.c
parent1488a64acb77f721fc10d90b0453d95b488460e1 (diff)
downloadnetifd-e057fcb4a260c70f0271f8fdcd7140775a09791f.tar.gz
bridge: Allow setting multicast_router option
The multicast_router option of a bridge allows to control the forwarding behaviour of multicast packets independant of the listener state: * 0: Only forward if specific listener is present * 1 (default): Forward if specific listener or a multicast router was detected (currently only learned via query messages, no MRD support yet) * 2: Always forward any multicast traffic on this port Since MRD is not mandated you might end up with silent multicast routers (e.g. if your link has more than one multicast router; only one can become the selected, "noisy" querier). Here you might need a manual configuration option like the "multicast_router" option. Other scenarios where this can be useful are for instance: * Segmentation of IGMP/MLD domains together with ebtables * Dedicated bridge port for monitoring/debugging purposes Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
Diffstat (limited to 'device.c')
-rw-r--r--device.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/device.c b/device.c
index 3768773..4a8db70 100644
--- a/device.c
+++ b/device.c
@@ -49,6 +49,7 @@ static const struct blobmsg_policy dev_attrs[__DEV_ATTR_MAX] = {
[DEV_ATTR_XPS] = { .name = "xps", .type = BLOBMSG_TYPE_BOOL },
[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 },
};
const struct uci_blob_param_list device_attr_list = {
@@ -176,6 +177,7 @@ device_merge_settings(struct device *dev, struct device_settings *n)
n->dadtransmits = s->flags & DEV_OPT_DADTRANSMITS ?
s->dadtransmits : os->dadtransmits;
n->multicast_to_unicast = s->multicast_to_unicast;
+ n->multicast_router = s->multicast_router;
n->flags = s->flags | os->flags;
}
@@ -281,6 +283,14 @@ device_init_settings(struct device *dev, struct blob_attr **tb)
s->flags |= DEV_OPT_MULTICAST_TO_UNICAST;
}
+ if ((cur = tb[DEV_ATTR_MULTICAST_ROUTER])) {
+ s->multicast_router = blobmsg_get_u32(cur);
+ if (s->multicast_router <= 2)
+ s->flags |= DEV_OPT_MULTICAST_ROUTER;
+ else
+ DPRINTF("Invalid value: %d - (Use 0: never, 1: learn, 2: always)\n", blobmsg_get_u32(cur));
+ }
+
device_set_disabled(dev, disabled);
}
@@ -900,6 +910,8 @@ device_dump_status(struct blob_buf *b, struct device *dev)
blobmsg_add_u32(b, "dadtransmits", st.dadtransmits);
if (st.flags & DEV_OPT_MULTICAST_TO_UNICAST)
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);
}
s = blobmsg_open_table(b, "statistics");