summaryrefslogtreecommitdiffstats
path: root/ripd (follow)
Commit message (Collapse)AuthorAgeFilesLines
* build, vtysh: extract vtysh commands from .xrefDavid Lamparter2022-10-262-7/+0
| | | | | | | | | | | | | | | | | | | 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>
* ripd: Cleanup memory allocations on shutdownDonald Sharp2022-10-121-0/+8
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Create and use infrastructure to show debugs in libDonald Sharp2022-10-071-0/+2
| | | | | | | | | 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>
* Merge pull request #11898 from sri-mohan1/sri-rip-dbg1Donatas Abraitis2022-09-041-11/+9
|\ | | | | ripd: changes for code maintainability
| * ripd: changes for code maintainabilitysri-mohan12022-09-021-11/+9
| | | | | | | | | | | | these changes are for improving the code maintainability Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
* | ripd: Use a sequence number instead of timeDonald Sharp2022-08-241-1/+2
|/ | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* ripd: Convert thread_cancel to THREAD_OFFDonald Sharp2022-07-213-3/+3
| | | | | | Just convert all uses of thread_cancel to THREAD_OFF Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* ripd: Remove various macros that overlap THREAD_OFFDonald Sharp2022-07-214-28/+25
| | | | | | | | Let's just use THREAD_OFF consistently in the code base instead of each daemon having a special macro that needs to be looked at and remembered what it does. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Use autocomplete for route-maps under commands that require itDonatas Abraitis2022-06-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | For example: ``` donatas-laptop# show bgp ipv4 unicast neighbors 127.0.0.2 advertised-routes route-map ? RMAP_NAME Name of the route map testas2 testas donatas-laptop(config)# router bgp donatas-laptop(config-router)# address-family ipv4 donatas-laptop(config-router-af)# redistribute connected route-map ? RMAP_NAME Pointer to route-map entries testas2 testas donatas-laptop(config-router-af)# network 192.168.0.0/23 route-map ? RMAP_NAME Name of the route map testas2 testas ``` Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* *: Properly use memset() when zeroingDonatas Abraitis2022-05-114-10/+10
| | | | | | | Wrong: memset(&a, 0, sizeof(struct ...)); Good: memset(&a, 0, sizeof(a)); Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* ripd: Use correct usage of memcpy() when zeroing structDonatas Abraitis2022-05-111-4/+3
| | | | Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* *: Fix spelling of modifedDonald Sharp2022-04-191-2/+2
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Fix spelling of strucutreDonald Sharp2022-04-191-1/+1
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Fix spelling of IntefaceDonald Sharp2022-04-021-3/+3
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Fix spelling of ojbectDonald Sharp2022-04-021-2/+2
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Fix spelling of wetherDonald Sharp2022-04-021-4/+4
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Change thread->func to return void instead of intDonald Sharp2022-02-243-40/+25
| | | | | | | 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>
* Merge pull request #10593 from donaldsharp/rip_cleanupRuss White2022-02-221-540/+510
|\ | | | | ripd: Cleanup ripd.c indentation levels and comments
| * ripd: Cleanup ripd.c indentation levels and commentsDonald Sharp2022-02-161-540/+510
| | | | | | | | | | | | | | | | The entirety of this file is heavily indented. Work some coding structure to make it easier to read and understand and not be so heavily indented. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* | ripd: Fix packet send for non primary addressesDonald Sharp2022-02-161-0/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | When rip is configured to work on secondary addresses on an interface, rip was not properly sending out the packets on secondary addresses because the source of the packet was never properly being setup and rip would send the packet out multiple times for the primary address not once for each address on the interface that is setup to work. tcpdump + rip debugs output with fix: 2022/02/15 19:59:50 RIP: [ZG173-BHW0K] turn on virbr0 2022/02/15 19:59:51 RIP: [PYB7S-80D89] multicast join at virbr0 2022/02/15 19:59:51 RIP: [GZR24-FCQGG] multicast request on virbr0 2022/02/15 19:59:51 RIP: [JTNCV-XD8S1] rip_send_packet 192.168.122.1 > 224.0.0.9 (virbr0) 2022/02/15 19:59:51 RIP: [VEJY5-67P5X] SEND to 224.0.0.9520 2022/02/15 19:59:51 RIP: [JTNCV-XD8S1] rip_send_packet 73.3.3.8 > 224.0.0.9 (virbr0) 2022/02/15 19:59:51 RIP: [VEJY5-67P5X] SEND to 224.0.0.9520 19:59:51.831128 IP 192.168.122.1.route > rip2-routers.mcast.net.route: RIPv2, Request, length: 24 19:59:51.831161 IP c-73-3-3-8.hsd1.mo.comcast.net.route > rip2-routers.mcast.net.route: RIPv2, Request, length: 24 Fixes: #10588 Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: rework renaming the default VRFIgor Ryzhov2021-12-211-39/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* *: cleanup ifp->vrf_idIgor Ryzhov2021-11-221-33/+21
| | | | | | | 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>
* *: clean up ifp-by-local-address function(s)David Lamparter2021-11-171-1/+1
| | | | | | | | | | | | | 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>
* Merge pull request #10032 from opensourcerouting/build-fix-20211111Donald Sharp2021-11-131-6/+3
|\ | | | | build: assorted build system improvements, 2021-11 edition
| * build: remove some useless intermediate librariesDavid Lamparter2021-11-111-6/+3
| | | | | | | | | | | | | | These really serve no purpose other than slowing our build down. If there's a benefit to any of these, they can be readded. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | *: Convert quagga_signal_X to frr_signal_XDonald Sharp2021-11-111-1/+1
| | | | | | | | | | | | | | Naming functions/data structures more appropriately for the project we are actually in. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* | lib: Add autocomplete for access-listsDonatas Abraitis2021-10-311-3/+3
|/ | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* Merge pull request #9820 from idryzhov/if-nb-configMark Stapp2021-10-261-28/+1
|\ | | | | *: fix interface config write in NB-converted daemons
| * *: fix interface config write in NB-converted daemonsIgor Ryzhov2021-10-251-28/+1
| | | | | | | | | | | | | | | | | | When writing the config from the NB-converted daemon, we must not rely on the operational data. This commit changes the output of the interface configuration to use only config data. As the code is the same for all daemons, move it to the lib and remove all the duplicated code. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | Merge pull request #9854 from opensourcerouting/zapi-call-tableRuss White2021-10-261-6/+10
|\ \ | |/ |/| *: convert zclient callbacks to table
| * *: convert zclient callbacks to tableDavid Lamparter2021-10-201-6/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | lib: northbound cli show/cmd functions must not modify data nodesIgor Ryzhov2021-10-132-48/+58
|/ | | | | | | | To ensure this, add a const modifier to functions' arguments. Would be great do this initially and avoid this large code change, but better late than never. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* ripd: Ensure better `struct thread *` semanticsDonald Sharp2021-10-043-14/+0
| | | | | | | | | Do not explicitly set the thread pointer to NULL. 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: Donald Sharp <sharpd@nvidia.com>
* ripd: Fix spelling errorsschylar2021-09-071-2/+2
| | | | Signed-off-by: schylar <schylarutley@hotmail.com>
* Merge pull request #9496 from idryzhov/vrf-cmd-init-unused-argDavid Lamparter2021-08-271-1/+1
|\ | | | | lib: remove unused argument from vrf_cmd_init
| * lib: remove unused argument from vrf_cmd_initIgor Ryzhov2021-08-261-1/+1
| | | | | | | | Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | Merge pull request #9331 from idryzhov/explicit-exitChristian Hopps2021-08-261-0/+2
|\ \ | |/ |/| *: explicitly print "exit" at the end of every node config
| * *: explicitly print "exit" at the end of every node configIgor Ryzhov2021-08-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | *: Drop `break` after using frr_help_exit() in switch/caseDonatas Abraitis2021-08-251-1/+0
|/ | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* bgpd: Fix misleading comments for some partsDonatas Abraitis2021-08-051-1/+1
| | | | | | Mostly just retrun => return and misleading comments at all. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* Merge pull request #9191 from idryzhov/rip-authRuss White2021-08-031-4/+8
|\ | | | | ripd: fix authentication key length
| * ripd: fix authentication key lengthIgor Ryzhov2021-07-271-4/+8
| | | | | | | | | | | | | | | | We were overwriting the last byte of the key when it's exactly 16 bytes. Fixes #8151. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | *: cleanup interface node installationIgor Ryzhov2021-07-291-11/+1
|/ | | | | | | | | 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>
* build: fix `AM_LDFLAGS` usage (and gcov)David Lamparter2021-07-211-1/+1
| | | | | | | | | | | | | | | | like the other automake variables, setting `xyz_LDFLAGS` causes `AM_LDFLAGS` to be ignored for `xyz`. For some reason I had in my mind that automake doesn't do this for LDFLAGS, but... it does. (Which is consistent with `_CFLAGS` and co.) So, all the libraries and modules have been ignoring `AM_LDFLAGS` (which includes `SAN_FLAGS` too). Set up new `LIB_LDFLAGS` and `MODULE_LDFLAGS` to handle all of this correctly (and move these bits to a central location.) Fixes: #9034 Fixes: 0c4285d77eb ("build: properly split CFLAGS from AC_CFLAGS") Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: Convert numeric 32 into IPV4_MAX_BITLEN for prefixlenDonatas Abraitis2021-07-011-1/+2
| | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* *: Replace IPV4_MAX_PREFIXLEN to IPV4_MAX_BITLENDonatas Abraitis2021-07-012-2/+2
| | | | | | Just drop IPV4_MAX_PREFIXLEN at all, no need keeping both. Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* lib: remove vrf-interface config when removing the VRFIgor Ryzhov2021-06-211-0/+2
| | | | | | | | | | | | | | | | | | | | | | | 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>
* northbound: KISS always batch yang config (file read), it's fasterChristian Hopps2021-06-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The backoff code assumed that yang operations always completed quickly. It checked for > 100 YANG modeled commands happening in under 1 second to enable batching. If 100 yang modeled commands always take longer than 1 second batching is never enabled. This is the exact opposite of what we want to happen since batching speeds the operations up. Here are the results for libyang2 code without and with batching. | action | 1K rts | 2K rts | 1K rts | 2K rts | 20k rts | | | nobatch | nobatch | batch | batch | batch | | Add IPv4 | .881 | 1.28 | .703 | 1.04 | 8.16 | | Add Same IPv4 | 28.7 | 113 | .590 | .860 | 6.09 | | Rem 1/2 IPv4 | .376 | .442 | .379 | .435 | 1.44 | | Add Same IPv4 | 28.7 | 113 | .576 | .841 | 6.02 | | Rem All IPv4 | 17.4 | 71.8 | .559 | .813 | 5.57 | (IPv6 numbers are basically the same as iPv4, a couple percent slower) Clearly we need this. Please note the growth (1K to 2K) w/o batching is non-linear and 100 times slower than batched. Notes on code: The use of the new `nb_cli_apply_changes_clear_pending` is to commit any pending changes (including the current one). This is done when the code would not correctly handle a single diff that included the current changes with possible following changes. For example, a "no" command followed by a new value to replace it would be merged into a change, and the code would not deal well with that. A good example of this is BGP neighbor peer-group changing. The other use is after entering a router level (e.g., "router bgp") where the follow-on command handlers expect that router object to now exists. The code eventually needs to be cleaned up to not fail in these cases, but that is for future NB cleanup. Signed-off-by: Christian Hopps <chopps@labn.net>
* ripd: fix interface wakeup after shutdownIgor Ryzhov2021-05-171-0/+3
| | | | | | | | | | | | | | | | | RIP schedules a call to `rip_interface_wakeup` in 1 second after receiving the interface UP event from zebra. The function is called even if the interface was shut down during this interval. This is incorrect and also leads to a crash in the following scenario: ``` vtysh -c "conf" -c "router rip vrf red" -c "network enp2s0" ip link add red type vrf table 1 ip link set enp2s0 vrf red ip link set enp2s0 down ip link set enp2s0 up && ip link del red ``` Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* lib: adapt to version 2 of libyangChristian Hopps2021-05-133-12/+12
| | | | | | | | | Compile with v2.0.0 tag of `libyang2` branch of: https://github.com/CESNET/libyang staticd init load time of 10k routes now 6s vs ly1 time of 150s Signed-off-by: Christian Hopps <chopps@labn.net>