Skip to content

pimd: defer join-group socket joins until the interface exists (backport #22634) - #22668

Merged
Jafaral merged 1 commit into
stable/10.7from
mergify/bp/stable/10.7/pr-22634
Jul 15, 2026
Merged

pimd: defer join-group socket joins until the interface exists (backport #22634)#22668
Jafaral merged 1 commit into
stable/10.7from
mergify/bp/stable/10.7/pr-22634

Conversation

@mergify

@mergify mergify Bot commented Jul 14, 2026

Copy link
Copy Markdown

A join-group configured before zebra delivers the interface (startup config is
read while the interface still has ifindex 0) passes gsr_interface = 0 to
MCAST_JOIN_(SOURCE_)GROUP. The kernel does not fail that call: it resolves
interface 0 through a route lookup and silently subscribes on whatever device
that returns β€” so the join lands on the wrong interface (or is rejected
outright when no route for the group exists yet, losing the config line since
gm_join_new() drops failed entries), no report is ever sent on the
configured interface, and nothing re-issues the join when the interface
appears. IPv4 partially masks this with the socket replay in
pim_if_addr_add(); IPv6 has no replay at all, so a startup-config
ipv6 mld join-group never produces an MLDv2 report β€” observed live:
pim6d logs pim_if_add_vif: ifindex=0 at config-from-file, then the group
never shows in show ipv6 mld joins while all ambient link-local groups do.

Fix:

  • defer the socket join when the interface has no ifindex yet, keeping the
    gm_join entry with sock_fd == -1 instead of dropping it;
  • factor the IPv4 replay loop into pim_if_gm_join_replay() and run it for
    both address families when an address is added (issuing deferred joins and
    re-targeting stale ones after an ifindex change);
  • guard the close paths against deferred entries.

The new pim6_mld_join_startup topotest (plus its IPv4 twin pim_igmp_join_startup, which pins the deferral determinism for pimd where the pre-fix outcome was a race) boots the join-group from startup
config and asserts the MLD sg, INCLUDE local membership and Joined upstream
all form. Verified against current master: unpatched, the sg never appears
(fails after the full poll window); patched, 2/2 pass in ~20 s. The v4 side
of the refactor was regression-checked with multicast_mld_join_topo1 and
pim_basic_igmp_proxy (both pass; proxy joins ride the same gm_join list).


This is an automatic backport of pull request #22634 done by [Mergify](https://mergify.com).

A join-group configured before zebra delivers the interface (startup
config is read while the interface still has ifindex 0) passes
gsr_interface = 0 to MCAST_JOIN_(SOURCE_)GROUP.  The kernel does not
fail that call: it resolves interface 0 through a route lookup and
silently subscribes on whatever device that returns -- so the join
lands on the wrong interface (or is rejected outright when no route
for the group exists yet; the apply-stage error is ignored during
config load, so the line survives in the running config with no join
state behind it), no report is ever
sent on the configured interface, and nothing re-issues the join when
the interface appears.  IPv4 partially masks this with the socket
replay in pim_if_addr_add(); IPv6 has no replay at all, so a
startup-config `ipv6 mld join-group` never produces an MLDv2 report.

Defer the socket join when the interface has no ifindex yet -- keep
the gm_join entry with sock_fd == -1 instead of dropping it -- factor
the IPv4 replay loop into pim_if_gm_join_replay() and run it for both
address families when an address is added (re-issuing deferred joins
and re-targeting stale ones after an ifindex change), and guard the
close paths against deferred entries.

The new pim6_mld_join_startup topotest boots the join-group from
startup config and asserts the MLD sg, INCLUDE local membership and
Joined upstream all form -- on unpatched pim6d the sg never appears.
Its IPv4 twin pim_igmp_join_startup pins the same recipe for pimd,
where the pre-fix outcome was a race (wrong-device join healed by the
replay, or entry dropped) rather than a deterministic failure.

Signed-off-by: Omar Ramadan <omar@blockcast.net>
(cherry picked from commit a76ceff)
@greptile-apps

greptile-apps Bot commented Jul 14, 2026

Copy link
Copy Markdown

Target branch is not in the allowed branches list.

@frrbot frrbot Bot added the pim label Jul 14, 2026
@Jafaral
Jafaral merged commit 05478bd into stable/10.7 Jul 15, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants