summaryrefslogtreecommitdiff
path: root/nhrpd/nhrp_route.c
AgeCommit message (Collapse)Author
2023-07-10nhrpd: clean up locals in route zapi apiMark Stapp
Clean up use of a nexthop pointer - seemed inconsistent. Signed-off-by: Mark Stapp <mjs@labn.net>
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-31nhrpd: Add missing enum's to switch statementDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-11-22*: cleanup ifp->vrf_idIgor Ryzhov
Since f60a1188 we store a pointer to the VRF in the interface structure. There's no need anymore to store a separate vrf_id field. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
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-26nhrp, zebra, lib: pass exact received neighbor state value to nhrpPhilippe Guibert
As NHRP expects some notification of neighboring entries on GRE interface, when a new interface notification is encountered, the exact neighbor state flag is found. Previously, the flag passed to the upper layer was forced to NDM_STATE which is REACHABLE, as can be seen on below trace: 2021/08/25 10:58:39 NHRP: [QQ0NK-1H449] Netlink: new-neigh 102.1.1.1 dev gre1 lladdr 10.125.0.2 nud 0x2 cache used 1 type 5 When passing the real value, NHRP received an other value like STALE. 2021/08/25 11:28:44 NHRP: [QQ0NK-1H449] Netlink: new-neigh 102.1.1.1 dev gre1 lladdr 10.125.0.2 nud 0x4 cache used 0 type 5 This flag is important for NHRP, as it permits to monitor the link layer of NHRP entries. Fixes: d603c0774eba ("nhrp, zebra, lib: enforce usage of zapi_neigh_ip structure") Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-04-30nhrp: Preserve mtu during interface up/down and tunnel source changePhilippe Guibert
preserve mtu upon interface flapping and tunnel source change. Signed-off-by:Reuben Dowle <reuben.dowle@4rf.com> Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-04-30nhrpd: redirect netlink gre with zebraPhilippe Guibert
as zebra has a new api to get gre and set gre source commands, netlink gre get and netlink gre source function calls are redirected to zebra by using the zapi interface. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-04-13nhrp, zebra, lib: enforce usage of zapi_neigh_ip structurePhilippe Guibert
zapi_nbr structure is renamed to zapi_neigh_ip. Initially used to set a neighbor ip entry for gre interfaces, this structure is used to get events from the zebra layer to nhrp layer. The ndm state has been added, as it is needed on both sides. The zebra dplane layer is slightly modified. Also, to clarify what ZEBRA_NEIGH_ADD/DEL means, a rename is done: it is called now ZEBRA_NEIGH_IP_ADD/DEL, and it signified that this zapi interface permits to set link operations by associating ip addresses to link addresses. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-04-12nhrpd: add a zebra api to configure neighbor table per interfacePhilippe Guibert
neighbor table per interface is being configured per interface, via zebra api. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-04-09nhrp, lib, zebra: add/del neighbor entry possible from nhrpPhilippe Guibert
a zebra api is extended to offer ability to add or remove neighbor entry from daemon. Also this extension makes possible to add neigh entry, not only between IPs and macs, but also between IPs and NBMA IPs. This API supports configuring ipv6/ipv4 entries with ipv4/ipv6 lladdr. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-04-09nhrpd: link layer registration to notificationsPhilippe Guibert
neighbor notifications are done in zebra. so, instead of relying on nhrp, rely on zebra by using zebra api interface. Consequently, the code originally used in nhrp for netlink neighor notification is no more used. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-03-17*: require semicolon after DEFINE_MTYPE & coDavid Lamparter
Back when I put this together in 2015, ISO C11 was still reasonably new and we couldn't require it just yet. Without ISO C11, there is no "good" way (only bad hacks) to require a semicolon after a macro that ends with a function definition. And if you added one anyway, you'd get "spurious semicolon" warnings on some compilers... With C11, `_Static_assert()` at the end of a macro will make it so that the semicolon is properly required, consumed, and not warned about. Consistently requiring semicolons after "file-level" macros matches Linux kernel coding style and helps some editors against mis-syntax'ing these macros. Signed-off-by: David Lamparter <equinox@diac24.net>
2021-03-10nhrpd: Use our built-in printf functionalityDonald Sharp
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-02-12Merge pull request #7764 from pguibert6WIND/nhrp_shortcut_routesJafar Al-Gharaibeh
nhrp: fix shortcut routes
2021-02-11nhrpd: replace nhrp route nexthop with onlink route when prefix=nhPhilippe Guibert
There are cases where nhrp wants to create a nhrp route to gre interface with the nexthop which is the same the prefix. This is the case with ipv6: ipv6 route a:ff::ff:4/128 via a:ff::ff:4:/128 dev gre1 This route entry is false from zebra point of view, and to avoid that, the nexthop is ignored in nhrp only if the prefix equals the nexthop. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2021-01-12libs,nhrpd: remove exec permMark Stapp
Some source files got the exec bit set in a recent commit - undo that. Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-12-17nhrpd: Clear shortcut routes properly for all protocolsGaurav Goyal
Currently when nhrp shortcuts are purged they will not be recreated. This patch fixes that by ensuring the shortcut routes get purged correctly. This situation can be reproduced by first allowing a shortcut to be created then clearing the shortcut: clear ip nhrp cache clear ip nhrp shortcuts Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
2020-11-06nhrpd: Fix memory leak on shutdownDonald Sharp
On shutdown we were blantantly dropping the node->info data. Make it happy. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-10-22:* Convert prefix2str to %pFXDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-07-31nhrpd: ignore zebra updates about our routes being deleted/addedPhilippe Guibert
nhrp listens for route entries to be deleted, in case some new routes impact the current routes installed by nhrp. To prevent from unconfiguring nhrp shortcut route, just prevent nhrp routes to be processed. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-07-14*: un-split strings across linesDavid Lamparter
Remove mid-string line breaks, cf. workflow doc: .. [#tool_style_conflicts] For example, lines over 80 characters are allowed for text strings to make it possible to search the code for them: please see `Linux kernel style (breaking long lines and strings) <https://www.kernel.org/doc/html/v4.10/process/coding-style.html#breaking-long-lines-and-strings>`_ and `Issue #1794 <https://github.com/FRRouting/frr/issues/1794>`_. Scripted commit, idempotent to running: ``` python3 tools/stringmangle.py --unwrap `git ls-files | egrep '\.[ch]$'` ``` Signed-off-by: David Lamparter <equinox@diac24.net>
2020-03-08Merge pull request #5922 from pguibert6WIND/nhrp_override_fixDonald Sharp
Revert "nhrpd: ignore zebra updates about our routes being deleted/ad…
2020-03-08*: Replace `sizeof something` to sizeof(something)Donatas Abraitis
Satisfy checkpatch.pl requirements (check for sizeof without parenthesis) Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-06Revert "nhrpd: ignore zebra updates about our routes being deleted/added"Philippe Guibert
This reverts commit d0bfe25dead1d3dfdc18951f1b6d0023be9ac76c.
2020-03-05nhrpd: ignore zebra updates about our routes being deleted/addedPhilippe Guibert
nhrp listens for route entries to be deleted, in case some new routes impact the current routes installed by nhrp. To prevent from unconfiguring nhrp shortcut route, just prevent nhrp routes to be processed. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2020-02-03*: don't null after XFREE; XFREE does this itselfQuentin Young
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-09-19*: Convert zapi->interface_delete to ifp callbackDonald Sharp
Convert the callback of the interface_delete to the new ifp callback. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19*: Convert interface_down to interface down callbackDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19*: Convert from ->interface_up to the interface callbackDonald Sharp
For all the places we have a zclient->interface_up convert them to use the interface ifp_up callback instead. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19*: Switch all zclient->interface_add to interface create callbackDonald Sharp
Switch the zclient->interface_add functionality to have everyone use the interface create callback in lib/if.c Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-05-03*: use ZAPI_CALLBACK_ARGS macro for zapi handlersQuentin Young
This macro: - Marks ZAPI callbacks for readability - Standardizes argument names - Makes it simple to add ZAPI arguments in the future - Ensures proper types - Looks better - Shortens function declarations Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-11-12*: Replace zclient_new with zclient_new_notifyDonald Sharp
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>
2018-09-08*: fix config.h/zebra.h include orderDavid Lamparter
config.h (or, transitively, zebra.h) must be the first include file listed for autoconf things like _GNU_SOURCE and _POSIX_C_SOURCE to work correctly. Signed-off-by: David Lamparter <equinox@diac24.net>
2018-03-06*: conform with COMMUNITY.md formatting rules, via 'make indent'Lou Berger
Signed-off-by: Lou Berger <lberger@labn.net>
2018-02-26*: Rename ZEBRA_FLAG_INTERNAL -> ZEBRA_FLAG_ALLOW_RECURSIONDonald Sharp
The ZEBRA_FLAG_INTERNAL flag is used to signal to zebra that the route being added, the nexthops for it can be recursively resolved. This name keeps throwing me off when I read it so let's rename to something that allows the developer to understand what is going on. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-02-08*: Track vrfs per nexthop not per route entryDonald Sharp
Track the vfrs on a per nexthop basis instead of on a per route entry basis. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-01-12*: Send/receive the nexthop vrf_idDonald Sharp
Modify the code to send and receive to/from zebra the nexthops vrf_id. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-11-27*: Make zapi route install Notifications optionalDonald Sharp
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>
2017-10-23*: Modify zclient_init to require privs dataDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-08-28*: remove ZEBRA_FLAG_{BLACKHOLE,REJECT} from APIDavid Lamparter
FLAG_BLACKHOLE is used for different things in different places. remove it from the zclient API, instead indicate blackholes as proper nexthops inside the message. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2017-08-23*: use zapi_route to send/receive redistributed routes as wellRenato Westphal
Some differences compared to the old API: * Now the redistributed routes are sent using address-family independent messages (ZEBRA_REDISTRIBUTE_ROUTE_ADD and ZEBRA_REDISTRIBUTE_ROUTE_DEL). This allows us to unify the ipv4/ipv6 zclient callbacks in the client daemons and thus remove a lot of duplicate code; * Now zebra sends all nexthops of the redistributed routes to the client daemons, not only the first one. This shouldn't have any noticeable performance implications and will allow us to remove an ugly exception we had for ldpd (which needs to know all nexthops of the redistributed routes). The other client daemons can simply ignore the nexthops if they want or consult just the first one (e.g. ospfd/ospf6d/ripd/ripngd). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23nhrpd: unify ipv4/ipv6 zebra-tx functionsRenato Westphal
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23nhrpd: use the new API to send routes to zebraRenato Westphal
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23babeld/eigrpd/ldpd/nhrpd: add prefix length sanity checksRenato Westphal
Pulled from d917882. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-23babeld/nhrpd: ignore ipv6 srcdest routesRenato Westphal
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2017-08-04nhrp: fix initialization and route redistribution registrationJorge Boncompte
nhrpd wasn't registering correctly with zebra for route redistribution. It wasn't neither parsing the right messages nor parsing them correctly too. Signed-off-by: Jorge Boncompte <jbonor@gmail.com>
2017-06-30nhrpd: Fix zclient cleanup on shutdownDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2017-05-18nhrpd: announce ipv6 routes to zebraTimo Teräs
Signed-off-by: Timo Teräs <timo.teras@iki.fi>
2017-03-15*: Remove non-vrf based ifindex lookupDonald Sharp
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>