summaryrefslogtreecommitdiffstats
path: root/pimd/pim_zlookup.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* pim6d: pim_nht changes for pimv6sarita patra2022-02-281-26/+16
| | | | Signed-off-by: sarita patra <saritap@vmware.com>
* Merge pull request #10400 from opensourcerouting/pim6-compilefixDonald Sharp2022-02-261-1/+1
|\ | | | | pim6d: get running with ipv6 types throughout
| * pim6d: IPv6-adjust RPF lookupsDavid Lamparter2022-02-161-1/+1
| | | | | | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | *: Change thread->func to return void instead of intDonald Sharp2022-02-241-8/+5
|/ | | | | | | 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>
* pim6d: IPv6-adjust neigh->source_addrDavid Lamparter2022-02-141-3/+3
| | | | Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* pimd: remove pim_str_sg_dump()David Lamparter2022-01-171-7/+5
| | | | | | | | ... 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>
* pimd: `prefix_sg` => `pim_sgaddr`David Lamparter2022-01-121-3/+3
| | | | | | | | | | | 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>
* *: convert zclient callbacks to tableDavid Lamparter2021-10-201-1/+1
| | | | | | | | | | | | | 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>
* pimd: de-circularize includesDavid Lamparter2021-08-271-0/+1
| | | | | | | 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>
* *: Replace IPV6_MAX_PREFIXLEN to IPV6_MAX_BITLENDonatas Abraitis2021-07-011-1/+1
| | | | | | Just drop IPV6_MAX_PREFIXLEN at all, no need keeping both. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* pimd: Remove pim->vrf_id and use pim->vrf->vrf_idDonald Sharp2021-05-121-1/+2
| | | | | | | | | | | | | | | | | | | | 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>
* pimd, zebra: explicit cast int netlink val to uintQuentin Young2021-04-281-1/+2
| | | | | | | 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>
* *: Convert all usage of zclient_send_message to new enumDonald Sharp2020-11-151-1/+1
| | | | | | | | | 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>
* pimd: Fix crash on restart from thread_cancelDonald Sharp2020-05-281-1/+1
| | | | | | | | 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>
* pimd: if_lookup_by_index can fail handle it appropriatelyDonald Sharp2020-04-171-10/+10
| | | | | | | 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>
* zebra: Synchronous client queues accumulate messages from zebra.Karen Schoener2020-03-231-1/+13
| | | | | | | | | | | | | | | | | | 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>
* *: Replace __PRETTY_FUNCTION__/__FUNCTION__ to __func__Donatas Abraitis2020-03-051-33/+28
| | | | | | Just keep the code cool. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* pimd: lookup nh using vrf_id we checked beforeStephen Worley2020-01-081-1/+2
| | | | | | | | | | | 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>
* pimd: allow pimd to handle nexthop_lookup zapi errorStephen Worley2020-01-081-0/+8
| | | | | | | | 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>
* pimd: Allow zlookup socket to drainDonald Sharp2019-06-061-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* pimd: Cleanup extra paranthesis around S,G printoutDonald Sharp2019-03-281-1/+1
| | | | | | | | When we are displaying S,G string data we already auto display the string as (S,G) no need to have ((S,G)). Cleanup some that were found during log look through. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* pimd: Create a `struct pim_router` and move thread master into itDonald Sharp2019-01-041-3/+3
| | | | | | | | Create a `struct pim_router` and move the thread master into it. Future commits will further move global varaibles into the pim_router structure. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: Replace zclient_new with zclient_new_notifyDonald Sharp2018-11-121-1/+1
| | | | | | | It's been a year since we added the new optional parameters to instantiation. Let's switch over to the new name. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* pimd, zebra: Encode nexthop vrf in messageDonald Sharp2018-11-021-2/+5
| | | | | | Encode the nexthop vrf in the message sent about mrib lookups. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* pimd: Why was pim including zebra headers?Donald Sharp2018-09-231-1/+0
| | | | | | Remove the inclusion of zebra headers from pim. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: style for EC replacementsQuentin Young2018-09-131-7/+7
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: LIB_[ERR|WARN] -> EC_LIBQuentin Young2018-09-131-8/+8
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: rename ferr_zlog -> flog_err_sysQuentin Young2018-08-141-3/+3
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: rename zlog_fer -> flog_errQuentin Young2018-08-141-8/+8
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* pimd: Add pim_errors and define some pim specific errorsDonald Sharp2018-08-141-3/+4
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* pimd: Convert over to use LIB_ERR_XXX for zlog_errDonald Sharp2018-08-141-10/+18
| | | | | | | Convert, where appropriate, the zlog_err functions to zlog_ferr for the LIB_ERR_XXX enums Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* pimd: Fix connected route nexthop fix from 66f5152fMartin Buck2018-06-081-6/+14
| | | | | | | | | | | | | | | | Fix a couple of problems in my 1st fix for PIM nexthops reachable via a connected route: Use NEXTHOP_TYPE_IPV4_IFINDEX instead of NEXTHOP_TYPE_IPV4 since we add an IPv4 address to an already known ifindex. Assign nexthop_tab[num_ifindex].protocol_distance and .route_metric before incrementing num_ifindex. Revert the default: to individual switch case statement conversion in zclient_read_nexthop() as requested by donaldsharp in #2347 Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
* pimd: Fix nexthop determination when sending towards RPMartin Buck2018-06-051-24/+22
| | | | | | | | | | | | | | When sending a PIM join upwards on the RP-based tree, it may get dropped on the last hop before the RP if the RP is reachable via a connected route (i.e. there's no associated nexthop). pimd needs to put the nexthop IP address into the PIM join payload and fails to do that if that route has a nexthop of 0.0.0.0. So whenever we look up a route to determine the nexthop or we receive a nexthop tracking update from Zebra, use the destination address as the nexthop address for connected routes. Fixes #2326. Signed-off-by: Martin Buck <mb-tmp-tvguho.pbz@gromit.dyndns.org>
* Merge pull request #1921 from donaldsharp/pim_stuffLou Berger2018-03-301-1/+1
|\ | | | | Pim stuff
| * pimd: Move some data tracking variables per VRFDonald Sharp2018-03-181-1/+1
| | | | | | | | | | | | | | There were a few more global variables that needed to be per vrf. So move them over. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* | *: use C99 standard fixed-width integer typesQuentin Young2018-03-271-4/+4
|/ | | | | | | | | | | | | | | | | | | | | | The following types are nonstandard: - u_char - u_short - u_int - u_long - u_int8_t - u_int16_t - u_int32_t Replace them with the C99 standard types: - uint8_t - unsigned short - unsigned int - unsigned long - uint8_t - uint16_t - uint32_t Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* *: conform with COMMUNITY.md formatting rules, via 'make indent'Lou Berger2018-03-061-3/+2
| | | | Signed-off-by: Lou Berger <lberger@labn.net>
* *: Make zapi route install Notifications optionalDonald Sharp2017-11-271-1/+1
| | | | | | | | | | | Allow the higher level protocol to specify if it would like to receive notifications about it's routes that it has installed. I've purposely made it part of zclient_new_notify because we need to track the routes on a per daemon basis only. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* *: Modify zclient_init to require privs dataDonald Sharp2017-10-241-0/+1
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* pimd: Cleanup nht debugsDonald Sharp2017-08-021-2/+3
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* pimd: Cleanup unused assignmentDonald Sharp2017-07-241-1/+1
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* pimd: Fix pim not recognizing itself as an RP in some casesDonald Sharp2017-07-241-9/+0
| | | | | | | | | | | | During normal course of operations, zebra sends the ZEBRA_INTERFACE_VRF_UPDATE call up into all connected zclients. In the case of PIM the zlookup was expecting a min length of 10, but ZEBRA_INTERFACE_VRF_UPDATE was sending of size 6. This min length check makes no sense, so just remove. Ticket: CM-16976 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com> Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
* pimd: Fixup NHT debugging to be a bit more coherentDonald Sharp2017-07-241-47/+53
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* pimd: Remove unnecessary debug.Donald Sharp2017-07-241-4/+0
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* pimd: Prevent Lockup when waiting for response from zebraDonald Sharp2017-07-241-0/+7
| | | | | | | | | | | When we have vrf config that we have not fully setup yet, (ie zebra knows nothing about it yet), when attempting to do a nexthop_lookup, zebra will just drop the request if it doesn't know about the vrf. In this case, we need to safely not ask for the information Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* pimd: debug guard error messageDonald Sharp2017-07-241-2/+8
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* pimd: Make zlookup 'struct pim_instance' awareDonald Sharp2017-07-241-11/+14
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* pimd: Convert vif and ifindex lookups to use 'struct pim_instance *'Donald Sharp2017-07-241-1/+1
| | | | Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* pimd: Cleanup use of VRF_DEFAULT to pimg->vrf_idDonald Sharp2017-07-241-4/+4
| | | | | | | Use the appropriate vrf_id instead of always defaulting to VRF_DEFAULT Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
* Revert "*: reindent pt. 2"David Lamparter2017-07-221-2/+3
| | | | | | | | | This reverts commit c14777c6bfd0a446c85243d3a9835054a259c276. clang 5 is not widely available enough for people to indent with. This is particularly problematic when rebasing/adjusting branches. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>