Commit Graph

2939 Commits

Author SHA1 Message Date
Rafael Zalamena
cacdff75a6 pimd: fix null memory access on IGMP source limit
When the IGMP group source limit is reached the function
`igmp_get_source_by_addr` won't return a `struct gm_source` so we must
test for that condition before attempting to access its fields.

Fixes coverity scan issue 1637406.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2025-02-28 11:34:36 -03:00
Jafar Al-Gharaibeh
f35de3f8cb
Merge pull request #18216 from gromit1811/bugfix_pim_vrf_register
pimd: Fix PIM VRF support (send register/register stop in VRF)
2025-02-24 12:56:08 -06:00
Donald Sharp
777aae08cf
Merge pull request #18226 from nabahr/pim-vrf-bind
pim: Fix vrf binding of autorp and mroute socket
2025-02-24 13:53:39 -05:00
Nathan Bahr
d840560b74 pim: Fix autorp group joins
Group joining got broken when moving the autorp socket to open/close
as needed. This fixes it so autorp group joining is properly handled
as part of opening the socket.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2025-02-21 21:38:32 +00:00
Nathan Bahr
7e181a771c pim: Fix vrf binding of autorp and mroute socket
Bind the autorp socket to the vrf device.
Also fixed mroute socket to use vrf_bind instead of directly
setting the socket option.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2025-02-21 19:32:40 +00:00
Martin Buck
5a01011e0d pimd: Fix PIM VRF support (send register/register stop in VRF)
In 9461953914 and
8ebcc02328, transmission of PIM register and
register stop messages was changed to use a separate socket. However, that
socket is not bound to a possible VRF, so the messages were sent in the
default VRF instead. Call vrf_bind() once after socket creation and when the
VRF is ready to ensure transmission in the correct VRF. vrf_bind() handles
the non-VRF case (i.e. VRF_DEFAULT) automatically, so it may be called
unconditionally.

Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
2025-02-21 09:00:55 +01:00
Mark Stapp
bf8e4a3b83
Merge pull request #17666 from routingrocks/pim_fhr_rp
pimd: During prefix-list update, behave as PIM_UPSTREAM_NOTJOINED sta…
2025-02-20 13:41:10 -05:00
Jafar Al-Gharaibeh
fc6b0413fa
Merge pull request #14227 from routingrocks/pim_data_fix
pimd: Fix for data packet loss when FHR is LHR and RP
2025-02-20 10:56:05 -06:00
David Lamparter
b84493132c pimd: allow restricting neighbors per interface
Just filter incoming packets against a specified prefix-list.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2025-02-19 09:49:06 -03:00
Rafael Zalamena
80a12477e0 pimd,topotests: frrbot styling suggestions
Incorporate frrbot suggestion to avoid the CI warning.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2025-02-13 13:07:34 -03:00
David Lamparter
df9517c95a pimd: add IGMPv2/MLDv1 immediate-leave
(Somewhat) useful when dealing with an interface that has only one host
attached.  Only works for IGMPv2 and MLDv1, other protocol versions have
no leave message.

Co-authored-by: David Lamparter <equinox@opensourcerouting.org>
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2025-02-13 12:45:47 -03:00
Rajesh Varatharaj
8280257cc9 pimd: Fix for data packet loss when FHR is LHR and RP
Topology:
A single router is acting as the First Hop Router (FHR), Last Hop Router (LHR), and RP.

RC and Issue:
When an upstream S,G is in join state, it sends a register message to the RP.
If the RP has the receiver, it sends a register stop message and switches to the shortest path.
When the register stop message is processed, it removes pimreg, moves to prune,
and starts the reg stop timer.

When the reg stop timer expires, PIM changes S,G state to Join Pending and sends out a NULL
register message to RP. RP receives it and fails to send Reg stop because SPT is not set at that point.

The problem is when the register stop timer pops and state is in Join Pending.
According to https://www.rfc-editor.org/rfc/rfc4601#section-4.4.1,
we need to put back the pimreg reg tunnel into the S,G mroute.
This causes data to be sent to the control plane and subsequently interrupts the line rate.

Fix:
If the router is FHR and RP to the group,
ignore SPT status and send out a register stop message back to the DR (in this context, the same router).

Ticket: #3506780

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Signed-off-by: Rajesh Varatharaj <rvaratharaj@nvidia.com>
2025-02-11 09:52:15 -08:00
Rafael Zalamena
99861a084a pim6d: implement clear IPv6 MLD interfaces
Allow user to reset MLD state on all interfaces in a VRF.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2025-02-10 15:40:07 -03:00
Rafael Zalamena
a98f2b86c4 pim6d: implement MLD source/group limits
Let user configure a source/group limit for MLD protocol.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2025-02-10 15:40:07 -03:00
David Lamparter
f07d379b74 pimd: implement IGMP group/source count limit
For groups we can just look at the length of the list, for sources we
need to count them on a per-interface level.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2025-02-10 15:40:07 -03:00
Jafar Al-Gharaibeh
452732024e
Merge pull request #18048 from opensourcerouting/msdpt3f
pimd: fix DR election race on startup
2025-02-06 21:40:45 -06:00
Rafael Zalamena
fd66ede08b
Merge pull request #14105 from routingrocks/pim_ageout_fix
pimd: Fix for FHR mroute taking longer to age out
2025-02-06 21:25:45 -03:00
Rafael Zalamena
8644524606 pimd: fix DR election race on startup
In case interface address is learnt during configuration, make sure to
run DR election when configuring PIM/PIM passive on interface.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2025-02-06 19:30:51 -03:00
Rajesh Varatharaj
51f26d17da pimd: During prefix-list update, behave as PIM_UPSTREAM_NOTJOINED state (conformance issue)
Issue:
If there are any changes to the prefix list, we perform a re-lookup to map the correct RP for the group.
Even if the S,G entry is PIM_UPSTREAM_NOTJOINED and in FHR, In the case of IGMPv3, an S,G entry can be
created with no joins. this is not necessary.
 https://www.rfc-editor.org/rfc/rfc4601#section-4.5.7 says no op in case of NOTJOINED

Solution:
To solve this issue, Stop RP mapping when the state is NOTJOINED

Ticket: #3496931

Signed-off-by: Rajesh Varatharaj <rvaratharaj@nvidia.com>
2025-02-06 10:59:34 -06:00
Rajesh Varatharaj
afed39ea2b pimd: Fix for FHR mroute taking longer to age out
Issue:
When there is no traffic for a group, the LHR and RP take the default KAT+Join timer expiry of
a maximum of 480 seconds to clear the S,G . However, in the FHR, we update the state from JOINED
to NOT Joined, downstream state from PPto NOINFO.  This restarts the ET timer, causing S,G on FHR to
take more than 10 minutes to age out.

In other words,
Consider a case where (S,G) is in Join state. When the traffic stops and the KAT (210) expires,
 the Join expiry timer restarts. At this time, if we receive a prune, the expectation is to set
 PPT to 0 (RFC 4601 sec 4.5.2).
 When the PPT expires, we move to the noinfo state and restart the expiry timer one more time. We remove the
 (S,G) entry only after ~10 minutes when there is no active traffic.

Summary:
KAT Join ET 210 + PP ET 210 + NOINFO ET 210.

Solution:
Delete the ifchannel when in noinfo state, and KAT is not running.

Ticket: #13703

Signed-off-by: Rajesh Varatharaj <rvaratharaj@nvidia.com>
2025-02-06 10:19:46 -06:00
Rafael Zalamena
d1440dadff pimd: fix memory leak and assign allocation type
Use a memory allocation specific type for filter names (to help detect memory
leaks) and fix a memory leak when releasing peer memory.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2025-02-06 10:17:19 -03:00
Nathan Bahr
5d102a0a70 pimd: Close AutoRP socket when not needed
Don't leave the socket open if we are not enabled for discovery
or announcements.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2025-01-27 17:04:14 +00:00
Donald Sharp
5867c32161
Merge pull request #17776 from nabahr/group-rpf-mode
PIMD: RPF lookup mode per-group, per-source
2025-01-15 10:20:24 -05:00
Donald Sharp
a6595fde70
Merge pull request #17850 from Jafaral/wr-rpg
pimd: always write cand-rp group config even when rp is inactive
2025-01-14 12:41:15 -05:00
Jafar Al-Gharaibeh
8e66f821bf pimd: always write cand-rp group config even when rp is inactive
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2025-01-13 23:34:08 -06:00
Jafar Al-Gharaibeh
cda66453c1 pimd: explicitly ensure the RP src is BSR
With the recent suppoort of multiple sources of RPs, we can assume non static RPs
are BSR RPs. Just make the check explicit for BSR.

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2025-01-13 10:18:24 -06:00
Jafar Al-Gharaibeh
c30a3ad890 pimd: fix BSR RPs timing out
On the BSR node itself, RPs shouldn't timeout, becase we know
the node is the BSR, and it is active!

fixes:#17587

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2025-01-13 10:18:24 -06:00
Nathan Bahr
e8d81ab5ce pimd: Implement rpf lookup mode as a list
Add the support to store lookup modes as a sorted list.
List is non-unique and sorts mode with both lists < modes with one list < global mode (no lists).
This way, when finding the right mode, we will match a lookup using a prefix list before the global mode.
Add passing group address into all lookups (using nht cache and/or synchronous lookup).
Many areas don't have a group address, use PIMADDR_ANY if no valid group is needed.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2025-01-09 21:58:22 +00:00
Nathan Bahr
8b00575fbb pimd,yang: Expand rpf-lookup-mode command
Add options for group-list and source-list, both of which take a prefix list name.
The prefix list is used to determine the lookup mode for specific sources and/or groups.
Any number of lookup modes can be configured as long as the combination of group
and source list is unique.
A global lookup mode (empty group and source lists) is always added and defaults to mrib-then-urib
as it currently functions. The global lookup mode can be changed as it current exists with the command
`rpf-lookup-mode MODE`.
When determinig which mode to use, match source (and group if provided) against the lists, if they are set.
If a lookup does not specify a group, then only use lookup modes that do not have a group list defined.
A lookup by definition will have a source, so no special handling there.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2025-01-09 21:58:22 +00:00
Jafar Al-Gharaibeh
c51452d476 pim: handle return code to fix a couple of coverity issues
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2024-12-18 21:52:48 -06:00
Rafael Zalamena
3bebb7be92
Merge pull request #17252 from nabahr/mcast-mode
Fix PIMD RPF lookup mode and nexthop tracking
2024-12-16 09:57:31 -03:00
Nathan Bahr
5cce666d49 pimd: Clean up pim RPF/NHT show commands
Moved `show ip rpf A.B.C.D` command here from zebra, deprecated and aliased
to `show ip pim nexthop-lookup`.
Allow group to be optional in the lookup command. Only validate group if
source is ANY. Documented setting source via RP if not provided.
Added new output if ANY source + group lookup is performed and no
RP is found for the group. Updated output to include souce and
group for lookup.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2024-12-13 17:36:34 +00:00
Nathan Bahr
9ce7f9b8e8 pimd: Update nexthops when lookup mode changes
Link up the RPF lookup mode changing to a force update to RP's and
upstreams registered for nexthop lookup cache updates.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2024-12-13 17:36:34 +00:00
Nathan Bahr
6d30c8f6b5 pimd: Refactor pim NHT
Refactor the next hop tracking in PIM to fully support the configured RPF lookup mode.
Moved many NHT related functions to pim_nht.h/c
NHT now tracks both MRIB and URIB tables and makes nexthop decisions based on the configured lookup mode.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2024-12-13 17:36:34 +00:00
Nathan Bahr
cc865c0192 pimd: Refactor synchronous nexthop lookup
Add prefix length in nexthop response.
Apply lookup mode to the sychronous lookups, where we may lookup
the MRIB, URIB, or both and make a decision based on the nexthop.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2024-12-13 17:36:34 +00:00
Nathan Bahr
10e2df6530 pimd,yang: Reimplement RPF lookup vty in router pim
Add rpf-lookup-mode MODE vty command under router pim block.
Including NB piping and config write. Using the mode still pending.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2024-12-13 17:36:34 +00:00
Jafar Al-Gharaibeh
27b01ce68c
Merge pull request #17642 from opensourcerouting/pim-cs
pimd,pim6d: optimize multicast prefix generation and fix coverity scan defect
2024-12-13 09:37:07 -06:00
Jafar Al-Gharaibeh
330e2c68e1
Merge pull request #17635 from opensourcerouting/pim6-embedded-crash
pim6d: fix crash on clear ipv6 mroute
2024-12-13 09:36:28 -06:00
Rafael Zalamena
a507ca1163 pimd,pim6d: optimize multicast prefix generation
Fix Coverity Scan CID 1602463: make it impossible for the function to fail.

Hardcode the multicast prefix generation instead of calling `str2prefix()`
which caused unnecessary memory allocations and returned error values.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-12-13 08:28:42 -03:00
Nathan Bahr
4250eae00d zebra,pimd,lib: Modify ZEBRA_NEXTHOP_LOOKUP_MRIB
Modified ZEBRA_NEXTHOP_LOOKUP_MRIB to include the SAFI from which to do the lookup.
This generalizes the API away from MRIB specifically and allows the user to decide how it should do lookups.
Rename ZEBRA_NEXTHOP_LOOKUP_MRIB to ZEBRA_NEXTHOP_LOOKUP now that it is more generalized.
This change is in preperation to remove multicast lookup mode completely from zebra.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2024-12-12 13:50:31 +00:00
Rafael Zalamena
74834a92f6 pimd: support originator id configuration
Allow user to specify the RP field for the SA messages.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-12-12 10:34:19 -03:00
Donald Sharp
f170e9bba9
Merge pull request #17636 from opensourcerouting/msdp-cleanup
pimd: clean up MSDP code
2024-12-12 08:28:49 -05:00
Donatas Abraitis
024c9446a5
Merge pull request #17605 from donaldsharp/upstream_some_evpn
Upstream some internal code
2024-12-11 18:15:09 +02:00
Rafael Zalamena
d4da6316c7 pimd: move all MSDP code to its own place
Guard MSDP code to compile only on IPv4 and remove all MSDP code from
PIMv6.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-12-11 11:58:25 -03:00
Rafael Zalamena
6d759deea1 pimd: move MSDP configuration and initialization
Reorganize the MSDP initialization code and configuration writing code
to its appropriated place.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-12-11 11:58:25 -03:00
Rafael Zalamena
74623166d4 pim6d: ignore more MSDP callbacks
PIMv6 does not implement MSDP, users should use PIMv6 embedded RP
instead.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-12-11 11:58:25 -03:00
Rafael Zalamena
3b0b1adad7 pim6d: fix crash on clear ipv6 mroute
Fix crash on `clear ipv6 mroute` when using embedded RP.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-12-11 10:39:36 -03:00
Jafar Al-Gharaibeh
ccb57ad10f
Merge pull request #17521 from opensourcerouting/msdp-sa-limit
pimd: MSDP per peer SA limit
2024-12-10 11:36:50 -06:00
Anuradha Karuppiah
e57ad2fbcd pimd: skip init of mlag roles based on the zebra capabilities message
Looks like the cap setting was added for testing mlag via zebra test cli
to config the mlag role. However it is interfering with the valid state
updates rxed from the MLAG daemon based on timing (in some cases the
MLAG state changes are rxed before the capabilities).

Reference logs -
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
root@TORC11:mgmt:/home/cumulus# grep -ri "my_role\|MlagRole" /var/log/frr/bgpd.log
2021/06/18 13:26:40.380130 PIM: pim_mlag_process_mlagd_state_change: msg dump: my_role: SECONDARY, peer_state: DOWN
2021/06/18 13:26:40.380766 PIM: pim_mlag_process_mlagd_state_change: msg dump: my_role: SECONDARY, peer_state: DOWN
2021/06/18 13:26:41.382258 PIM: pim_mlag_process_mlagd_state_change: msg dump: my_role: SECONDARY, peer_state: RUNNING
2021/06/18 13:26:41.382379 PIM: pim_mlag_process_mlagd_state_change: msg dump: my_role: PRIMARY, peer_state: RUNNING
2021/06/18 13:26:52.386071 ZEBRA: Sending capabilities to client pim: MPLS enabled numMultipath 128 GR disabled MaintMode off MlagRole 0
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Ticket: #2691629

Signed-off-by: Anuradha Karuppiah <anuradhak@nvidia.com>
2024-12-09 12:31:29 -05:00
Corey Siltala
8465ba1dde pimd: Convert boundary_oil_plist to struct prefix_list
Rather than storing the prefix-list name and looking it up every time we use it, store a pointer to the prefix-list itself.

Signed-off-by: Corey Siltala <csiltala@atcorp.com>
2024-12-06 14:44:52 -06:00