Commit graph

214 commits

Author SHA1 Message Date
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 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
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
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 3066f48eb8 pim6d: fix coverity scan warning
Fix Coverity Scan CID 1601875: use the return value to tell user about
the availability of a next hop to the learned RP (needs debug enabled).

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-11-18 09:17:32 -03:00
Rafael Zalamena 2941f579f7 pimd: fix check-patch warning
Remove unnecessary braces.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2024-11-13 12:05:35 -03: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
Nathan Bahr f182255c0f pimd: Add AutoRP functionality to PIMD
Perform AutoRP discovery and candidate RP announcements using the
AutoRP protocol.
Mapping agent is not yet implemented, but this feature is not
necessary for FRR to support AutoRP as we only need one AutoRP
mapping agent in the network.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2024-09-24 16:36:53 +00:00
Donald Sharp d97c535c1e *: Create termtable specific temp memory
When trying to track down a MTYPE_TMP memory leak
it's harder to search for it when you happen to
have some usage of ttable_dump.  Let's just give
it it's own memory type so that we can avoid
confusion in the future.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-09-01 13:07:46 -04:00
Nathan Bahr fd8edc3dfb pimd, lib, vtysh: Added new 'router pim[6] [vrf NAME]' config node
Moved all existing global/vrf PIM config to the new subnode.
Existing configuration updated to be hidden and deprecated.
Both versions of configuration still work together.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2024-07-16 13:30:35 -05:00
David Lamparter 759e93302d pimd: refactor pim_rp_set_upstream_addr
Somehow this tiny function ended up being written in a very convoluted
way that enabled the braces mixup in the previous commit.  Rewrite it to
be less confusing.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-06-26 16:15:25 +02:00
David Lamparter 163a3f582f pimd: fix misplaced braces/logic error
The `!rp_info ||` check got added during a cleanup pass.  Unfortunately
the braces/and/or combination is not correct :(

Fixes: b1945363fb ("pimd: Various buffer overflow reads and crashes")
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-06-26 16:15:13 +02:00
David Lamparter 1f223ae1ee pimd: add debugs for i-am-RP state
This proved helpful in debugging the Candidate-RP code.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-06-20 13:10:51 +02:00
Donald Sharp 8e85c8b45e pimd: Make some not very needed debugs more restrictive
When turning on debug pim trace, there are lots of messages
surrounding the timing of rpf lookup.  99% of the time
no-one cares about these anymore.  Let's make them
not seen unless we turn up debugs

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-11 11:50:52 -05:00
Donald Sharp d8bc11a592 *: Add a hash_clean_and_free() function
Add a hash_clean_and_free() function as well as convert
the code to use it.  This function also takes a double
pointer to the hash to set it NULL.  Also it cleanly
does nothing if the pointer is NULL( as a bunch of
code tested for ).

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-21 08:54:21 -04:00
Sarita Patra 201a31b977 pimd, pim6d: Don't track nexthop for RP 0.0.0.0 & 0::0
Topology:
========
FHR----Source

Problem:
=======
When FHR receives multicast traffic, there is no RP configured,
PIMD does NHT register for RP address 0.0.0.0 and group 224.0.0.0/4
PIM6D does NHT register for RP address 0::0 and group FF00::0/8

frr# show ip pim nexthop
Number of registered addresses: 1
Address         Interface        Nexthop
---------------------------------------------

frr# show ipv6 pim nexthop
Number of registered addresses: 1
Address         Interface        Nexthop
---------------------------------------------

Fix:
====
Dont track nexthop for RP 0.0.0.0 & 0::0.

frr# show ip pim nexthop
Number of registered addresses: 0

frr# show ipv6 pim nexthop
Number of registered addresses: 0

Issue: #12104

Signed-off-by: Sarita Patra <saritap@vmware.com>
2023-02-28 08:38:50 -08: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
Sarita Patra 43a18948d5 pimd, pim6d: Fix rp-info OIF having PIM disabled interface
Problem:
frr(config)# show ip pim rp-info
RP address group/prefix-list OIF I am RP Source Group-Type
109.0.0.3 224.0.0.0/4 ens192 no Static ASM

frr(config)# int ens192
frr(config-if)# no ip pim

frr(config) show ip pim rp-info
RP address group/prefix-list OIF I am RP Source Group-Type
109.0.0.3 224.0.0.0/4 ens192 no Static ASM

rp-info OIF is still having ens192 which is PIM disabled.
Fixing this as part of this PR.

Issue: #12044

Signed-off-by: Sarita Patra <saritap@vmware.com>
2022-10-25 21:25:23 -07:00
Abhishek N R f1ebd3dbd0 pimd, pim6d: Using ttable for displaying "show ip/ipv6 pim rp-info" command output.
Signed-off-by: Abhishek N R <abnr@vmware.com>
2022-08-16 21:51:58 -07:00
Mobashshera Rasool c6c615c12b pimd,pim6d: Set RP to true if the address matches, ignore prefix-length
The API pim_rp_check_interface_addrs checks if the RP address matches
with the primary address then it returns true.
In case of PIMv4 this condition is true, therefore the router becomes RP.
But in case of PIMv6, this condition does not pass because primary address
for PIMv6 is link-local address.

Also PIMv4 allows secondary addresses to be used as RP
if it is a host route in case primary does not match.

Fixing it by only checking the configured
RP address with the interface address and ignoring the prefix
length since it does not matter.

Fixes: #11335

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-07-12 22:51:27 -07:00
sarita patra e6e5300636 pim6d: Pass pim_addr for pim_nht callbacks.
For pim callbacks, we pass pim_addr as value, not pointer.
So making it consistent for pim_nht callbacks.

Signed-off-by: sarita patra <saritap@vmware.com>
2022-07-06 02:56:43 -07:00
sarita patra b63192cfc2 pim6d: Adjust rpf_addr in rp_info
In this PR, we are handling the rp_info
after rpf_addr modified from prefix
to pim_addr.

Signed-off-by: sarita patra <saritap@vmware.com>
2022-07-06 02:41:47 -07:00
Donald Sharp cf568522d5 pimd: Cleanup rpf lookup debug to help us figure out what is going on
The rpf lookup debug was not taking into account the fact that a prefix-list
might be applied and also we might need to make a choice between the two.
So let's give ourselves a bit more data.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-06-14 09:50:54 -04:00
Donald Sharp 94dc0c4ed4 pimd: Allow the LPM match work properly with prefix lists and normal rp's
All rp_info's are being saved in the pim->rp_list and the non prefix-list
rp's are supposed to be saved in table pim->rp_table.  What was happening,
though, is that all the plists were being stored at the 224.0.0.0/4 node
of the tree(irrelevant to the fact that we should not be looking up the
non-prefix list rp's in the table) and since we can have multiple prefix lists
and only one rp_info stored at the 224.0.0.0/4 node of the tree, there can be situations
where the 224.0.0.0/4 node can be overwritten due to the order entered.

As such there exists situations where command enter ordering will cause
what we match to, change in pim_rp_find_match_group.

Fixes:

a) Do not store prefix list based rp_info's in the pim->rp_table
b) In pim_rp_find_match_group, ensure that the node lookup does
not correspond to a prefix list based node.
c) When in the situation there are both:
ip pim rp 4.5.6.7 224.0.0.0/16
ip pim rp 5.6.67.8 prefix-list FOO
ip prefix-list FOO permit 224.0.1.0/24
and we receive a group for 224.0.1.5, we were comparing the
224.0.0.0/16 to the 224.0.0.0/4 of the 5.6.67.8 group, when
FRR should have been comparing to entry that matched in the prefix-list

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-05-26 10:45:35 -04:00
David Lamparter 993e3d8e13 pimd: un-dependency-hell pim_instance.h
This is causing build issues on BSD by including (transitively)
`linux/mroute6.h` - try to address by disentangling the headers a bunch.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-05-06 15:10:57 +02:00
Abhishek N R 0095f482ca pim6d: Implementing "show ipv6 pim rp-info" CLI
Adding new show CLI to display pim RP information.

Also corrected ipv4 json object.

Signed-off-by: Abhishek N R <abnr@vmware.com>
2022-03-28 23:53:15 -07:00
Donatas Abraitis c07ddc3656 pimd: Show all groups matched by an arbitrary prefix for pim rp-info
```
r1# show ip pim rp-info
RP address       group/prefix-list   OIF               I am RP    Source   Group-Type
192.168.10.123   225.0.0.0/24        eth2              yes        Static   ASM
192.168.10.123   239.0.0.0/8         eth2              yes        Static   ASM
192.168.10.123   239.4.0.0/24        eth2              yes        Static   SSM

r1# show ip pim rp-info 239.4.0.0/25
RP address       group/prefix-list   OIF               I am RP    Source   Group-Type
192.168.10.123   239.0.0.0/8         eth2              yes        Static   ASM
192.168.10.123   239.4.0.0/24        eth2              yes        Static   SSM
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-03-17 09:38:22 +02:00
Donatas Abraitis 8c0a76808a pimd: Show group-type under show ip pim rp-info
And filter by group for PIM.

```
exit1-debian-11# show ip pim rp-info
RP address       group/prefix-list   OIF               I am RP    Source   Group-Type
192.168.10.17    238.0.0.0/24        eth2              no         Static   ASM
192.168.10.110   232.0.0.0/24        eth2              no         Static   SSM
exit1-debian-11# show ip pim rp-info 238.0.0.0/24
RP address       group/prefix-list   OIF               I am RP    Source   Group-Type
192.168.10.17    238.0.0.0/24        eth2              no         Static   ASM
exit1-debian-11# show ip pim rp-info 238.0.0.0/24 json
{
  "192.168.10.17":[
    {
      "rpAddress":"192.168.10.17",
      "outboundInterface":"eth2",
      "iAmRP":false,
      "group":"238.0.0.0/24",
      "source":"Static",
      "groupType":"ASM"
    }
  ]
}
exit1-debian-11#
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-03-12 10:41:07 +02:00
David Lamparter 5d1d18a10e pim6d: fix some IPv6 confusion in RP code
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-11 13:43:19 +01:00
David Lamparter 243e02abae pimd: RP code indentation adjustment
Need to fix some bits here and running into the "80-ch wall".

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-11 13:43:19 +01:00
Mobashshera Rasool fd5540ead6 pim6d: Modify pim_rp_find_exact and pim_rp_find_match_group
Modify the apis to accomodate IPv4 and IPv6 addreses for RP.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-03-08 00:57:51 -08:00
Mobashshera Rasool 9dca52b924 pim6d: Modify pim_rp_del for PIMv4/PIMv6
Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-03-08 00:57:51 -08:00
Mobashshera Rasool 1db07606ff pim6d: Modify pim_rp_find_prefix_list for PIMv6
Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-03-08 00:57:51 -08:00
Mobashshera Rasool 8eb5ad6c4a pim6d: Modify pim_rp_g for PIMv4/PIMv6
Modify pim_rp_g to support PIMv6.
Remove it from stub.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-03-08 00:57:51 -08:00
Mobashshera Rasool 131ded0891 pim6d: Modify pim_rp_i_am_rp for PIMv4/PIMv6
Remove pim_rp_i_am_rp from stub for PIMv6.
Modify pim_rp_i_am_rp for both the daemons.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-03-08 00:57:51 -08:00
Mobashshera Rasool b1e132ac61 pim6d: Modify pim_rp_set_upstream_addr for PIMv4/PIMv6
Modify pim_rp_set_upstream_addr for supporting PIMv4 and PIMv6.
Removed the stub api for PIMv6.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-03-08 00:57:51 -08:00
Mobashshera Rasool c6ced47492 pim6d: Add pim_get_all_mcast_group api
Added this api to fill all multicast group address based on IP version.
For PIMv4 its 224.0.0.0/4, for PIMv6 its FF00::0/8.
Changed the code where its being used currently.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-03-08 00:57:51 -08:00
Mobashshera Rasool 49b7b2c4a8 pim6d: Modify pim_rp_change api for pimv6
Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-03-08 00:57:51 -08:00
Mobashshera Rasool 6ed1cea1dc pim6d: Modify pim_rp_new for pimv6
Modify the api pim_rp_new to accomodate pimv6 changes.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-03-08 00:57:51 -08:00
Mobashshera Rasool 99384c6e4d pim6d: Return type and parameter changes for api pim_rp_del_config
1. Return value of this function pim_rp_del_config is nowhere used.
So made it as a void function.
2. Paramater const char *rp is first converted to string from prefix
in the caller and then back to prefix in this api pim_rp_del_config.
Fixed it by directly passing the address instead of string.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-03-08 00:57:51 -08:00
Mobashshera Rasool 0c3182a08d pim6d: Adding the rp clis to show-running
Modify the pim_rp_config_write api for pimv4/pimv6.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-03-08 00:57:51 -08: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
David Lamparter b369d0cc40 pimd: fix stray comment referencing INADDR_NONE
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-02 10:41:22 +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
David Lamparter ae449dc594 pim6d: remove PIM_V6_TEMP_BREAK
It's no longer necessary, pim6d now compiles without this hack.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-16 16:40:56 +01:00
David Lamparter 034db86b72 pim6d: IPv6-adjust iface primary/DR addrs
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-14 06:45:03 +01:00
David Lamparter 01adb431d3 pim6d: IPv6-adjust pim_upstream addr
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-14 06:45:03 +01:00
David Lamparter 9bb93fa04e pim6d: IPv6-adjust neigh->source_addr
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-14 06:45:03 +01:00
David Lamparter 5d99ebea32 pim6d: prepare/stub pim_rp_* functions for IPv6
These are sprinkled relatively widely through the PIM codebase, so for
the time being reduce the "compiler warning surface" by moving them
forward to proper types without actual implementations.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-14 06:45:03 +01:00