Skip to content

[MULTICAST FORWARDING] Multicast forwarding lacks receiver-aware decision making #18762

In review

Description

@ankohuu

Current multicast forwarding in NuttX is local-membership driven rather than receiver-aware

  • IPv4, forwarding is based on the device’s IGMP group list, performing a fan-out/relay for groups joined locally. here
  • IPv6, multicast packets are just forwarded. here

This issue discusses whether NuttX should evolve toward receiver-aware multicast forwarding

Such a change may involve:

  • Control path: introducing IGMP/MLD snooping or similar mechanisms to learn downstream membership
  • Data path: adding a multicast forwarding struct and corresponding forwarding logic
  • User space: other potential support

From project history I found that NuttX has evolved to supporting multiple netdevs and basic forwarding, extending multicast forwarding may be a reasonable next step.

On which OS does this issue occur?

[OS: Linux]

What is the version of your OS?

Ubuntu 24

NuttX Version

All version

Issue Architecture

[Arch: all]

Issue Area

[Area: Networking]

Host information

No response

Verification

  • I have verified before submitting the report.

Activity

  1. added
    Type: Bug
    on Apr 18, 2026
  2. added
    Arch: all
    Area: Networking
    OS: Linux
    on Apr 18, 2026
  3. ankohuu commented on Apr 18, 2026

    @ankohuu
    ContributorAuthor

    @acassis Seems there hasn’t been enough time for a thorough discussion on multicast forwarding. So I created this issue to track the topic and discuss further.

    Thank you

  4. acassis commented on Apr 19, 2026

    @acassis
    Contributor

    Hi @ankohuu thank you very much for your detailed Issue. I agree this will be a good improvement. And it will make NuttX more compatible with high-end OSes. Do you think this new feature will require more memory (flash and RAM)? If so, does it make sense to have a config option to keep the old behavior for low end MCUs?

  5. Brijesh-Thakkar commented on Nov 2, 2026

    @Brijesh-Thakkar
    Contributor

    Hi, is anyone working on this? I checked master and open PRs and don’t see it. If not, I’d like to take it.

    plan: on the forwarding path, consult per-device multicast group membership (IGMP for IPv4, MLD for IPv6) and only forward to interfaces with interested receivers, falling back to current behavior when membership tracking is disabled.
    I’d test on sim with two TAP interfaces and host-side listeners.
    Before I start: should membership come from the existing IGMP/MLD group lists on each netdev, or do you want a separate forwarding table?

  6. Brijesh-Thakkar commented on Nov 5, 2026

    @Brijesh-Thakkar
    Contributor

    Checked latest master. Nothing in flight for this; #18738 only added the scope filter.

    Findings:

    • ipv4_in() forwards a multicast packet only if the ingress device has locally joined the group. ipv4_forward_broadcast() then floods it to all other netdevs, with no egress membership check.
    • IPv6 floods everything above link scope.
    • The per-netdev IGMP/MLD lists only track local joins. IGMP drops remote reports for unjoined groups, and the MLD_ROUTER counts are never read on the forward path.
      So I don't think those lists are the right place to store downstream membership.

    Proposal: a small, separate multicast forwarding table in net/ipforward/, shared by IPv4 and IPv6, behind CONFIG_NET_IPFORWARD_MCAST (default n).

    • Option off: behavior and size unchanged, fully compiled out. This should cover the low-end MCU concern.
    • Option on: forward only to interfaces with an entry for the group. Rough estimate ~32 B RAM per entry and 1.5-3 KB flash. I'll post measured numbers with the first PR.

    Staging:

    1. Table, lookup and data-path filtering, plus a minimal control ioctl so it's testable.
    2. IGMP snooping.
    3. MLD snooping.
    4. Docs and a sim defconfig.

    Open questions before I start:
    (a) Separate table OK, vs extending the group lists?
    (b) With the option on and no entry, drop (Linux behavior) or flood?
    (c) ioctl for the control interface, or Linux-style MRT_* socket options?

    @acassis @xiaoxiang781216

  7. xiaoxiang781216 commented on Nov 5, 2026

    @xiaoxiang781216
    Contributor

    the plan looks good.

  8. Brijesh-Thakkar commented on Nov 7, 2026

    @Brijesh-Thakkar
    Contributor

    thanks @xiaoxiang781216! going with: separate table, drop when no entry (linux behavior), and a small isolated ioctl for now that can be swapped for MRT_* later. stage 1 is implemented and tested on sim (incl. two-TAP with host listeners); size with option on is +960 B text / +256 B bss on imxrt1050-evk, and identical with it off.
    will open pr shortly

  9. Brijesh-Thakkar commented on Dec 3, 2026

    @Brijesh-Thakkar
    Contributor

    Stage 1 is up: #22839, test app apache/nuttx-apps#4287.

    It adds the multicast forwarding table, the data path that uses it and the
    SIOCADDMCFWD/SIOCDELMCFWD ioctls, all behind CONFIG_NET_IPFORWARD_MCAST
    (default n). Since the proposal, ipforward was renamed to netforward
    upstream, so the code is in net/netforward/ (netfwd_mcast*.c) and the
    ioctls take 0x0049/0x004A.

    Size on imxrt1050-evk:netnsh (IPv4, IPv6, IGMP, MLD, forwarding): option
    off is identical to master; option on with 8 entries is +1144 bytes text,
    +16 bytes data, +264 bytes bss.

    Tests (sim, three TUN devices, examples/ipfwdmcast): option off 3/3 (flooding
    unchanged), option on 50/50, also on sim:smp, including packets forwarded
    while the table is changed from another thread; also a host test with three
    TAP devices and listeners in separate namespaces.

    Next stages: IGMP snooping (stage 2), MLD snooping (stage 3), docs/defconfig
    (stage 4).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Arch: allArea: NetworkingOS: LinuxType: Bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions