summaryrefslogtreecommitdiffstats
path: root/eigrpd (follow)
Commit message (Collapse)AuthorAgeFilesLines
* *: auto-convert to SPDX License IDsDavid Lamparter2023-02-0946-726/+46
| | | | | | Done with a combination of regex'ing and banging my head against a wall. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* *: introduce function for sequence numbersRafael Zalamena2023-01-201-1/+2
| | | | | | | | | | | | Don't directly use `time()` for generating sequence numbers for two reasons: 1. `time()` can go backwards (due to NTP or time adjustments) 2. Coverity Scan warns every time we truncate a `time_t` variable for good reason (verify that we are Y2K38 ready). Found by Coverity Scan (CID 1519812, 1519786, 1519783 and 1519772) Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
* build, vtysh: extract vtysh commands from .xrefDavid Lamparter2022-10-263-10/+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>
* *: Create and use infrastructure to show debugs in libDonald Sharp2022-10-071-0/+1
| | | | | | | | | 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>
* eigrpd: changes for code maintainabilitysri-mohan12022-09-123-7/+8
| | | | | | these changes are for improving the code maintainability Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
* eigrpd: vrf variable name hides a parameter of the same nameDonald Sharp2022-06-161-4/+4
| | | | | | | vrf is a char * being passed in. Rename the vrf to be something else. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Properly use memset() when zeroingDonatas Abraitis2022-05-113-4/+4
| | | | | | | Wrong: memset(&a, 0, sizeof(struct ...)); Good: memset(&a, 0, sizeof(a)); Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
* *: Fix spelling of ojbectDonald Sharp2022-04-021-2/+2
| | | | Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: Change thread->func to return void instead of intDonald Sharp2022-02-249-53/+39
| | | | | | | 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>
* eigrpd: Up convert to uint64_t before doing mathDonald Sharp2022-02-221-8/+13
| | | | | | | Intentionally up convert uint8_t and uint32_t values to a uint64_t before doing math to make Coverity happy. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* *: rework renaming the default VRFIgor Ryzhov2021-12-212-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-223-4/+4
| | | | | | | 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>
* Merge pull request #10032 from opensourcerouting/build-fix-20211111Donald Sharp2021-11-131-4/+3
|\ | | | | build: assorted build system improvements, 2021-11 edition
| * build: remove some useless intermediate librariesDavid Lamparter2021-11-111-4/+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-6/+6
|/ | | | Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* lib: Add autocomplete for prefix-list under route-mapsDonatas Abraitis2021-10-281-4/+4
| | | | | | | | | | | ``` exit1-debian-9(config-route-map)# match ip route-source prefix-list ? <cr> PREFIXLIST_NAME IP prefix-list name p1 p2 ``` Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
* Merge pull request #9820 from idryzhov/if-nb-configMark Stapp2021-10-261-25/+1
|\ | | | | *: fix interface config write in NB-converted daemons
| * *: fix interface config write in NB-converted daemonsIgor Ryzhov2021-10-251-25/+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-7/+11
|\ \ | |/ |/| *: convert zclient callbacks to table
| * *: convert zclient callbacks to tableDavid Lamparter2021-10-201-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge pull request #9824 from idryzhov/nb-cli-const-lyd-nodeDonald Sharp2021-10-252-42/+60
|\ \ | |/ |/| lib: northbound cli show/cmd functions must not modify data nodes
| * lib: northbound cli show/cmd functions must not modify data nodesIgor Ryzhov2021-10-132-42/+60
| | | | | | | | | | | | | | | | 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>
* | Merge pull request #9715 from idryzhov/cleanup-number-named-aclDonatas Abraitis2021-10-131-12/+4
|\ \ | |/ |/| *: cleanup number-named access-lists in CLI
| * *: cleanup number-named access-lists in CLIIgor Ryzhov2021-10-081-12/+4
| | | | | | | | | | | | | | There's no more difference between number-named and word-named access-lists. This commit removes separate arguments for number-named ACLs from CLI. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* | eigrpd: Ensure better `struct thread *` semanticsDonald Sharp2021-10-046-17/+2
|/ | | | | | | | | | | | 1) 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. 2) Fix mixup of `struct eigrp_interface` and `struct eigrp` usage of the same thread pointer. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* vrf_name_to_id(): removeG. Paul Ziemba2021-09-071-2/+15
| | | | | | | | | vrf_name_to_id() returned VRF_DEFAULT when the vrf name was unknown, hiding errors. Per community recommendation, vrf_name_to_id() is now removed and the few callers now use vrf_lookup_by_name() directly. Signed-off-by: G. Paul Ziemba <paulz@labn.net>
* 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/+1
|\ \ | |/ |/| *: explicitly print "exit" at the end of every node config
| * *: explicitly print "exit" at the end of every node configIgor Ryzhov2021-08-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* *: cleanup interface node installationIgor Ryzhov2021-07-291-12/+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>
* *: unify prefix copyingIgor Ryzhov2021-06-291-1/+1
| | | | | | | | | There are a few places in the code where we use PREFIX_COPY(_IPV4/IPV6) macro to copy a prefix. Let's always use prefix_copy function for this. This should fix CID 1482142 and 1504610. Signed-off-by: Igor Ryzhov <iryzhov@nfware.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>
* lib: adapt to version 2 of libyangChristian Hopps2021-05-131-1/+1
| | | | | | | | | 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>
* eigrpd: fix `distribute-list...` command for EIGRPDonald Sharp2021-05-042-2/+45
| | | | | | | The distribute-list command was being registered but never setup properly in EIGRP. Put it into place. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
* eigrpd: Test for EIGRP AS number and ensure it's the sameDon Slice2021-05-031-3/+8
| | | | | | | When receiving a packet, ensure that the AS number is the same. Fixes: 8515 Signed-off-by: Don Slice <dslice@nvidia.com>
* Merge pull request #8545 from opensourcerouting/assert-our-ownMark Stapp2021-05-031-0/+2
|\ | | | | *: make our own assert() actually work
| * *: make sure `config.h` or `zebra.h` is firstDavid Lamparter2021-04-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | `config.h` has all the defines from autoconf, which may include things that switch behavior of other included headers (e.g. _GNU_SOURCE enabling prototypes for additional functions.) So, the first include in any `.c` file must be either `config.h` (with the appropriate guard) or `zebra.h` (which includes `config.h` first thing.) Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* | eigrpd: validate TLV lengthsMark Stapp2021-04-261-2/+27
|/ | | | | | | Check that incoming TLVS a) don't overrun the incoming packet, b) don't underrun the required size for the type of TLV. Signed-off-by: Mark Stapp <mjs@voltanet.io>
* *: remove *.conf.sample filesQuentin Young2021-04-092-14/+0
| | | | | | | | | | Most of these are many, many years out of date. All of them vary randomly in quality. They show up by default in packages where they aren't really useful now that we use integrated config. Remove them. The useful ones have been moved to the docs. Signed-off-by: Quentin Young <qlyoung@nvidia.com>
* lib, bgpd: add a specific oid_copy function for IPv6 addrsPat Ruddy2021-03-251-2/+1
| | | | | | | Do not overload the v4 oid_copy_addr function for ipv6 coverity does not like this kind of thing. Signed-off-by: Pat Ruddy <pat@voltanet.io>
* eigrpd: kill eigrp_memory.h, use MTYPE_STATICDavid Lamparter2021-03-2216-98/+26
| | | | | | | Same as previous commit -- convert most DEFINE_MTYPE into the _STATIC variant, and move the remaining non-static ones to appropriate places. Signed-off-by: David Lamparter <equinox@diac24.net>
* *: require semicolon after FRR_DAEMON_INFO & co.David Lamparter2021-03-171-1/+2
| | | | | | ... again ... Signed-off-by: David Lamparter <equinox@diac24.net>
* *: require semicolon after DEFINE_QOBJ & co.David Lamparter2021-03-172-3/+3
| | | | | | Again, see previous commits. Signed-off-by: David Lamparter <equinox@diac24.net>
* *: require semicolon after DEFINE_MTYPE & coDavid Lamparter2021-03-172-30/+30
| | | | | | | | | | | | | | | | | 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>
* eigrpd: fix dependency on operational state in cliIgor Ryzhov2021-03-161-12/+11
| | | | Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
* eigrpd: fix xpathsIgor Ryzhov2021-03-161-2/+2
| | | | Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>