summaryrefslogtreecommitdiff
path: root/pimd/pim_zlookup.c
AgeCommit message (Collapse)Author
2025-04-08pimd: clean up variable-shadow warningsMark Stapp
Clean up -Wshadow warnings in pimd Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-01-09pimd: Implement rpf lookup mode as a listNathan Bahr
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>
2024-12-13pimd: Refactor synchronous nexthop lookupNathan Bahr
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-12zebra,pimd,lib: Modify ZEBRA_NEXTHOP_LOOKUP_MRIBNathan Bahr
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-10-15*: Fix up improper handling of nexthops for nexthop trackingDonald Sharp
Currently FRR needs to send a uint16_t value for the number of nexthops as well it needs the ability to properly decode all of this. Find and handle all the places that this happens. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-11-23*: add `zclient_options_sync`David Lamparter
... and use it instead of fiddling with the `.synchronous` field. (Make it const while at it.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-09-19pimd: Use a better name for oil_parentDonald Sharp
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-14pimd: Display oil_parent as a string name of the interfaceDonald Sharp
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-03-24*: Convert event.h to frrevent.hDonald Sharp
We should probably prevent any type of namespace collision with something else. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert THREAD_XXX macros to EVENT_XXX macrosDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Convert thread_add_XXX functions to event_add_XXXDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24*: Rename `struct thread` to `struct event`Donald Sharp
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*: Rename thread.[ch] to event.[ch]Donald Sharp
This is a first in a series of commits, whose goal is to rename the thread system in FRR to an event system. There is a continual problem where people are confusing `struct thread` with a true pthread. In reality, our entire thread.c is an event system. In this commit rename the thread.[ch] files to event.[ch]. Signed-off-by: Donald Sharp <sharpd@nvidia.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>
2023-01-31pimd: Add missing enums to switch statementDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-10-17pimd: Fix v4-over-v6 nexthop handlingSarita Patra
In the current code, if_lookup_by_index() is called for un-initialized ifindex value. This issue is introduced after 11098 PR. Signed-off-by: Sarita Patra <saritap@vmware.com>
2022-06-23pimd: Let end operator know the ifindex as well in failure caseDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-06-23pimd: Limit pim's ecmp to what zebra tells us is the multipathDonald Sharp
Zebra can be setup to use a value that is less than MULTIPATH_NUM. When pimd connects to zebra, zebra will inform pim about the MULTIPATH_NUM used. Let's use that value for figuring out our multipath value. 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-04-28pim6d: Make pim_zlookup_sg_statistics available for v6Mobashshera Rasool
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-28zebra, pimd: Add a field family in the message ZEBRA_IPMR_ROUTE_STATSMobashshera Rasool
1. Adding a field family in the existing ZEBRA_IPMR_ROUTE_STATS to get the ipv4 as well as ipv6 trafic stats between pim and zebra. 2. Modify the debug to print both v4/v6 prefixes pimd: pim6d: Modify pim_zlookup_sg_statistics to get ipv6 stats Modify the pim_zlookup_sg_statistics api to get ipv4/ipv6 stats from zebra. Making the api common. Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-04-26pimd: clean up zlookup nexthop handlingDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-04-26pim6d: implement/un-stub MRIB lookupDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-04-26zebra, pimd: add AF param on NEXTHOP_LOOKUP_MRIBDavid Lamparter
By changing this API call to use a `struct ipaddr`, which encodes the type of IP address with it. (And rename/remove the `IPV4` from the command name.) Also add a comment explaining that this function call is going to be obsolete in the long run since pimd needs to move to proper MRIB NHT. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-04-06pim6d: Handle mrib_nexthop_addr zclient_lookup_nexthopsarita patra
Signed-off-by: sarita patra <saritap@vmware.com>
2022-04-06pim6d: Adjust IPV6 zclient_lookup_read_pipesarita patra
Signed-off-by: sarita patra <saritap@vmware.com>
2022-04-06pim6d: Adjust IPV6 zclient_lookup_nexthop_oncesarita patra
Signed-off-by: sarita patra <saritap@vmware.com>
2022-04-06pim6d: Adjust IPV6 zclient_read_nexthopsarita patra
Signed-off-by: sarita patra <saritap@vmware.com>
2022-04-04pimd: fix pim_instance NULL deference in zclient_lookup_read_pipesarita patra
Fixing the below coverity issue. >>> CID 1515546: Null pointer dereferences (NULL_RETURNS) >>> Dereferencing a pointer that might be "NULL" "pim" when calling "zclient_lookup_nexthop_once". 391 zclient_lookup_nexthop_once(pim, nexthop_tab, 10, l); Signed-off-by: sarita patra <saritap@vmware.com>
2022-03-03pimd: Added new option "detail" in the "debug pim nht" CLISai Gomathi
Problem Statement: ================= PIM Logs are coming at interval of 1 minute although pim is not enabled. Root Cause Analysis: ==================== By default, RCPM configures the PIM debugs when router comes up via script. The product cannot disable PIM even though it is not required. Hence moving these logs under a new debug option which will not be enabled by default. Fix: ==== Added a new option "detail" in the cli: debug pim nht detail Co-author: Mobashshera Rasool <mrasool@vmware.com> Signed-off-by: Sai Gomathi <nsaigomathi@vmware.com>
2022-02-28pim6d: pim_nht changes for pimv6sarita patra
Signed-off-by: sarita patra <saritap@vmware.com>
2022-02-26Merge pull request #10400 from opensourcerouting/pim6-compilefixDonald Sharp
pim6d: get running with ipv6 types throughout
2022-02-23*: Change thread->func to return void instead of intDonald Sharp
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-16pim6d: IPv6-adjust RPF lookupsDavid 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-01-17pimd: remove pim_str_sg_dump()David Lamparter
... 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-12pimd: `prefix_sg` => `pim_sgaddr`David Lamparter
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>
2021-10-20*: convert zclient callbacks to tableDavid Lamparter
This removes a giant `switch { }` block from lib/zclient.c and harmonizes all zclient callback function types to be the same (some had a subset of the args, some had a void return, now they all have ZAPI_CALLBACK_ARGS and int return.) Apart from getting rid of the giant switch, this is a minor security benefit since the function pointers are now in a `const` array, so they can't be overwritten by e.g. heap overflows for code execution anymore. 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-07-01*: Replace IPV6_MAX_PREFIXLEN to IPV6_MAX_BITLENDonatas Abraitis
Just drop IPV6_MAX_PREFIXLEN at all, no need keeping both. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-05-12pimd: Remove pim->vrf_id and use pim->vrf->vrf_idDonald Sharp
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-04-28pimd, zebra: explicit cast int netlink val to uintQuentin Young
encoding signed int as unsigned is bad practice; since we want to do it here lets at least be explicit about it Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2020-11-15*: Convert all usage of zclient_send_message to new enumDonald Sharp
The `enum zclient_send_status` enum needs to be extended throughout the code base to use the new states and to fix up places where we tested against the return value being non zero. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-05-28pimd: Fix crash on restart from thread_cancelDonald Sharp
We were using thread_cancel() directly instead of THREAD_OFF which correctly ensures the pointer is not NULL. Ticket:CM-29866 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-04-16pimd: if_lookup_by_index can fail handle it appropriatelyDonald Sharp
It is possible that a if_lookup_by_index can return NULL ensure that we handle this appropriately. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-03-23zebra: Synchronous client queues accumulate messages from zebra.Karen Schoener
Zebra is currently sending messages on interface add/delete/update, VRF add/delete, and interface address change - regardless of whether its clients had requested them. This is problematic for lde and isis, which only listens to label chunk messages, and only when it is waiting for one (synchronous client). The effect is the that messages accumulate on the lde synchronous message queue. With this change: - Zebra does not send unsolicited messages to synchronous clients. - Synchronous clients send a ZEBRA_HELLO to zebra. The ZEBRA_HELLO contains a new boolean field: sychronous. - LDP and PIM have been updated to send a ZEBRA_HELLO for their synchronous clients. Signed-off-by: Karen Schoener <karen@voltanet.io>
2020-03-05*: Replace __PRETTY_FUNCTION__/__FUNCTION__ to __func__Donatas Abraitis
Just keep the code cool. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-01-08pimd: lookup nh using vrf_id we checked beforeStephen Worley
Update zclient_lookup_nexthop_once() to create the zapi header using the vrf_id on the pim->vrf struct. This is the one we do a check on a couple lines before, so we should be using it when we actually create the header as well. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2020-01-08pimd: allow pimd to handle nexthop_lookup zapi errorStephen Worley
Allow pimd to stop the lookup if zebra tells pimd that the lookup failed due to a zapi error. Otherwise, it will keep waiting for a nexthop message that will never come. Signed-off-by: Stephen Worley <sworley@cumulusnetworks.com>
2019-06-06pimd: Allow zlookup socket to drainDonald Sharp
When pim is started and has nothing to talk to zebra about over the zlookup socket and interface events are happening then the zlookup socket is not being drained. This eventually leads to a situation where the kernel send buffer fills up and zebra is unable to write anything down the pipe. At this time the zapi starts buffering data in `struct buffer` which of course slowly fills up as pim has nothing to do. As a bit of a hack allow the zlookup socket to wake up 1 time a minute and ask for information about the default route and do nothing with it. This will cause the socket buffers to be drained and the system will be happy. Long term we need to get rid of this synchronous/asynchronous duality that pim has. This is on the radar but is not something that could be fixed in an afternoon or a week of effort in my opinion. Given time constraints right now. Let's put this in place and then once we get pim completely async then we can just remove the zlookup( I hope ) code. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>