Re: [OpenWrt-Devel] [PATCH 1/2] [netifd] multicast flag control
On 2015-11-19 20:51, Podolak, Nicholas wrote: > Original patchset was not applying correctly. My bad. > > Let's try this again. Please don't include things like this in the patch description part. > Signed-off-by: Nick Podolak> > --- > device.c | 9 + > device.h | 3 +++ > system-linux.c | 10 ++ > 3 files changed, 22 insertions(+) > > diff --git a/device.c b/device.c > index 6dc4fa9..b755d05 100644 > --- a/device.c > +++ b/device.c > @@ -40,6 +40,7 @@ static const struct blobmsg_policy > dev_attrs[__DEV_ATTR_MAX] = { > [DEV_ATTR_ENABLED] = { .name = "enabled", .type = BLOBMSG_TYPE_BOOL }, > [DEV_ATTR_IPV6] = { .name = "ipv6", .type = BLOBMSG_TYPE_BOOL }, > [DEV_ATTR_PROMISC] = { .name = "promisc", .type = BLOBMSG_TYPE_BOOL }, > + [DEV_ATTR_MULTICAST] = { .name = "multicast", .type = > +BLOBMSG_TYPE_BOOL }, Line wrapping here is broken. - Felix ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH 1/2] [netifd] multicast flag control
Original patchset was not applying correctly. My bad. Let's try this again. Signed-off-by: Nick Podolak--- device.c | 9 + device.h | 3 +++ system-linux.c | 10 ++ 3 files changed, 22 insertions(+) diff --git a/device.c b/device.c index 6dc4fa9..b755d05 100644 --- a/device.c +++ b/device.c @@ -40,6 +40,7 @@ static const struct blobmsg_policy dev_attrs[__DEV_ATTR_MAX] = { [DEV_ATTR_ENABLED] = { .name = "enabled", .type = BLOBMSG_TYPE_BOOL }, [DEV_ATTR_IPV6] = { .name = "ipv6", .type = BLOBMSG_TYPE_BOOL }, [DEV_ATTR_PROMISC] = { .name = "promisc", .type = BLOBMSG_TYPE_BOOL }, + [DEV_ATTR_MULTICAST] = { .name = "multicast", .type = +BLOBMSG_TYPE_BOOL }, [DEV_ATTR_RPFILTER] = { .name = "rpfilter", .type = BLOBMSG_TYPE_STRING }, [DEV_ATTR_ACCEPTLOCAL] = { .name = "acceptlocal", .type = BLOBMSG_TYPE_BOOL }, [DEV_ATTR_IGMPVERSION] = { .name = "igmpversion", .type = BLOBMSG_TYPE_INT32 }, @@ -162,6 +163,7 @@ device_merge_settings(struct device *dev, struct device_settings *n) sizeof(n->macaddr)); n->ipv6 = s->flags & DEV_OPT_IPV6 ? s->ipv6 : os->ipv6; n->promisc = s->flags & DEV_OPT_PROMISC ? s->promisc : os->promisc; + n->multicast = s->flags & DEV_OPT_MULTICAST ? s->multicast : +os->multicast; n->rpfilter = s->flags & DEV_OPT_RPFILTER ? s->rpfilter : os->rpfilter; n->acceptlocal = s->flags & DEV_OPT_ACCEPTLOCAL ? s->acceptlocal : os->acceptlocal; n->igmpversion = s->flags & DEV_OPT_IGMPVERSION ? s->igmpversion : os->igmpversion; @@ -222,6 +224,11 @@ device_init_settings(struct device *dev, struct blob_attr **tb) s->flags |= DEV_OPT_PROMISC; } + if ((cur = tb[DEV_ATTR_MULTICAST])) { + s->multicast = blobmsg_get_bool(cur); + s->flags |= DEV_OPT_MULTICAST; + } + if ((cur = tb[DEV_ATTR_RPFILTER])) { if (system_resolve_rpfilter(blobmsg_data(cur), >rpfilter)) s->flags |= DEV_OPT_RPFILTER; @@ -901,6 +908,8 @@ device_dump_status(struct blob_buf *b, struct device *dev) blobmsg_add_u8(b, "ipv6", st.ipv6); if (st.flags & DEV_OPT_PROMISC) blobmsg_add_u8(b, "promisc", st.promisc); + if (st.flags & DEV_OPT_MULTICAST) + blobmsg_add_u8(b, "multicast", st.multicast); if (st.flags & DEV_OPT_RPFILTER) blobmsg_add_u32(b, "rpfilter", st.rpfilter); if (st.flags & DEV_OPT_ACCEPTLOCAL) diff --git a/device.h b/device.h index a6c131a..5a85f48 100644 --- a/device.h +++ b/device.h @@ -34,6 +34,7 @@ enum { DEV_ATTR_ENABLED, DEV_ATTR_IPV6, DEV_ATTR_PROMISC, + DEV_ATTR_MULTICAST, DEV_ATTR_RPFILTER, DEV_ATTR_ACCEPTLOCAL, DEV_ATTR_IGMPVERSION, @@ -86,6 +87,7 @@ enum { DEV_OPT_DADTRANSMITS= (1 << 13), DEV_OPT_MULTICAST_TO_UNICAST= (1 << 14), DEV_OPT_MULTICAST_ROUTER= (1 << 15), + DEV_OPT_MULTICAST = (1 << 16), }; /* events broadcasted to all users of a device */ @@ -135,6 +137,7 @@ struct device_settings { uint8_t macaddr[6]; bool ipv6; bool promisc; + bool multicast; unsigned int rpfilter; bool acceptlocal; unsigned int igmpversion; diff --git a/system-linux.c b/system-linux.c index d3bb64d..ddde843 100644 --- a/system-linux.c +++ b/system-linux.c @@ -1091,6 +1091,11 @@ system_if_get_settings(struct device *dev, struct device_settings *s) s->flags |= DEV_OPT_PROMISC; } + if (ioctl(sock_ioctl, SIOCGIFFLAGS, ) == 0) { + s->multicast = ifr.ifr_flags & IFF_MULTICAST; + s->flags |= DEV_OPT_MULTICAST; + } + if (!system_get_rpfilter(dev, buf, sizeof(buf))) { s->rpfilter = strtoul(buf, NULL, 0); s->flags |= DEV_OPT_RPFILTER; @@ -1193,6 +1198,11 @@ system_if_apply_settings(struct device *dev, struct device_settings *s, unsigned !s->promisc ? IFF_PROMISC : 0) < 0) s->flags &= ~DEV_OPT_PROMISC; } + if (s->flags & DEV_OPT_MULTICAST & apply_mask) { + if (system_if_flags(dev->ifname, s->multicast ? IFF_MULTICAST : 0, + !s->multicast ? IFF_MULTICAST : 0) < 0) + s->flags &= ~DEV_OPT_MULTICAST; + } if (s->flags & DEV_OPT_RPFILTER & apply_mask) { snprintf(buf, sizeof(buf), "%d", s->rpfilter); system_set_rpfilter(dev, buf); -- 1.9.1 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
Re: [OpenWrt-Devel] [PATCH 1/2] [netifd] multicast flag control
I'm sorry but this patch doesn't apply: Applying patch #532998 using 'git am' Description: [OpenWrt-Devel,1/2,netifd] multicast flag control Applying: multicast flag control error: patch failed: device.c:40 error: device.c: patch does not apply error: patch failed: system-linux.c:1091 error: system-linux.c: patch does not apply error: patch failed: device.h:34 error: device.h: patch does not apply Patch failed at 0001 multicast flag control The copy of the patch that failed is found in: .git/rebase-apply/patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". 'git am' failed with exit status 128 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
[OpenWrt-Devel] [PATCH 1/2] [netifd] multicast flag control
From: Nick PodolakThis patch set allows for interfaces defined in UCI to enable and disable multicast support on their underlying device. This has particular use on GRE tunnels which previously did NOT enable multicast by default. Since GRE is commonly used to create router to router links that support multicast for use by routing protocols (e.g. OSPF, EIGRP, etc), or specifically for multicast applications, this modification seemed necessary. This first patch adds the multicast capability to all interfaces/devices. Signed-off-by: Nick Podolak Index: netifd-2015-09-27/device.c === --- netifd-2015-09-27.orig/device.c2015-10-13 15:21:54.358124119 -0400 +++ netifd-2015-09-27/device.c2015-10-13 15:21:54.346124119 -0400 @@ -40,6 +40,7 @@ [DEV_ATTR_ENABLED] = { .name = "enabled", .type = BLOBMSG_TYPE_BOOL }, [DEV_ATTR_IPV6] = { .name = "ipv6", .type = BLOBMSG_TYPE_BOOL }, [DEV_ATTR_PROMISC] = { .name = "promisc", .type = BLOBMSG_TYPE_BOOL }, +[DEV_ATTR_MULTICAST] = { .name = "multicast", .type = BLOBMSG_TYPE_BOOL }, [DEV_ATTR_RPFILTER] = { .name = "rpfilter", .type = BLOBMSG_TYPE_STRING }, [DEV_ATTR_ACCEPTLOCAL] = { .name = "acceptlocal", .type = BLOBMSG_TYPE_BOOL }, [DEV_ATTR_IGMPVERSION] = { .name = "igmpversion", .type = BLOBMSG_TYPE_INT32 }, @@ -162,6 +163,7 @@ sizeof(n->macaddr)); n->ipv6 = s->flags & DEV_OPT_IPV6 ? s->ipv6 : os->ipv6; n->promisc = s->flags & DEV_OPT_PROMISC ? s->promisc : os->promisc; +n->multicast = s->flags & DEV_OPT_MULTICAST ? s->multicast : os->multicast; n->rpfilter = s->flags & DEV_OPT_RPFILTER ? s->rpfilter : os->rpfilter; n->acceptlocal = s->flags & DEV_OPT_ACCEPTLOCAL ? s->acceptlocal : os->acceptlocal; n->igmpversion = s->flags & DEV_OPT_IGMPVERSION ? s->igmpversion : os->igmpversion; @@ -222,6 +224,11 @@ s->flags |= DEV_OPT_PROMISC; } +if ((cur = tb[DEV_ATTR_MULTICAST])) { +s->multicast = blobmsg_get_bool(cur); +s->flags |= DEV_OPT_MULTICAST; +} + if ((cur = tb[DEV_ATTR_RPFILTER])) { if (system_resolve_rpfilter(blobmsg_data(cur), >rpfilter)) s->flags |= DEV_OPT_RPFILTER; @@ -899,6 +906,8 @@ blobmsg_add_u8(b, "ipv6", st.ipv6); if (st.flags & DEV_OPT_PROMISC) blobmsg_add_u8(b, "promisc", st.promisc); +if (st.flags & DEV_OPT_MULTICAST) +blobmsg_add_u8(b, "multicast", st.multicast); if (st.flags & DEV_OPT_RPFILTER) blobmsg_add_u32(b, "rpfilter", st.rpfilter); if (st.flags & DEV_OPT_ACCEPTLOCAL) Index: netifd-2015-09-27/system-linux.c === --- netifd-2015-09-27.orig/system-linux.c2015-10-13 15:21:54.358124119 -0400 +++ netifd-2015-09-27/system-linux.c2015-10-13 15:21:54.350124119 -0400 @@ -1091,6 +1091,11 @@ s->flags |= DEV_OPT_PROMISC; } +if (ioctl(sock_ioctl, SIOCGIFFLAGS, ) == 0) { +s->multicast = ifr.ifr_flags & IFF_MULTICAST; +s->flags |= DEV_OPT_MULTICAST; +} + if (!system_get_rpfilter(dev, buf, sizeof(buf))) { s->rpfilter = strtoul(buf, NULL, 0); s->flags |= DEV_OPT_RPFILTER; @@ -1193,6 +1198,11 @@ !s->promisc ? IFF_PROMISC : 0) < 0) s->flags &= ~DEV_OPT_PROMISC; } +if (s->flags & DEV_OPT_MULTICAST & apply_mask) { +if (system_if_flags(dev->ifname, s->multicast ? IFF_MULTICAST : 0, +!s->multicast ? IFF_MULTICAST : 0) < 0) +s->flags &= ~DEV_OPT_MULTICAST; +} if (s->flags & DEV_OPT_RPFILTER & apply_mask) { snprintf(buf, sizeof(buf), "%d", s->rpfilter); system_set_rpfilter(dev, buf); Index: netifd-2015-09-27/device.h === --- netifd-2015-09-27.orig/device.h2015-10-13 15:21:54.358124119 -0400 +++ netifd-2015-09-27/device.h2015-10-13 15:21:54.350124119 -0400 @@ -34,6 +34,7 @@ DEV_ATTR_ENABLED, DEV_ATTR_IPV6, DEV_ATTR_PROMISC, +DEV_ATTR_MULTICAST, DEV_ATTR_RPFILTER, DEV_ATTR_ACCEPTLOCAL, DEV_ATTR_IGMPVERSION, @@ -88,6 +89,7 @@ DEV_OPT_DADTRANSMITS= (1 << 13), DEV_OPT_MULTICAST_TO_UNICAST= (1 << 14), DEV_OPT_MULTICAST_ROUTER= (1 << 15), +DEV_OPT_MULTICAST= (1 << 16), }; /* events broadcasted to all users of a device */ @@ -136,6 +138,7 @@ uint8_t macaddr[6]; bool ipv6; bool promisc; +bool multicast; unsigned int rpfilter; bool acceptlocal; unsigned int igmpversion; ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel