* [PATCH net-next v1] r8152: allow userland to disable multicast
@ 2022-08-30 4:59 Sven van Ashbrook
2022-08-31 3:14 ` Hayes Wang
2022-08-31 22:00 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 4+ messages in thread
From: Sven van Ashbrook @ 2022-08-30 4:59 UTC (permalink / raw)
To: LKML
Cc: Alex Levin, Chithra Annegowda, Frank Gorgenyi, Sven van Ashbrook,
Aaron Ma, David Ober, David S. Miller, Eric Dumazet, Hao Chen,
Hayes Wang, Jakub Kicinski, Jean-Francois Le Fillatre,
Paolo Abeni, linux-usb, netdev
The rtl8152 driver does not disable multicasting when userspace asks
it to. For example:
$ ifconfig eth0 -multicast -allmulti
$ tcpdump -p -i eth0 # will still capture multicast frames
Fix by clearing the device multicast filter table when multicast and
allmulti are both unset.
Tested as follows:
- Set multicast on eth0 network interface
- verify that multicast packets are coming in:
$ tcpdump -p -i eth0
- Clear multicast and allmulti on eth0 network interface
- verify that no more multicast packets are coming in:
$ tcpdump -p -i eth0
Signed-off-by: Sven van Ashbrook <svenva@chromium.org>
---
drivers/net/usb/r8152.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 688905ea0a6d..5e85b8bf9e87 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -2727,22 +2727,26 @@ static void _rtl8152_set_rx_mode(struct net_device *netdev)
ocp_data |= RCR_AM | RCR_AAP;
mc_filter[1] = 0xffffffff;
mc_filter[0] = 0xffffffff;
- } else if ((netdev_mc_count(netdev) > multicast_filter_limit) ||
- (netdev->flags & IFF_ALLMULTI)) {
+ } else if ((netdev->flags & IFF_MULTICAST &&
+ netdev_mc_count(netdev) > multicast_filter_limit) ||
+ (netdev->flags & IFF_ALLMULTI)) {
/* Too many to filter perfectly -- accept all multicasts. */
ocp_data |= RCR_AM;
mc_filter[1] = 0xffffffff;
mc_filter[0] = 0xffffffff;
} else {
- struct netdev_hw_addr *ha;
-
mc_filter[1] = 0;
mc_filter[0] = 0;
- netdev_for_each_mc_addr(ha, netdev) {
- int bit_nr = ether_crc(ETH_ALEN, ha->addr) >> 26;
- mc_filter[bit_nr >> 5] |= 1 << (bit_nr & 31);
- ocp_data |= RCR_AM;
+ if (netdev->flags & IFF_MULTICAST) {
+ struct netdev_hw_addr *ha;
+
+ netdev_for_each_mc_addr(ha, netdev) {
+ int bit_nr = ether_crc(ETH_ALEN, ha->addr) >> 26;
+
+ mc_filter[bit_nr >> 5] |= 1 << (bit_nr & 31);
+ ocp_data |= RCR_AM;
+ }
}
}
--
2.37.2.672.g94769d06f0-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH net-next v1] r8152: allow userland to disable multicast
2022-08-30 4:59 [PATCH net-next v1] r8152: allow userland to disable multicast Sven van Ashbrook
@ 2022-08-31 3:14 ` Hayes Wang
2022-08-31 22:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 4+ messages in thread
From: Hayes Wang @ 2022-08-31 3:14 UTC (permalink / raw)
To: Sven van Ashbrook, LKML
Cc: Alex Levin, Chithra Annegowda, Frank Gorgenyi, Aaron Ma,
David Ober, David S. Miller, Eric Dumazet, Hao Chen,
Jakub Kicinski, Jean-Francois Le Fillatre, Paolo Abeni,
linux-usb, netdev
Sven van Ashbrook <svenva@chromium.org>
> Sent: Tuesday, August 30, 2022 1:00 PM
[...]
> The rtl8152 driver does not disable multicasting when userspace asks
> it to. For example:
> $ ifconfig eth0 -multicast -allmulti
> $ tcpdump -p -i eth0 # will still capture multicast frames
>
> Fix by clearing the device multicast filter table when multicast and
> allmulti are both unset.
>
> Tested as follows:
> - Set multicast on eth0 network interface
> - verify that multicast packets are coming in:
> $ tcpdump -p -i eth0
> - Clear multicast and allmulti on eth0 network interface
> - verify that no more multicast packets are coming in:
> $ tcpdump -p -i eth0
>
> Signed-off-by: Sven van Ashbrook <svenva@chromium.org>
Acked-by: Hayes Wang <hayeswang@realtek.com>
Best Regards,
Hayes
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next v1] r8152: allow userland to disable multicast
2022-08-30 4:59 [PATCH net-next v1] r8152: allow userland to disable multicast Sven van Ashbrook
2022-08-31 3:14 ` Hayes Wang
@ 2022-08-31 22:00 ` patchwork-bot+netdevbpf
2022-08-31 22:32 ` Sven van Ashbrook
1 sibling, 1 reply; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-08-31 22:00 UTC (permalink / raw)
To: Sven van Ashbrook
Cc: linux-kernel, levinale, chithraa, frankgor, aaron.ma, dober6023,
davem, edumazet, chenhao288, hayeswang, kuba, jflf_kernel,
pabeni, linux-usb, netdev
Hello:
This patch was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 30 Aug 2022 04:59:39 +0000 you wrote:
> The rtl8152 driver does not disable multicasting when userspace asks
> it to. For example:
> $ ifconfig eth0 -multicast -allmulti
> $ tcpdump -p -i eth0 # will still capture multicast frames
>
> Fix by clearing the device multicast filter table when multicast and
> allmulti are both unset.
>
> [...]
Here is the summary with links:
- [net-next,v1] r8152: allow userland to disable multicast
https://git.kernel.org/netdev/net-next/c/7305b78ae45f
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next v1] r8152: allow userland to disable multicast
2022-08-31 22:00 ` patchwork-bot+netdevbpf
@ 2022-08-31 22:32 ` Sven van Ashbrook
0 siblings, 0 replies; 4+ messages in thread
From: Sven van Ashbrook @ 2022-08-31 22:32 UTC (permalink / raw)
To: patchwork-bot+netdevbpf
Cc: linux-kernel, levinale, chithraa, frankgor, aaron.ma, dober6023,
davem, edumazet, chenhao288, hayeswang, kuba, jflf_kernel,
pabeni, linux-usb, netdev
Thank you Hayes and Jakub for taking this upstream.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-08-31 22:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-30 4:59 [PATCH net-next v1] r8152: allow userland to disable multicast Sven van Ashbrook
2022-08-31 3:14 ` Hayes Wang
2022-08-31 22:00 ` patchwork-bot+netdevbpf
2022-08-31 22:32 ` Sven van Ashbrook
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.