realtek: fix flooding of unsnoopable multicast addresses
authorLinus Lüssing <linus.luessing@c0d3.blue>
Sat, 10 May 2025 03:22:22 +0000 (05:22 +0200)
committerRobert Marko <robimarko@gmail.com>
Thu, 15 May 2025 17:01:22 +0000 (19:01 +0200)
commit64ad16993dc423e29ed59effb6d4784e27ca8c31
tree8f5d8b1c573f6cf6dbf38f5493f1ea462790c4bd
parent86a6c550b93ef79199897e480424755d185390b3
realtek: fix flooding of unsnoopable multicast addresses

RFC4541, section 2.1.2 says:

  Packets with a destination IP (DIP) address in the 224.0.0.X range
  which are not IGMP must be forwarded on all ports.

And section 3 says:

  In IPv6, the data forwarding rules are more straight forward because
  MLD is mandated for addresses with scope 2 (link-scope) or greater.
  The only exception is the address FF02::1 which is the all hosts
  link-scope address for which MLD messages are never sent.  Packets
  with the all hosts link-scope address should be forwarded on all
  ports.

However, currently when a listener on FF12::1 or FF12::1234:0:1 for
example joins then not only packets to these addresses but also for
FF02::1 won't be flooded to all ports anymore, too. Which violates
RFC4541.

This happens because A): They all map to the same ethernet multicast
address, that is 33:33:00:00:00:01. And B) the VLAN profile L2
unknown MC flood setting will only apply flooding of 33:33:00:00:00:01
if there is no specific listener registered for it.

So to fix this, avoid registering an MDB entry in the switch for
33:33:00:00:00:01 at all.

The downside of this is that FF12::1, FF12::1234:0:1 etc.
will always be flooded, too. However fixing the handling of 224.0.0.X
and FF02::1 and adhering to RFC4541 must have priority to avoid
undesired packetloss, to avoid breaking IPv4/IPv6.

Tested-on: ZyXEL GS1900-24HP v1

Fixes: cde31976e375 ("realtek: Add support for Layer 2 Multicast")
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
Link: https://github.com/openwrt/openwrt/pull/18769
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/dsa.c