Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial multicast filtering support for bridge #309

Merged
merged 22 commits into from
Mar 7, 2024
Merged

Conversation

troglobit
Copy link
Contributor

@troglobit troglobit commented Feb 23, 2024

Initial IGMP/MLD filtering support for the Linux bridge model. This PR brings per-bridge and per-VLAN settings to control basic multicast snooping1 settings:

  • Enable multicast snooping on the bridge, or per VLAN
  • Adjust querier mode (off, auto, proxy/NULL-only)
  • Adjust query interval (1-1024 sec)

We have verified that the built-in querier function of the kernel works, in particular in a non-VLAN filtering setup. However, since it only supports proxy/NULL queries in a per-VLAN setup we've decided against using it at all. So all querier functionality is handled by a userspace daemon instead.

The upstream kernel support for multicast filtering is still a bit limited. For example:

  1. the only way to enable filtering of layer-2 (MAC) multicast, is to enable multicast snooping
  2. flooding of unknown multicast stops as soon as the bridge learns of a querier
  3. flooding of unknown layer-2 (MAC) multicast also stops as soon as there's a querier

To that end a couple of kernel patches are added to fix the last two issues. These patches are also published on our open kernel repo for the currently used kernel, along with any iproute2 patches needed to control these features. The idea is to upstream them at a later date. (After the next big customer release.)


The next PR in this series will focus on:

  • MDB, both setting static/permanent entries and reading operational data
  • Per VLAN tests
  • Querier election tests
  • Advanced multicast filtering tests, e.g., mixed mdb entries with dynamic groups

Footnotes

  1. Unfortunately there is currently no way in the Linux bridge to enable filtering but not snooping. So when we use the term snooping it may also refer to filtering. We have discussed submitting kernel patches to address this issue but are time limited atm.

@troglobit troglobit linked an issue Feb 23, 2024 that may be closed by this pull request
9 tasks
@troglobit troglobit force-pushed the multicast-snooping branch 2 times, most recently from 857baf8 to 8d34c23 Compare February 29, 2024 09:38
@troglobit troglobit force-pushed the multicast-snooping branch 3 times, most recently from 28e3e23 to 9642d51 Compare March 5, 2024 08:52
@troglobit troglobit marked this pull request as ready for review March 6, 2024 05:52
@troglobit troglobit requested review from mattiaswal, rical and wkz and removed request for rical March 6, 2024 05:52
@troglobit troglobit added the enhancement New feature or request label Mar 6, 2024
@troglobit troglobit added this to the Infix v24.03 milestone Mar 6, 2024
Copy link
Contributor

@wkz wkz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome job guys!

src/confd/yang/infix-if-bridge@2024-02-19.yang Outdated Show resolved Hide resolved
src/confd/src/ietf-interfaces.c Outdated Show resolved Hide resolved
src/confd/src/ietf-interfaces.c Outdated Show resolved Hide resolved
test/case/infix_interfaces/igmp_basic.py Outdated Show resolved Hide resolved
test/case/infix_interfaces/igmp_vlan.py Outdated Show resolved Hide resolved
test/case/infix_interfaces/igmp_vlan.py Outdated Show resolved Hide resolved
test/case/infix_interfaces/igmp_vlan.py Outdated Show resolved Hide resolved
test/case/infix_interfaces/igmp_vlan.py Outdated Show resolved Hide resolved
test/infamy/multicast.py Show resolved Hide resolved
troglobit and others added 16 commits March 7, 2024 10:39
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
With VLAN filtering on a bridge we cannot use the mcast_query_use_ifaddr
mechanism.  This because even if the bridge may have an address it is
likely not on the same subnet as that of the VLAN, and the multicast
code in the kernel does not look at VLAN interfaecs on top of bridge
for a relevant adddress.

For these cases we have to use querierd, or a multicast router.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This patch adds BUM flooding control per port.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Note, no VLAN id, or other VLAN specific information is contained in the
MDB entries, only forwarding information and per-port state.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Depends on having mtools v3+ on test PC, so add it to the docker.
With 3 data connections between host and DUT.
Simple test that tests (without VLAN):
* Multicast flooding works
* Join works as expected
A bridge port cannot communicate on layer-3 while acting as a bridge
port.  Removing the port from the bridge re-enables the link-local
addresses, if any, from the configuration.

Fix #327

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This is a forward-port of one of my bridge patches to handle RFC4541
style flooding of unknown multicast.

https://lore.kernel.org/netdev/20220411133837.318876-9-troglobit@gmail.com/

Changes since this thread: use inferred mctx (VLAN multicast context)
from br_handle_frame_finish() and br_dev_xmit(), which should fix the
per-VLAN multicast handling issue pointed out by Nikolay.

Todo before next patch series, add new option instead of breaking the
existing functionality for the current mcast_flood flag.  E.g., add a
mcast_flood_always, since the current flag stops flooding when there is
a known querier on the LAN.

See the above thread for details.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
An RFC conforming multicast snooping bridge should forward all unknown
multicast (IP & MAC) on ports where the mcast_flood flag is set.  The
upstream kernel does not (yet) support this, but the KernelKit branch
of the kernel and iproute2 now support it.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
troglobit and others added 3 commits March 7, 2024 10:50
Since Infix supports per-VLAN querier parameters, like query interval,
we currently need to run a separate querierd per VLAN interface.  The
replacement, mcd, will handle this automatically in its .conf file.

Also, ensure we install the daemon configuration file as an example, and
thus creating the /etc/querierd/ directory for where .conf files for
each interface will be generated.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
In a VLAN filtering bridge setup we want to be able to support an
external IGMP/MLD querier running from userspace, because the bridge
multicast code can only generate proxy/NULL querys per VLAN.

This patch is a refactor to allow just that.  If a VLAN on the bridge
has an upper interface, matching the bridge name and VID, we generate
a profile for querierd and enable the service.

For all other cases we try to disable any running querierd.  It is up
to the daemon to figure out if it has a usable IP address to use as
the query source IP or use 0.0.0.0.

Since the logic for selecting a proper IP address must be handled by
the daemon in the per-VLAN setup, we revert back to also use it for
the stand-alone unfiltered bridge case as well.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Copy link
Contributor

@wkz wkz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥇

Copy link
Contributor

@mattiaswal mattiaswal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

mattiaswal and others added 3 commits March 7, 2024 11:32
Rename to more distinct names for netns and hostports
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
@mattiaswal mattiaswal merged commit f2cc620 into main Mar 7, 2024
2 checks passed
@mattiaswal mattiaswal deleted the multicast-snooping branch March 7, 2024 11:45
@troglobit troglobit mentioned this pull request Jul 2, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
3 participants