pimd: defer join-group socket joins until the interface exists (backport #22634) - #22668
Merged
Merged
Conversation
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)
|
Target branch is not in the allowed branches list. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A join-group configured before zebra delivers the interface (startup config is
read while the interface still has ifindex 0) passes
gsr_interface = 0toMCAST_JOIN_(SOURCE_)GROUP. The kernel does not fail that call: it resolvesinterface 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 theconfigured 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-configipv6 mld join-groupnever produces an MLDv2 report β observed live:pim6d logs
pim_if_add_vif: ifindex=0at config-from-file, then the groupnever shows in
show ipv6 mld joinswhile all ambient link-local groups do.Fix:
gm_joinentry withsock_fd == -1instead of dropping it;pim_if_gm_join_replay()and run it forboth address families when an address is added (issuing deferred joins and
re-targeting stale ones after an ifindex change);
The new
pim6_mld_join_startuptopotest (plus its IPv4 twinpim_igmp_join_startup, which pins the deferral determinism for pimd where the pre-fix outcome was a race) boots the join-group from startupconfig 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_topo1andpim_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).