summaryrefslogtreecommitdiff
path: root/pimd/pim_rp.c
AgeCommit message (Collapse)Author
2024-01-11pimd: Make some not very needed debugs more restrictiveDonald Sharp
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>
2023-03-21*: Add a hash_clean_and_free() functionDonald Sharp
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-02-28pimd, pim6d: Don't track nexthop for RP 0.0.0.0 & 0::0Sarita Patra
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-09*: auto-convert to SPDX License IDsDavid Lamparter
Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-10-25pimd, pim6d: Fix rp-info OIF having PIM disabled interfaceSarita Patra
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-08-16pimd, pim6d: Using ttable for displaying "show ip/ipv6 pim rp-info" command ↵Abhishek N R
output. Signed-off-by: Abhishek N R <abnr@vmware.com>
2022-07-12pimd,pim6d: Set RP to true if the address matches, ignore prefix-lengthMobashshera Rasool
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-06pim6d: Pass pim_addr for pim_nht callbacks.sarita patra
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-06pim6d: Adjust rpf_addr in rp_infosarita patra
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-06-14pimd: Cleanup rpf lookup debug to help us figure out what is going onDonald Sharp
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-05-26pimd: Allow the LPM match work properly with prefix lists and normal rp'sDonald Sharp
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-06pimd: un-dependency-hell `pim_instance.h`David Lamparter
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-03-28pim6d: Implementing "show ipv6 pim rp-info" CLIAbhishek N R
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-17pimd: Show all groups matched by an arbitrary prefix for `pim rp-info`Donatas Abraitis
``` 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-12pimd: Show group-type under `show ip pim rp-info`Donatas Abraitis
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-11pim6d: fix some IPv6 confusion in RP codeDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-11pimd: RP code indentation adjustmentDavid Lamparter
Need to fix some bits here and running into the "80-ch wall". Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-08pim6d: Modify pim_rp_find_exact and pim_rp_find_match_groupMobashshera Rasool
Modify the apis to accomodate IPv4 and IPv6 addreses for RP. Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-03-08pim6d: Modify pim_rp_del for PIMv4/PIMv6Mobashshera Rasool
Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-03-08pim6d: Modify pim_rp_find_prefix_list for PIMv6Mobashshera Rasool
Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-03-08pim6d: Modify pim_rp_g for PIMv4/PIMv6Mobashshera Rasool
Modify pim_rp_g to support PIMv6. Remove it from stub. Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-03-08pim6d: Modify pim_rp_i_am_rp for PIMv4/PIMv6Mobashshera Rasool
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-08pim6d: Modify pim_rp_set_upstream_addr for PIMv4/PIMv6Mobashshera Rasool
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-08pim6d: Add pim_get_all_mcast_group apiMobashshera Rasool
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-08pim6d: Modify pim_rp_change api for pimv6Mobashshera Rasool
Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-03-08pim6d: Modify pim_rp_new for pimv6Mobashshera Rasool
Modify the api pim_rp_new to accomodate pimv6 changes. Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-03-08pim6d: Return type and parameter changes for api pim_rp_del_configMobashshera Rasool
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-08pim6d: Adding the rp clis to show-runningMobashshera Rasool
Modify the pim_rp_config_write api for pimv4/pimv6. Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-03-02Merge pull request #10657 from patrasar/pim_remove_in_addr_noneDavid Lamparter
[manual merge to edit comment, didn't want to incur another cycle] Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-02pimd: fix stray comment referencing INADDR_NONEDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-01pimd: replace inaddr_none with PIMADDR_ANYsarita patra
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-02-16pim6d: remove `PIM_V6_TEMP_BREAK`David Lamparter
It's no longer necessary, pim6d now compiles without this hack. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-14pim6d: IPv6-adjust iface primary/DR addrsDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-14pim6d: IPv6-adjust pim_upstream addrDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-14pim6d: IPv6-adjust neigh->source_addrDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-02-14pim6d: prepare/stub pim_rp_* functions for IPv6David Lamparter
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-01-17pimd: move, rename and deploy pim_addr_is_any()David Lamparter
Replaces comparison against INADDR_ANY, so we can do IPv6 too. (Renamed from "pim_is_addr_any" for "pim_addr_*" naming pattern, and type fixed to bool.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-01-07pimd: remove redundant header inclusionMobashshera Rasool
Just found while code inspection, pim_str.h is included twice. Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-11-29Merge pull request #10124 from ton31337/feature/vty_jsonIgor Ryzhov
2021-11-25pimd: Convert vty_out to vty_json for JSONDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-25pimd: Replace prefix2str for JSON to %pFXDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-18pimd : packet processing optimization on rp changeMobashshera Rasool
Problem Statement: ================== on rp_change, PIM processes all the upstream in a loop and for selected upstreams PIM has to send join/prune based on the RPF changed. join and prune packets are not getting aggregated in a single packet. Root Cause Analysis: ==================== on pim_rp_change pim_upstream_update() gets called for selected upstreams. This API calculates to whom it has to send join and to whom it has to send prune via API pim_zebra_upstream_rpf_changed(). This API peprares the upstream_switch_list list per interface and inserts the group and sources. Now PIM is still in the pim_upstream_update() API context, i.e PIM is still processing the same upstream. In the last there is a call to pim_zebra_update_all_interfaces() which processes the upstream_switch_list list, sends the packets out and clears the list. Fix: ==== Don't process the upstream_switch_list in the upstream context. process all the upstreams prepare the upstream_switch_list and then process in one go. This will club all the S,G entries. It also saves list cleanup with respect to memory allocation and deallocation multiple times. Signed-off-by: Vishal Dhingra <rac.vishaldhingra@gmail.com> Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-11-18pimd: Replace inet_ntop to %pI4/6 for JSON outputsDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-11-17pimd: clean up BSR NHT & fix parallel linksDavid Lamparter
The Bootstrap message RX path needs a RPF check for the BSR address, and this is implemented both incorrectly as well as quite ugly. Clean up and fix case when we have multiple interfaces to the same LAN and/or ECMP nexthops (both would cause message duplication, the former can even cause BSM forwarding loops.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-11-17*: clean up ifp-by-local-address function(s)David Lamparter
Most users of if_lookup_address_exact only cared about whether the address is any local address. Split that off into a separate function. For the users that actually need the ifp - which I'm about to add a few of - change it to prefer returning interfaces that are UP. (Function name changed due to slight change in behavior re. UP state, to avoid possible bugs from this change.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-08-27pimd: de-circularize includesDavid Lamparter
pimd's include files are very interdependent. Let's chop that down a bit to gain some flexibility. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-08-03Merge pull request #9085 from mobash-rasool/pim-upst-4Donald Sharp
pimd: memory leak fix and issue fix
2021-07-19pimd : memory leak in rp_table cleanup.github login name
Problem Statement: ================== valgrind shows memleaks in rp_table, when pimd shuts down gracefully. 2020-05-05 22:09:29,451 ERROR: Memory leaks in router [r4] for daemon [pimd] 2020-05-05 22:09:29,451 ERROR: Memory leaks in router [r4] for daemon [zebra] 2020-05-05 22:09:29,637 ERROR: Found memory leak in module pimd 2020-05-05 22:09:29,638 ERROR: ==6178== 184 (56 direct, 128 indirect) bytes in 1 blocks are definitely lost in loss record 21 of 21 2020-05-05 22:09:29,638 ERROR: ==6178== at 0x4C2FFAC: calloc (vg_replace_malloc.c:762) 2020-05-05 22:09:29,638 ERROR: ==6178== by 0x4E855EE: qcalloc (memory.c:111) 2020-05-05 22:09:29,638 ERROR: ==6178== by 0x4EAA43C: route_table_init_with_delegate (table.c:52) 2020-05-05 22:09:29,638 ERROR: ==6178== by 0x1281A1: pim_rp_init (pim_rp.c:114) 2020-05-05 22:09:29,638 ERROR: ==6178== by 0x11D0F8: pim_instance_init (pim_instance.c:117) 2020-05-05 22:09:29,638 ERROR: ==6178== by 0x11D0F8: pim_vrf_new (pim_instance.c:150) 2020-05-05 22:09:29,638 ERROR: ==6178== by 0x4EB1BEC: vrf_get (vrf.c:209) 2020-05-05 22:09:29,638 ERROR: ==6178== by 0x4EB2B2F: vrf_init (vrf.c:493) 2020-05-05 22:09:29,638 ERROR: ==6178== by 0x11D227: pim_vrf_init (pim_instance.c:217) 2020-05-05 22:09:29,638 ERROR: ==6178== by 0x11BBAB: main (pim_main.c:121) Fix: ==== rp_info is allocated in pim_rp_init API. rp_info pointer is present in rp_list and rp_table. In rp_list cleanup, the memory for rp_info gets freed. rp_table clean up should be done first and then rp_list. Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2021-07-06lib, pimd: add address match mode to prefix listsDavid Lamparter
... the PIM code is kinda misusing prefix lists to match addresses. Considering the weird semantics of access-lists, I can't fault it. However, prefix lists aren't great at matching addresses by default, since they try to match the prefix length too. So, here's an "address match mode" for prefix lists to get that to work more reasonably. Fixes: #8492 Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-07-01*: Convert numeric 32 into IPV4_MAX_BITLEN for prefixlenDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>