summaryrefslogtreecommitdiff
path: root/nhrpd
AgeCommit message (Collapse)Author
2023-03-19nhrpd: drop peer references on freeing cache entryDavid Lamparter
When dropping an interface (e.g. at shutdown) while there are still valid cache entries, the reference held on the cache entries' peer pointers was leaking. Fixes: #12505 Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
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-02-09*: manual SPDX License ID conversionsDavid Lamparter
The files converted in this commit either had some random misspelling or formatting weirdness that made them escape automated replacement, or have a particularly "weird" licensing setup (e.g. dual-licensed.) This also marks a bunch of "public domain" files as SPDX License "NONE". 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>
2022-10-26build, vtysh: extract vtysh commands from .xrefDavid Lamparter
Rather than running selected source files through the preprocessor and a bunch of perl regex'ing to get the list of all DEFUNs, use the data collected in frr.xref. This not only eliminates issues we've been having with preprocessor failures due to nonexistent header files, but is also much faster. Where extract.pl would take 5s, this now finishes in 0.2s. And since this is a non-parallelizable build step towards the end of the build (dependent on a lot of other things being done already), the speedup is actually noticeable. Also files containing CLI no longer need to be listed in `vtysh_scan` since the .xref data covers everything. `#ifndef VTYSH_EXTRACT_PL` checks are equally obsolete. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-10-07*: Create and use infrastructure to show debugs in libDonald Sharp
There are lib debugs being set but never show up in `show debug` commands because there was no way to show that they were being used. Add a bit of infrastructure to allow this and then use it for `debug route-map` Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-08-22nhrpd: Use nhrp_interface_update_nbma when source vrf was changedDmitrii Turlupov
1. Run frr: interface enp0s8 ip address 193.168.1.2/24 exit ! interface gre1 ip address 10.8.1.2/32 ip nhrp network-id 1 ip nhrp nhs dynamic nbma 193.168.1.1 tunnel source enp0s8 exit Log: NHS: Register 10.8.1.2 -> 10.8.1.2 (timeout 2) Send Registration-Request(3) 10.8.1.2 -> 10.8.1.2 Recv Registration-Reply(4) 10.8.1.1 -> 10.8.1.2 2. Create VRF and move enp0s8 to VRF ip link set enp0s8 master vrf1 Before patch: NHS: Waiting link for 193.168.1.1 After patch: NHS: Register 10.8.1.2 -> 10.8.1.2 (timeout 2) Signed-off-by: Dmitrii Turlupov <dturlupov@factor-ts.ru>
2022-08-15nhrpd: Use frr_weak_random()Donald Sharp
Convert usage of rand() to frr_weak_random() Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-06-21*: Replace sockunion2str => %pSUDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-06-16nhrpd: r is always < 0 at some points of if else statementsDonald Sharp
Since r is always < 0 at the last if/else there is no point in testing for it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-05-11*: Properly use memset() when zeroingDonatas Abraitis
Wrong: memset(&a, 0, sizeof(struct ...)); Good: memset(&a, 0, sizeof(a)); Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-03*: remove the checking returned value for hash_get()anlan_cs
Firstly, *keep no change* for `hash_get()` with NULL `alloc_func`. Only focus on cases with non-NULL `alloc_func` of `hash_get()`. Since `hash_get()` with non-NULL `alloc_func` parameter shall not fail, just ignore the returned value of it. The returned value must not be NULL. So in this case, remove the unnecessary checking NULL or not for the returned value and add `void` in front of it. Importantly, also *keep no change* for the two cases with non-NULL `alloc_func` - 1) Use `assert(<returned_data> == <searching_data>)` to ensure it is a created node, not a found node. Refer to `isis_vertex_queue_insert()` of isisd, there are many examples of this case in isid. 2) Use `<returned_data> != <searching_data>` to judge it is a found node, then free <searching_data>. Refer to `aspath_intern()` of bgpd, there are many examples of this case in bgpd. Here, <returned_data> is the returned value from `hash_get()`, and <searching_data> is the data, which is to be put into hash table. Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-04-04build: first header *must* be zebra.h or config.hDavid Lamparter
This has already been a requirement for Solaris, it is still a requirement for some of the autoconf feature checks to work correctly, and it will be a requirement for `-fms-extensions`. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
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-01-31bgpd,pimd,isisd,nhrpd: Convert to vty_json()Donatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2022-01-24*: do not print vrf name for interface config when using vrf-liteIgor Ryzhov
VRF name should not be printed in the config since 574445ec. The update was done for NB config output but I missed it for regular vty output. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-12-21*: rework renaming the default VRFIgor Ryzhov
Currently, it is possible to rename the default VRF either by passing `-o` option to zebra or by creating a file in `/var/run/netns` and binding it to `/proc/self/ns/net`. In both cases, only zebra knows about the rename and other daemons learn about it only after they connect to zebra. This is a problem, because daemons may read their config before they connect to zebra. To handle this rename after the config is read, we have some special code in every single daemon, which is not very bad but not desirable in my opinion. But things are getting worse when we need to handle this in northbound layer as we have to manually rewrite the config nodes. This approach is already hacky, but still works as every daemon handles its own NB structures. But it is completely incompatible with the central management daemon architecture we are aiming for, as mgmtd doesn't even have a connection with zebra to learn from it. And it shouldn't have it, because operational state changes should never affect configuration. To solve the problem and simplify the code, I propose to expand the `-o` option to all daemons. By using the startup option, we let daemons know about the rename before they read their configs so we don't need any special code to deal with it. There's an easy way to pass the option to all daemons by using `frr_global_options` variable. Unfortunately, the second way of renaming by creating a file in `/var/run/netns` is incompatible with the new mgmtd architecture. Theoretically, we could force daemons to read their configs only after they connect to zebra, but it means adding even more code to handle a very specific use-case. And anyway this won't work for mgmtd as it doesn't have a connection with zebra. So I had to remove this option. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-12-01Merge pull request #9878 from pguibert6WIND/resolver_vrfDonatas Abraitis
lib: resolver per vrf support
2021-11-23lib: resolver per vrf supportPhilippe Guibert
add a parameter to resolver api that is the vrf identifier. this permits to make resolution self to each vrf. in case vrf netns backend is used, this is very practical, since resolution can happen on one netns, while it is not the case in an other one. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.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-11-11*: Convert quagga_signal_X to frr_signal_XDonald Sharp
Naming functions/data structures more appropriately for the project we are actually in. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-10-26Merge pull request #9854 from opensourcerouting/zapi-call-tableRuss White
*: convert zclient callbacks to table
2021-10-21nhrpd: align nhrp privs with definition from othersPhilippe Guibert
nhrp_privs global context is aligned with other daemon contexts Signed-off-by: Philippe Guibert <philippe.guibert@6wind.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-10-19nhrpd: drop list.hDavid Lamparter
`number_of_linked_lists_in_frr--;` Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-10-19nhrpd: convert zbuf queue to DLISTDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-10-19nhrpd: convert SA list to DLISTDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-10-19nhrpd: convert reg list to DLISTDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-10-19nhrpd: convert mcast list to DLISTDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-10-19nhrpd: convert nhs list to DLISTDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-10-19nhrpd: convert notifier list to DLISTDavid Lamparter
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-10-04nhrpd: Do not explicitly set the thread pointer to NULLDonatas Abraitis
FRR should only ever use the appropriate THREAD_ON/THREAD_OFF semantics. This is espacially true for the functions we end up calling the thread for. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-08-27Merge pull request #9488 from pguibert6WIND/fix_nhrp_neigh_stateRuss White
Fix nhrp neigh state
2021-08-27Merge pull request #9496 from idryzhov/vrf-cmd-init-unused-argDavid Lamparter
lib: remove unused argument from vrf_cmd_init
2021-08-26Merge pull request #9331 from idryzhov/explicit-exitChristian Hopps
*: explicitly print "exit" at the end of every node config
2021-08-26lib: remove unused argument from vrf_cmd_initIgor Ryzhov
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
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-08-25*: Drop `break` after using frr_help_exit() in switch/caseDonatas Abraitis
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-08-23*: explicitly print "exit" at the end of every node configIgor Ryzhov
There is a possibility that the same line can be matched as a command in some node and its parent node. In this case, when reading the config, this line is always executed as a command of the child node. For example, with the following config: ``` router ospf network 193.168.0.0/16 area 0 ! mpls ldp discovery hello interval 111 ! ``` Line `mpls ldp` is processed as command `mpls ldp-sync` inside the `router ospf` node. This leads to a complete loss of `mpls ldp` node configuration. To eliminate this issue and all possible similar issues, let's print an explicit "exit" at the end of every node config. This commit also changes indentation for a couple of existing exit commands so that all existing commands are on the same level as their corresponding node-entering commands. Fixes #9206. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-08-08Merge pull request #8262 from reubendowle/fixes/nhrp-misc-fixesDonald Sharp
nhrp misc fixes
2021-08-03nhrp: fix display of nhs command.Dmitrii Turlupov
Before: ip nhrp nhs dynamicnbma 192.168.1.1 After: ip nhrp nhs dynamic nbma 192.168.1.1 Signed-off-by: Dmitrii Turlupov <dturlupov@factor-ts.ru>
2021-07-29*: cleanup interface node installationIgor Ryzhov
The only difference in daemons' interface node definition is the config write function. No need to define the node in every daemon, just pass the callback as an argument to a library function and define the node there. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-06-21lib: remove vrf-interface config when removing the VRFIgor Ryzhov
If we have the following configuration: ``` vrf red smth exit-vrf ! interface red vrf red smth ``` And we delete the VRF using "no vrf red" command, we end up with: ``` interface red smth ``` Interface config is preserved but moved to the default VRF. This is not an expected behavior. We should remove the interface config when the VRF is deleted. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-05-18nhrpd: Clear cache when shortcuts are clearedAmol Lad
This is required because with the cache entry in place traffic will continue via the shortcut path until the cache entry expires. Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
2021-05-18nhrpd: Set prefix correctly in resolution requestAmol Lad
RFC2332 requires prefix length be 0xFF only when uniqueness bit is set. Without this change Cisco spokes will reject resolution request messages Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
2021-05-18nhrpd: Fix corrupt address being shown for shortcuts with no cache entryReuben Dowle
Signed-off-by: Reuben Dowle <reuben.dowle@4rf.com>
2021-05-05Merge pull request #8237 from pguibert6WIND/nhrp_use_zebra_2Mark Stapp
Nhrp use zebra 2
2021-04-30nhrpd: move prototype to top of filePhilippe Guibert
nhrp prototype function was not declared at top of the file. fixing it. 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: clean up SA warning with strncpyPhilippe Guibert
strncpy is replaced by strlcpy. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>