Skip to content

pimd: send AutoRP discovery on all PIM interfaces - #22865

Open
enkechen-panw wants to merge 2 commits into
FRRouting:masterfrom
enkechen-panw:fix-autorp-discovery-multicast
Open

pimd: send AutoRP discovery on all PIM interfaces#22865
enkechen-panw wants to merge 2 commits into
FRRouting:masterfrom
enkechen-panw:fix-autorp-discovery-multicast

Conversation

@enkechen-panw

Copy link
Copy Markdown
Contributor

The AutoRP mapping agent was only sending discovery messages from the
single configured source interface. In topologies where routers are on
different L2 segments (not directly connected to the mapping agent's
source interface), they would not reliably receive discovery messages.

This caused flaky failures in the pim_autorp topotest, particularly
test_pim_autorp_discovery_neg_prefixes, where r4 (two hops from the
mapping agent) would intermittently fail to receive discovery.

For systems with IP_PKTINFO, fix by sending discovery on all PIM
interfaces, similar to how announcements are already sent. Use
sendmsg() with IP_PKTINFO to specify both the outgoing interface
and a consistent source address (the configured mapping agent
address). This ensures:

  1. All directly connected routers receive discovery regardless of
    which interface they're on
  2. The source IP is consistent across all interfaces, ensuring
    proper mapping agent election when multiple mapping agents exist

Systems without IP_PKTINFO fall back to the original single-interface
behavior.

@frrbot frrbot Bot added pim tests Topotests, make check, etc labels Jul 29, 2026
@enkechen-panw
enkechen-panw force-pushed the fix-autorp-discovery-multicast branch from bdbfedc to 52e63fc Compare July 29, 2026 17:17
@enkechen-panw

Copy link
Copy Markdown
Contributor Author

ci:rerun

@mwinter-osr

Copy link
Copy Markdown
Member

@greptileai review

Comment thread pimd/pim_autorp.c Outdated
@greptile-apps

greptile-apps Bot commented Jul 29, 2026

Copy link
Copy Markdown

Greptile Summary

Updates AutoRP discovery distribution and coverage:

  • Sends discovery packets on every eligible PIM interface when IP_PKTINFO is available while retaining the configured mapping-agent source address.
  • Preserves single-interface behavior on systems without IP_PKTINFO.
  • Adds a topology test covering mapping-agent election, multi-interface discovery delivery, and failback.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
pimd/pim_autorp.c Sends AutoRP discovery through each eligible PIM interface using zero-initialized IP_PKTINFO ancillary data and retains the legacy fallback.
tests/topotests/pim_autorp/test_pim_autorp.py Adds coverage for competing mapping agents, discovery across multiple interfaces, and restoration of the original agent.

Sequence Diagram

sequenceDiagram
    participant MA as Mapping Agent
    participant K as Kernel/IP_PKTINFO
    participant PI as PIM Interfaces
    participant R as Connected Routers
    MA->>MA: Build discovery packet
    loop Each eligible PIM interface
        MA->>K: sendmsg(packet, ifindex, configured source)
        K->>PI: Transmit on selected interface
        PI->>R: Deliver AutoRP discovery
    end
    R->>R: Elect highest-address mapping agent
Loading

Reviews (2): Last reviewed commit: "tests: add AutoRP mapping agent election..." | Re-trigger Greptile

The AutoRP mapping agent was only sending discovery messages from the
single configured source interface. In topologies where routers are on
different L2 segments (not directly connected to the mapping agent's
source interface), they would not reliably receive discovery messages.

This caused flaky failures in the pim_autorp topotest, particularly
test_pim_autorp_discovery_neg_prefixes, where r4 (two hops from the
mapping agent) would intermittently fail to receive discovery.

For systems with IP_PKTINFO, fix by sending discovery on all PIM
interfaces, similar to how announcements are already sent. Use
sendmsg() with IP_PKTINFO to specify both the outgoing interface
and a consistent source address (the configured mapping agent
address). This ensures:

1. All directly connected routers receive discovery regardless of
   which interface they're on
2. The source IP is consistent across all interfaces, ensuring
   proper mapping agent election when multiple mapping agents exist

Systems without IP_PKTINFO fall back to the original single-interface
behavior.

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
Add test to verify that when multiple mapping agents are present,
the one with the higher IP address wins the election. This ensures
routers correctly suppress their own mapping agent when they receive
discovery packets from a higher IP address.

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
@enkechen-panw
enkechen-panw force-pushed the fix-autorp-discovery-multicast branch from 52e63fc to 31a80b7 Compare July 30, 2026 07:23
@enkechen-panw

Copy link
Copy Markdown
Contributor Author

@greptileai review

@enkechen-panw

Copy link
Copy Markdown
Contributor Author

ci:rerun

@donaldsharp

Copy link
Copy Markdown
Member

Can you help me understand why packets are not reliably being received? It's not clear to me from the description

As a note, as I read this change this code sends packets on any interface that there is a pim data structure sunk off of it, shouldn't it only send packets on the ip pim configed interfaces?

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

Labels

master pim size/L tests Topotests, make check, etc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants