Commit graph

253 commits

Author SHA1 Message Date
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
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 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
Corey Siltala 4de4017d64 pimd,yang: Extend multicast boundary functionality
Add new interface command ip multicast boundary ACCESSLIST4_NAME. This
allows filtering on both source and group using the extended access-list
syntax vs. group-only as with the existing "ip multicast boundary oil"
command, which uses prefix-lists. If both are configured, the prefix-
list is evaluated first. The default behavior for both prefix-lists and
access-lists remains "deny", so the prefix-list must have a terminating
"permit" statement in order to also evaluate against the access-list.

The following example denies groups in range 229.1.1.0/24 and groups in
range 232.1.1.0/24 with source 10.0.20.2:

!
ip prefix-list pim-oil-plist seq 10 deny 229.1.1.0/24
ip prefix-list pim-oil-plist seq 20 permit any
!
access-list pim-acl seq 10 deny ip host 10.0.20.2 232.1.1.0 0.0.0.255
access-list pim-acl seq 20 permit ip any any
!
interface r1-eth0
 ip address 10.0.20.1/24
 ip igmp
 ip pim
 ip multicast boundary oil pim-oil-plist
 ip multicast boundary pim-acl
!

Signed-off-by: Corey Siltala <csiltala@atcorp.com>
2024-12-06 14:44:17 -06:00
Rafael Zalamena 23c7acd232 pim6d: support embedded-rp
Implement embedded RP support and configuration commands.

Embedded RP is disabled by default and can be globally enabled with the
command `embedded-rp` in the PIMv6 configuration node.

It supports the following options:
- Embedded RP maximum limit
- Embedded RP group filtering

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-11-13 12:05:35 -03:00
Donald Sharp 5ef144ce6d pimd: Give a clearer warning when the kernel is not compiled right
When the kernel is not compiled with mroute vrf's enabled it will
fail the call to initialize the vrf.  As such let's recognize this
specific error code and output a specific warning to the operator
to help them figure this problem out.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-05-31 11:29:40 -04:00
Rajesh Varatharaj 071d43a052 pimd: re-evaluated S,G OILs upon RP changes and for empty SG upstream oils
Topology:

TOR11 (FHR) --- LEAF-11---SPINE1 (RP)MSDP SPINE-2(RP)MSDP --- LEAF-12 -- TOR12 (LHR)
        |         |                    |				|       |
	|         -----------------------------------------------------(ECMP)   |
	|         |		                                |               |
	 -----------------------------------------------------------------------(ECMP)
Issue:
In some triggers, S,G upstream is preserved even with the PP timer expiry, resulting
in S,G with NULL OILS. This could be because we create a dummy S,G upstream and
dummy channel_oif for *,G, where RPF is UNKNOWN. As a result, PIM+VXLAN traffic is never
forwarded downstream to LHR.

Fix:
when the S,G stream is running, Determine if a reevaluation of the outgoing interface
 list (OIL) is required. S,G upstream should then inherit the OIL from *,G.

Testing:
- Evpn pim tests - TestEvpnPimSingleVtepOneMdt.test_02_broadcast_traffic_spt_zero
- pim-smoke

Ticket: #
Signed-off-by: Rajesh Varatharaj <rvaratharaj@nvidia.com>
2024-02-08 10:37:31 -08:00
Donald Sharp 2700519cb3 *: Remove sys/ioctl.h from zebra.h
Practically no-one uses this and ioctls are pretty much
wrappered.  Further wrappering could make this even better.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-04 14:42:17 -05:00
Donald Sharp 75b3e82dfa *: Remove cost of including netinet/icmp.h everywhere
This file inclusion is only used in 3 places move
the includes to those spots.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-04 14:26:33 -05:00
Donald Sharp 5f57d30ba4 pimd: Use a better name for oil_parent
Use oil_incoming_vif instead of oil_parent.  I had
to go look this up as that I failed to remember that
the linux kernel calls this parent for some bizarre
reason.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-09-19 13:03:50 -04:00
Donald Sharp e4e46570f8 pimd: Display oil_parent as a string name of the interface
When debugging and outputting the oil_parent() let's just
convert it to a string that is useful for people trying
to debug pim

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-09-14 11:45:29 -04:00
anlan_cs ad855cdf34 pimd: Fix wrong setsockopt() call
`setsockopt()` should be only called once with `MRT_TABLE`
in "enable" case, otherwise it will fail.  In current code,
`mroute_socket` of "pim instance" with VRF can't be correctly
closed.

Skip it in the "disable" case to let `mroute_socket` safely
closed.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2023-04-27 09:15:00 +08:00
Donald Sharp e16d030c65 *: Convert THREAD_XXX macros to EVENT_XXX macros
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp 907a2395f4 *: Convert thread_add_XXX functions to event_add_XXX
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp e6685141aa *: Rename struct thread to struct event
Effectively a massive search and replace of
`struct thread` to `struct event`.  Using the
term `thread` gives people the thought that
this event system is a pthread when it is not

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Sarita Patra b4ba03b34c pimd: Don't start KAT timer when traffic received on PIM disabled interface
Topology:
RP---FHR---Source

Problem Statement:
1. In FHR, Enable PIM and IGMP on source connected interface
2. Start multicast traffic. (s,g) mroute and upstream will be created as expected.
3. Disable PIM on source connected interface.
4. Disable IGMP on source connected interface.
5. Stop the traffic.

Mroute will never get timeout.

Root Cause:
In FHR, when PIMD receive multicast data packet on
source connected interface which is IGMP enabled, but PIM
not enabled. PIMD process the packet, install the
mroute and start the KAT timer.

Fix:
Don't process multicast data packet received on PIM disabled

Signed-off-by: Sarita Patra <saritap@vmware.com>
2023-02-28 01:45:14 -08:00
David Lamparter c86b4ff4ba pimd: don't try to check RPF for incoming SSM data
For incoming no-receiver SSM traffic, there isn't going to be a RP, much
less a RPF.  We should install an MFC entry with empty oif regardless,
so we don't get swamped with further notifications.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-23 09:51:17 +01:00
David Lamparter d650b3c79a pimd: try to reinstall MFC when we get NOCACHE
Whether due to a pimd bug, some expiry, or someone just deleting MFC
entries, when we're in NOCACHE we *know* there's no MFC entry.  Add an
install call to make sure pimd's MFC view aligns with the actual kernel
MFC.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-23 09:42:19 +01:00
David Lamparter dbd596f637 pimd: make logs useful for input drops
This path here is pretty far on top of the list of issues that operators
will run into and have to debug when setting up PIM.  Make the log
messages actually tell what's going on.  Also escalate some from
`debug mroute detail` to `debug mroute`.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-22 16:08:10 +01:00
David Lamparter acddc0ed3c *: auto-convert to SPDX License IDs
Done with a combination of regex'ing and banging my head against a wall.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-09 14:09:11 +01:00
Mobashshera Rasool b2212b99d1 pimd: fix igmp source packet check
ip source 0.0.0.0 is OK as per RFC 3376: 4.2.13.

Co-authored-by: ron <lyq140hf2006@163.com>
Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-11-02 03:23:23 -07:00
Sai Gomathi N 55eb347de9 pimd,pim6d: Modifying IGMP to GM in PIM_DEBUG_IGMP_PACKETS to PIM_DEBUG_GM_PACKETS
Changing the macros to common so that it can be used for pimv6 debugs as well
to be used for both IGMP and MLD debugs.

Signed-off-by: Sai Gomathi N <nsaigomathi@vmware.com>
2022-09-04 22:46:09 -07:00
plsaranya 1ce957d66d Pim6d: Mroute file duplication removal
Mroute duplicate functions removed and made us hybrid for v4 and v6

Signed-off-by: plsaranya <Saranya_Panjarathina@dell.com>
2022-06-23 06:59:03 -07:00
David Lamparter 1b00ed5f65 pimd: pass down length for register messages
The IPv6 `mrt6msg` kernel pseudo-header does not have a length field;
accessing what would be the IPv6 payload length reads zeroes.

Pass down the proper length and use that instead.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-05-06 12:42:29 +02:00
Donald Sharp 53f60d5d5b
Merge pull request #11113 from opensourcerouting/pim6-icmp6-replace-bpf
pim6d: use ICMP6_FILTER instead of BPF on mroute
2022-05-02 13:19:47 -04:00
Mobashshera Rasool 0696c2ff20 pim6d: Make pim_zlookup_sg_statistics available for v6
Since pim_zlookup.c is available for pimv6,
Call pim_zlookup_sg_statistics api for v6.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-04-28 02:40:56 -07:00
David Lamparter fef295d439 pim6d: use ICMP6_FILTER instead of BPF on mroute
The ICMP6_FILTER option is always checked by the kernel, so the cost is
taken whether or not anything is set there.  Use it instead of taking on
additional cost with a BPF program.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-04-28 10:46:57 +02:00
Abhishek N R 80a82b567f pimd: Changing PIM_OIF_FLAG_PROTO_IGMP to PIM_OIF_FLAG_PROTO_GM
Modified marco name so that it can be reused in mld.

Signed-off-by: Abhishek N R <abnr@vmware.com>
2022-04-13 01:19:03 -07:00
Donald Sharp 33ec4015b6 pimd: Send immediate join( with possible SG RPT prune bit set
When pimd has this setup:

src ----- rtr ------ receiver
           |
          rp

And the receiver sends a *,G join to rtr.  When the
src starts sending a S,G, rtr can wait up to one join/prune
interval before sending a S,G rpt prune.  This interval
causes the pimreg device to be in the S,G OIL as that the
RP does not know to prune this leg off.

before:

Timestamp: Thu Mar 31 10:15:18 2022 288767 usec
[MROUTE](10.103.0.5,239.0.0.4)           Iif: rtr-lan_src Oifs: rtr-lan  State: resolved Table: default
Timestamp: Thu Mar 31 10:15:18 2022 288777 usec
[MROUTE](10.103.0.5,239.0.0.4)           Iif: rtr-lan_src Oifs: rtr-lan rtr-lan-1  State: resolved Table: default
Timestamp: Thu Mar 31 10:15:18 2022 288789 usec
[MROUTE](10.103.0.5,239.0.0.4)           Iif: rtr-lan_src Oifs: pimreg rtr-lan rtr-lan-1  State: resolved Table: default
Timestamp: Thu Mar 31 10:15:49 2022 324995 usec
[MROUTE](10.103.0.5,239.0.0.4)           Iif: rtr-lan_src Oifs: rtr-lan rtr-lan-1  State: resolved Table: default
<31 seconds>

After:

Timestamp: Thu Mar 31 12:56:15 2022 501921 usec
(10.103.0.5,239.0.0.27)          Iif: rtr-lan_src Oifs: pimreg rtr-lan  State: resolved Table: default
Timestamp: Thu Mar 31 12:56:15 2022 501930 usec
(10.103.0.5,239.0.0.27)          Iif: rtr-lan_src Oifs: pimreg rtr-lan rtr-lan-1  State: resolved Table: default
Timestamp: Thu Mar 31 12:56:15 2022 502181 usec
(10.103.0.5,239.0.0.27)          Iif: rtr-lan_src Oifs: rtr-lan rtr-lan-1  State: resolved Table: default
<sub second>

What is actually happening:

rtr receives a *,G igmp join, sends a *,G join towards the rp
rtr receives a S,G packet <WRVIFWHOLE>
creates the S,G upstream, sends the register packet to the rp
the rp sees that it still has downstream interest so it forwards the packet on
After (up to 60 seconds ) the rtr, sends the normally scheduled join for
the G and sends the S,GRPT prune as part of it.

What is being done to fix it:

In wrvifwhole handling, when pimd detects that this is the FHR
and is not the RP *and* the incoming interface for the *,G
is different than the incomding interface for the S,G immediately
send a single join packet for the G( which will have the S,G RPT
prune in it ).  Only do this on the first time receiving the
WRVIFWHOLE.

Ticket: #2755650
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-04-01 09:01:38 -04:00
plsaranya a5fa982256 pim6d: Mroute changes
Mroute and supporting changes

Signed-off-by: plsaranya <Saranya_Panjarathina@dell.com>
2022-03-23 19:34:28 +05:30
ron 2674ba0ab0 pimd: fix igmp packet check
ip source 0.0.0.0 is OK (RFC 3376: 4.2.13.).

Signed-off-by: ron <lyq140hf2006@163.com>
2022-03-16 15:48:51 -04:00
David Lamparter 6564f5e5a5 Merge pull request #10657 from patrasar/pim_remove_in_addr_none
[manual merge to edit comment, didn't want to incur another cycle]

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-02 10:42:17 +01:00
sarita patra cc144e8b6b pimd: replace inaddr_none with PIMADDR_ANY
We can use PIMADDR_ANY instead of INADDR_NONE to initalize rp->rpf_addr
when there is no rp configured for group_all.

Signed-off-by: sarita patra <saritap@vmware.com>
2022-03-01 09:45:56 -08:00
Donald Sharp 3bf65aa1ae
Merge pull request #10400 from opensourcerouting/pim6-compilefix
pim6d: get running with ipv6 types throughout
2022-02-26 08:03:06 -05:00
Donald Sharp cc9f21da22 *: Change thread->func to return void instead of int
The int return value is never used.  Modify the code
base to just return a void instead.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-02-23 19:56:04 -05:00
David Lamparter 94120cb227 pim6d: get into a kinda-working state wrt. zebra
Fix up just enough to make us not operate in complete darkness.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-16 16:40:56 +01:00
David Lamparter a9338fa449 pim6d: IPv6-adjust mroute code
This is just hitting the pim_mroute code with a hammer until it doesn't
print warnings anymore.  This is NOT quite tested or working yet, it
just compiles.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-16 16:40:56 +01:00
David Lamparter bca160c6af pimd: add PIMADDR_ANY & tackle assignments
Need a separate constant that is IPv6 when needed.  Also assign the
whole struct rather than just s_addr.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-17 14:09:01 +01:00
David Lamparter 98a81d2bff pimd: remove pim_str_sg_dump()
... and replace with `%pSG` printfrr specifier.  This actually used a
static buffer in the formatting function, so subsequent formatting would
overwrite earlier uses.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-17 14:02:18 +01:00
David Lamparter 1c4d0ea4b3
Merge pull request #10279 from SaiGomathiN/pim_intf 2022-01-13 16:13:54 +01:00
David Lamparter 6fff2cc620 pimd: prefix_sg => pim_sgaddr
Mostly just 2 sed calls:

- `sed -e 's%struct prefix_sg%pim_sgaddr%g'`
- `sed -e 's%memset(&sg, 0, sizeof(pim_sgaddr));%memset(\&sg, 0, sizeof(sg));%g'`

Plus a bunch of fixing whatever that broke.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-12 18:24:25 +01:00
Sai Gomathi 18adcff1c0 pimd: Modifying members of pim_interface to accommodate IPv6 changes
Modifying the members of pim_interface which are to be used
for both IPv4 and IPv6 to common names(for both MLD and IGMP).

Issues: #10023

Co-authored-by: Mobashshera Rasool <mrasool@vmware.com>
Co-authored-by: Sarita Patra <saritap@vmware.com>
Signed-off-by: Sai Gomathi <nsaigomathi@vmware.com>
2022-01-11 03:18:06 -08:00
Stephen Worley ad1229a077
Merge pull request #10215 from FRRouting/revert-10164-name_change
Revert "pimd: Modifying members of pim_interface to accommodate IPv6 changes"
2021-12-15 17:40:53 -05:00
David Lamparter 29e5822590
Revert "pimd: Modifying members of pim_interface to accommodate IPv6 changes" 2021-12-14 17:33:24 +01:00
Sai Gomathi c5f76fad1a pimd: Modifying struct igmp_sock to gm_sock for IPv6
Modifying name of struct igmp_sock to struct gm_sock, which is to be used
by both IPv4 and IPv6(for both MLD and IGMP).

Co-authored-by: Mobashshera Rasool <mrasool@vmware.com>
Co-authored-by: Sarita Patra <saritap@vmware.com>
Signed-off-by: Sai Gomathi <nsaigomathi@vmware.com>
2021-12-03 10:27:12 -08:00
Sai Gomathi ea7d74d702 pimd: Modifying members of pim_interface to accommodate IPv6 changes
Modifying the members of pim_interface which are to be used
for both IPv4 and IPv6 to common names(for both MLD and IGMP).

Issue: #10023

Co-authored-by: Mobashshera Rasool <mrasool@vmware.com>
Signed-off-by: Sai Gomathi <nsaigomathi@vmware.com>
2021-12-02 23:12:58 -08:00
Sai Gomathi 9a15529cda pimd: Fixing coverity issues
Signed-off-by: Sai Gomathi <nsaigomathi@vmware.com>
2021-08-24 10:36:45 -07:00
Donald Sharp d3cc1e4518 pimd: Remove pim->vrf_id and use pim->vrf->vrf_id
VRF creation can happen from either cli or from
knowledged about the vrf learned from zebra.
In the case where we learn about the vrf from
the cli, the vrf id is UNKNOWN.  Upon actual
creation of the vrf, lib/vrf.c touches up the vrf_id
and calls pim_vrf_enable to turn it on properly.
At this point in time we have a pim->vrf_id of
UNKNOWN and the vrf->vrf_id of the right value.

There is no point in duplicating this data.  So just
remove all pim->vrf_id and use the vrf->vrf_id instead
since we keep a copy of the pim->vrf pointer.

This will remove some crashes where we expect the
pim->vrf_id to be usable and it's not.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-05-12 14:36:59 -04:00
anlancs 3655f3549e pimd: check debug flag one time
debug flag checked twice, just keep one.

Signed-off-by: anlancs <anlan_cs@tom.com>
2021-02-08 09:15:32 +08:00
Mobashshera Rasool 195427c8fd pimd: SPT-bit is not set to false as per RFC section in one flow
1. As per RFC 4601 Sec 4.5.7:
* JoinDesired(S,G) -> False, set SPTbit to false.

2. Change the debug type.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-01-11 05:23:41 +00:00