Re: [Bridge] [RFC PATCH net-next] bridge: Implement MLD Querier wake-up calls / Android bug workaround
On 2020-08-23 17:42, Linus Lüssing wrote: > On Sun, Aug 16, 2020 at 03:08:13PM -0700, Stephen Hemminger wrote: >> Rather than adding yet another feature to the bridge, could this hack be >> done by >> having a BPF hook? or netfilter module? > > Hi Stephen, > > Thanks for the constructive feedback and suggestions! > > The netfilter approach sounds tempting. However as far as I know > OpenWrt's firewall has no easy layer 2 netfilter integration yet. > So it has default layer 3 netfilter rules, but not for layer 2. > > Ideally I'd want to work towards a solution where things "just > work as expected" when a user enables "IGMP Snooping" in the UI. > I could hack the netfilter rules into netifd, the OpenWrt network > manager, when it configures the bridge. But not sure if the > OpenWrt maintainers would like that... > > Any preferences from the OpenWrt maintainers side? Enabling bridge netfilter comes with a very significant performance cost, so it's not something that should be done in a default configuration. - Felix
Re: [Bridge] [RFC PATCH net-next] bridge: Implement MLD Querier wake-up calls / Android bug workaround
On Sun, 23 Aug 2020 17:42:39 +0200 Linus Lüssing wrote: > On Sun, Aug 16, 2020 at 03:08:13PM -0700, Stephen Hemminger wrote: > > Rather than adding yet another feature to the bridge, could this hack be > > done by > > having a BPF hook? or netfilter module? > > Hi Stephen, > > Thanks for the constructive feedback and suggestions! > > The netfilter approach sounds tempting. However as far as I know > OpenWrt's firewall has no easy layer 2 netfilter integration yet. > So it has default layer 3 netfilter rules, but not for layer 2. > > Ideally I'd want to work towards a solution where things "just > work as expected" when a user enables "IGMP Snooping" in the UI. > I could hack the netfilter rules into netifd, the OpenWrt network > manager, when it configures the bridge. But not sure if the > OpenWrt maintainers would like that... > > Any preferences from the OpenWrt maintainers side? > > Regards, Linus > > > PS: With BPF I don't have that much experience yet. I would need > to write a daemon which would parse the MLD packets and would > fetch the FDB via netlink, right? If so, sounds like that would > need way more than 300 lines of code. And that would need to be > maintained within OpenWrt, right? With BPF you would need to write a small program that transforms the packet as you want. The BPF program and the userspace program would share a map table. The userspace program would monitor netlink messages about FDB and update the map. Yes it would be a few hundred lines but not huge. The userspace could even be selective and only do it for devices where it knows they are using the broken Android code. Sorry, no idea how OpenWrt manages their packages.
Re: [Bridge] [RFC PATCH net-next] bridge: Implement MLD Querier wake-up calls / Android bug workaround
On Sun, Aug 16, 2020 at 03:08:13PM -0700, Stephen Hemminger wrote: > Rather than adding yet another feature to the bridge, could this hack be done > by > having a BPF hook? or netfilter module? Hi Stephen, Thanks for the constructive feedback and suggestions! The netfilter approach sounds tempting. However as far as I know OpenWrt's firewall has no easy layer 2 netfilter integration yet. So it has default layer 3 netfilter rules, but not for layer 2. Ideally I'd want to work towards a solution where things "just work as expected" when a user enables "IGMP Snooping" in the UI. I could hack the netfilter rules into netifd, the OpenWrt network manager, when it configures the bridge. But not sure if the OpenWrt maintainers would like that... Any preferences from the OpenWrt maintainers side? Regards, Linus PS: With BPF I don't have that much experience yet. I would need to write a daemon which would parse the MLD packets and would fetch the FDB via netlink, right? If so, sounds like that would need way more than 300 lines of code. And that would need to be maintained within OpenWrt, right?
Re: [Bridge] [RFC PATCH net-next] bridge: Implement MLD Querier wake-up calls / Android bug workaround
Linus Lüssing writes: > Currently there are mobile devices (e.g. Android) which are not able > to receive and respond to MLD Queries reliably because the Wifi driver > filters a lot of ICMPv6 when the device is asleep - including > MLD. This in turn breaks IPv6 communication when MLD Snooping is > enabled. However there is one ICMPv6 type which is allowed to pass and > which can be used to wake up the mobile device: ICMPv6 Echo Requests. This is not a bug. They are deliberately breaking IPv6 because they consider this a feature. You should not try to work around such issues. It is a fight you cannot win. Any workaround will only encourage them to come up with new ways to break IPv6. Bjørn
Re: [Bridge] [RFC PATCH net-next] bridge: Implement MLD Querier wake-up calls / Android bug workaround
From: Linus Lüssing Date: Sun, 16 Aug 2020 22:24:24 +0200 > I'm aware that this is quite a hack, so I'm unsure if this is suitable > for upstream. On the other hand, the Android ticket isn't moving > anywhere and even if it were fixed in Android, I'd expect it to take > years until that fix would propagate or unpatched Android devices to > vanish. So I'm wondering if it should be treated like a hardware bug > workaround and by that should be suitable for applying it upstream in > the Linux kernel? Long after those Android devices are deprecated and no longer used, we will still have this ugly hack in the tree. Sorry, we're not doing this.
Re: [Bridge] [RFC PATCH net-next] bridge: Implement MLD Querier wake-up calls / Android bug workaround
From: Stephen Hemminger Date: Sun, 16 Aug 2020 15:08:13 -0700 > Rather than adding yet another feature to the bridge, could this hack be done > by > having a BPF hook? or netfilter module? Stephen please do not quote an entire huge patch just to add a small amount of commentary at the end. Thank you.
Re: [Bridge] [RFC PATCH net-next] bridge: Implement MLD Querier wake-up calls / Android bug workaround
On Sun, 16 Aug 2020 22:24:24 +0200 Linus Lüssing wrote: > Implement a configurable MLD Querier wake-up calls "feature" which > works around a widely spread Android bug in connection with IGMP/MLD > snooping. > > Currently there are mobile devices (e.g. Android) which are not able > to receive and respond to MLD Queries reliably because the Wifi driver > filters a lot of ICMPv6 when the device is asleep - including > MLD. This in turn breaks IPv6 communication when MLD Snooping is > enabled. However there is one ICMPv6 type which is allowed to pass and > which can be used to wake up the mobile device: ICMPv6 Echo Requests. > > If this bridge is the selected MLD Querier then setting > "multicast_wakeupcall" to a number n greater than 0 will send n > ICMPv6 Echo Requests to each host behind this port to wake > them up with each MLD Query. Upon receiving a matching ICMPv6 Echo > Reply an MLD Query with a unicast ethernet destination will be sent > to the specific host(s). > > Link: https://issuetracker.google.com/issues/149630944 > Link: https://github.com/freifunk-gluon/gluon/issues/1832 > > Signed-off-by: Linus Lüssing > --- > A version of this patch rebased to Linux 4.14 is currently applied on a > 400 nodes mesh network (Freifunk Vogtland). > > I'm aware that this is quite a hack, so I'm unsure if this is suitable > for upstream. On the other hand, the Android ticket isn't moving > anywhere and even if it were fixed in Android, I'd expect it to take > years until that fix would propagate or unpatched Android devices to > vanish. So I'm wondering if it should be treated like a hardware bug > workaround and by that should be suitable for applying it upstream in > the Linux kernel? > > I've also raised this issue on the mcast-w...@ietf.org and p...@ietf.org > mailing list earlier this year but the amount of feedback was a bit > sparse. > > CC'ing the OpenWrt mailing list, too, as I expect there to be most users > affected by this issue, if they enabled IGMP/MLD snooping. > > Let me know what you think about this. > > include/linux/if_bridge.h| 1 + > include/uapi/linux/if_link.h | 1 + > net/bridge/Kconfig | 26 > net/bridge/br_fdb.c | 10 ++ > net/bridge/br_input.c| 4 +- > net/bridge/br_multicast.c| 284 ++- > net/bridge/br_netlink.c | 19 +++ > net/bridge/br_private.h | 19 +++ > net/bridge/br_sysfs_if.c | 18 +++ > 9 files changed, 374 insertions(+), 8 deletions(-) > > diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h > index 6479a38e52fa..73bc692e1ae6 100644 > --- a/include/linux/if_bridge.h > +++ b/include/linux/if_bridge.h > @@ -50,6 +50,7 @@ struct br_ip_list { > #define BR_MRP_AWARE BIT(17) > #define BR_MRP_LOST_CONT BIT(18) > #define BR_MRP_LOST_IN_CONT BIT(19) > +#define BR_MULTICAST_WAKEUPCALL BIT(20) > > #define BR_DEFAULT_AGEING_TIME (300 * HZ) > > diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h > index 7fba4de511de..5015f8ce1ad7 100644 > --- a/include/uapi/linux/if_link.h > +++ b/include/uapi/linux/if_link.h > @@ -355,6 +355,7 @@ enum { > IFLA_BRPORT_BACKUP_PORT, > IFLA_BRPORT_MRP_RING_OPEN, > IFLA_BRPORT_MRP_IN_OPEN, > + IFLA_BRPORT_MCAST_WAKEUPCALL, > __IFLA_BRPORT_MAX > }; > #define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1) > diff --git a/net/bridge/Kconfig b/net/bridge/Kconfig > index 80879196560c..056e80bf00c4 100644 > --- a/net/bridge/Kconfig > +++ b/net/bridge/Kconfig > @@ -48,6 +48,32 @@ config BRIDGE_IGMP_SNOOPING > > If unsure, say Y. > > +config BRIDGE_IGMP_SNOOPING_WAKEUPCALLS > + bool "MLD Querier wake-up calls" > + depends on BRIDGE_IGMP_SNOOPING > + depends on IPV6 > + help > + If you say Y here, then the MLD Snooping Querier will be built > + with a per bridge port wake-up call "feature"/workaround. > + > + Currently there are mobile devices (e.g. Android) which are not able > + to receive and respond to MLD Queries reliably because the Wifi driver > + filters a lot of ICMPv6 when the device is asleep - including MLD. > + This in turn breaks IPv6 communication when MLD Snooping is enabled. > + However there is one ICMPv6 type which is allowed to pass and > + which can be used to wake up the mobile device: ICMPv6 Echo Requests. > + > + If this bridge is the selected MLD Querier then setting > + "multicast_wakeupcall" to a number n greater than 0 will send n > + ICMPv6 Echo Requests to each host behind this port to wake them up > + with each MLD Query. Upon receiving a matching ICMPv6 Echo Reply > + an MLD Query with a unicast ethernet destination will be sent to the > + specific host(s). > + > + Say N to exclude this support and reduce the binary size. > + > + If unsure, say N. > + > config BRIDGE_VLAN_FILTERING > bool "VLAN filtering" >
[Bridge] [RFC PATCH net-next] bridge: Implement MLD Querier wake-up calls / Android bug workaround
Implement a configurable MLD Querier wake-up calls "feature" which works around a widely spread Android bug in connection with IGMP/MLD snooping. Currently there are mobile devices (e.g. Android) which are not able to receive and respond to MLD Queries reliably because the Wifi driver filters a lot of ICMPv6 when the device is asleep - including MLD. This in turn breaks IPv6 communication when MLD Snooping is enabled. However there is one ICMPv6 type which is allowed to pass and which can be used to wake up the mobile device: ICMPv6 Echo Requests. If this bridge is the selected MLD Querier then setting "multicast_wakeupcall" to a number n greater than 0 will send n ICMPv6 Echo Requests to each host behind this port to wake them up with each MLD Query. Upon receiving a matching ICMPv6 Echo Reply an MLD Query with a unicast ethernet destination will be sent to the specific host(s). Link: https://issuetracker.google.com/issues/149630944 Link: https://github.com/freifunk-gluon/gluon/issues/1832 Signed-off-by: Linus Lüssing --- A version of this patch rebased to Linux 4.14 is currently applied on a 400 nodes mesh network (Freifunk Vogtland). I'm aware that this is quite a hack, so I'm unsure if this is suitable for upstream. On the other hand, the Android ticket isn't moving anywhere and even if it were fixed in Android, I'd expect it to take years until that fix would propagate or unpatched Android devices to vanish. So I'm wondering if it should be treated like a hardware bug workaround and by that should be suitable for applying it upstream in the Linux kernel? I've also raised this issue on the mcast-w...@ietf.org and p...@ietf.org mailing list earlier this year but the amount of feedback was a bit sparse. CC'ing the OpenWrt mailing list, too, as I expect there to be most users affected by this issue, if they enabled IGMP/MLD snooping. Let me know what you think about this. include/linux/if_bridge.h| 1 + include/uapi/linux/if_link.h | 1 + net/bridge/Kconfig | 26 net/bridge/br_fdb.c | 10 ++ net/bridge/br_input.c| 4 +- net/bridge/br_multicast.c| 284 ++- net/bridge/br_netlink.c | 19 +++ net/bridge/br_private.h | 19 +++ net/bridge/br_sysfs_if.c | 18 +++ 9 files changed, 374 insertions(+), 8 deletions(-) diff --git a/include/linux/if_bridge.h b/include/linux/if_bridge.h index 6479a38e52fa..73bc692e1ae6 100644 --- a/include/linux/if_bridge.h +++ b/include/linux/if_bridge.h @@ -50,6 +50,7 @@ struct br_ip_list { #define BR_MRP_AWARE BIT(17) #define BR_MRP_LOST_CONT BIT(18) #define BR_MRP_LOST_IN_CONTBIT(19) +#define BR_MULTICAST_WAKEUPCALLBIT(20) #define BR_DEFAULT_AGEING_TIME (300 * HZ) diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h index 7fba4de511de..5015f8ce1ad7 100644 --- a/include/uapi/linux/if_link.h +++ b/include/uapi/linux/if_link.h @@ -355,6 +355,7 @@ enum { IFLA_BRPORT_BACKUP_PORT, IFLA_BRPORT_MRP_RING_OPEN, IFLA_BRPORT_MRP_IN_OPEN, + IFLA_BRPORT_MCAST_WAKEUPCALL, __IFLA_BRPORT_MAX }; #define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1) diff --git a/net/bridge/Kconfig b/net/bridge/Kconfig index 80879196560c..056e80bf00c4 100644 --- a/net/bridge/Kconfig +++ b/net/bridge/Kconfig @@ -48,6 +48,32 @@ config BRIDGE_IGMP_SNOOPING If unsure, say Y. +config BRIDGE_IGMP_SNOOPING_WAKEUPCALLS + bool "MLD Querier wake-up calls" + depends on BRIDGE_IGMP_SNOOPING + depends on IPV6 + help + If you say Y here, then the MLD Snooping Querier will be built + with a per bridge port wake-up call "feature"/workaround. + + Currently there are mobile devices (e.g. Android) which are not able + to receive and respond to MLD Queries reliably because the Wifi driver + filters a lot of ICMPv6 when the device is asleep - including MLD. + This in turn breaks IPv6 communication when MLD Snooping is enabled. + However there is one ICMPv6 type which is allowed to pass and + which can be used to wake up the mobile device: ICMPv6 Echo Requests. + + If this bridge is the selected MLD Querier then setting + "multicast_wakeupcall" to a number n greater than 0 will send n + ICMPv6 Echo Requests to each host behind this port to wake them up + with each MLD Query. Upon receiving a matching ICMPv6 Echo Reply + an MLD Query with a unicast ethernet destination will be sent to the + specific host(s). + + Say N to exclude this support and reduce the binary size. + + If unsure, say N. + config BRIDGE_VLAN_FILTERING bool "VLAN filtering" depends on BRIDGE diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index 9db504baa094..f63f85c5007c 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c @@ -84,6 +84,10 @@ static void fdb_rcu_free(struct rcu_head