Commit graph

84 commits

Author SHA1 Message Date
David Lamparter 8418e57791
Merge pull request #17915 from mjstapp/compile_wshadow 2025-04-09 09:59:06 +02:00
Mark Stapp e636398908 babeld: clean up -Wshadow warnings
Clean up various "shadow" warnings in babeld.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-04-08 14:41:27 -04:00
Jafar Al-Gharaibeh 4281d2b2c7
Merge pull request #18583 from zmw12306/source_port
babeld: check valid babel port
2025-04-08 12:28:58 -05:00
zmw12306 e43dbc8fe1 babeld: Add a check to prevent all-ones case
A router-id MUST NOT consist of either all binary zeroes (0000000000000000 hexadecimal) or all binary ones (FFFFFFFFFFFFFFFF hexadecimal).

Signed-off-by: zmw12306 <zmw12306@gmail.com>
2025-04-05 15:21:27 -04:00
zmw12306 6f88868f32 babeld: check valid babel port
Add checking for port == 6696.

Signed-off-by: zmw12306 <zmw12306@gmail.com>
2025-04-05 15:14:12 -04:00
Y Bharath db8e385752 babeld: Improve code clarity and maintainability
Improve code clarity and maintainability

Signed-off-by: y-bharath14 <y.bharath@samsung.com>
2025-02-10 11:43:05 +05:30
Yaroslav Kholod 58188b5ff8 babel: Clean babel config on babel daemon stop
When deactivating babel no router babel and later re-enabling
it router babel the previous configuration is still in place.

Steps to reproduce:
 - Enable babel
 - Configure babel
 - Disable babel with "no router babel"
 - Verify config

Expected correct behavior: No config present

Signed-off-by: Yaroslav Kholod <y.kholod@vyos.io>
2024-12-20 15:20:59 +02:00
sri-mohan1 53819c298b babeld: changes for code maintainability
these changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2024-09-06 07:02:51 +05:30
Donald Sharp 68fff49056 babeld: Free up memory on shutdown
a) call vector_delete on created vector on shutdown.
b) Call babel_clean_routing_process on shutdown

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-13 14:12:05 -04:00
Igor Ryzhov 5ab02e99b7 babeld: use correct autocompletion for distribute-list commands
Currently, we always use access-list autocompletion, even if configuring
prefix-lists. We should differentiate.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-22 23:49:39 +02:00
Igor Ryzhov 47aa9fe18c babeld: pass distribute ctx to distribute-list functions
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-01-22 23:00:18 +02:00
Christian Hopps a993b8e9bb lib: enable multiple instance support with distribute lists
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-22 11:32:29 +00:00
Donald Sharp 07b91ca096 *: Let's use the native IFNAMSIZ instead of INTERFACE_NAMSIZ
INTERFACE_NAMSIZ is just a redefine of IFNAMSIZ and IFNAMSIZ
is the standard for interface name length on all platforms
that FRR currently compiles on.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-11-21 08:08:29 -05:00
Donald Sharp 161972c9fe *: Rearrange vrf_bitmap_X api to reduce memory footprint
When running all daemons with config for most of them, FRR has
sharpd@janelle:~/frr$ vtysh -c "show debug hashtable"  | grep "VRF BIT HASH" | wc -l
3570

3570 hashes for bitmaps associated with the vrf.  This is a very
large number of hashes.  Let's do two things:

a) Reduce the created size of the actually created hashes to 2
instead of 32.

b) Delay generation of the hash *until* a set operation happens.
As that no hash directly implies a unset value if/when checked.

This reduces the number of hashes to 61 in my setup for normal
operation.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-06-26 14:59:21 -04:00
Russ White c0656e9040
Merge pull request #12837 from donaldsharp/unlikely_routemap
Unlikely routemap
2023-04-04 08:20:25 -04:00
Donald Sharp 332beb64b8 *: Convert thread_cancelXXX to event_cancelXXX
Modify the code base so that thread_cancel becomes event_cancel

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp 907a2395f4 *: Convert thread_add_XXX functions to event_add_XXX
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp e6685141aa *: Rename struct thread to struct event
Effectively a massive search and replace of
`struct thread` to `struct event`.  Using the
term `thread` gives people the thought that
this event system is a pthread when it is not

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp 6a72124df9 babeld, lib, nhrpd: Add likely and unlikely macros
We have 2 competing versions of likely and unlikely
in babeld and nhrpd.  Standardize onto lower case
versions and consolidate in the code.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-23 07:54:56 -04:00
Donald Sharp 8383d53e43
Merge pull request #12780 from opensourcerouting/spdx-license-id
*: convert to SPDX License identifiers
2023-02-17 09:43:05 -05:00
sri-mohan1 03b7208c4c babeld: changes for code maintainability
These changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2023-02-14 15:59:29 +05:30
David Lamparter acddc0ed3c *: auto-convert to SPDX License IDs
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 14:09:11 +01:00
Donald Sharp 403081e12a babeld: The function is already a pointer
Don't send the address of in.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-01-28 09:31:52 -05:00
Yuxiang Zhu 9affd46417 babeld: Add missing no commands
Some babeld commands doesn't have the corresponding negative commands
defined, so those commands doesn't work with frr-reload.py.

This PR adds those missing commands.

Signed-off-by: Yuxiang Zhu <vfreex@gmail.com>
2023-01-21 03:33:03 +08:00
Rafael Zalamena 3682bd90f3 *: use FRR interface name definition everywhere
Don't rely on the OS interface name length definition and use the FRR
definition instead.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2022-05-02 13:00:12 -03:00
Donald Sharp cc9f21da22 *: Change thread->func to return void instead of int
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-02-23 19:56:04 -05:00
Donatas Abraitis c60dec369a lib: Add autocomplete for access-lists
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-10-31 20:26:06 +02:00
David Lamparter 8268be3d16
Merge pull request #9496 from idryzhov/vrf-cmd-init-unused-arg
lib: remove unused argument from vrf_cmd_init
2021-08-27 10:39:45 +02:00
Igor Ryzhov cfc369c43a lib: remove unused argument from vrf_cmd_init
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-08-26 12:01:22 +03:00
Igor Ryzhov 07679ad98a *: explicitly print "exit" at the end of every node config
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-23 22:08:20 +03:00
Igor Ryzhov f5eef2d5a8 lib: remove vrf-interface config when removing the VRF
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-06-21 18:04:46 +03:00
Donald Sharp 32282a6ecf babeld: Allow babeld to actually register to use distribute-list
The `distribute-list` commands were registered but never setup
properly to work.  Put the commands in place.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-05-04 16:23:37 -04:00
David Lamparter bf8d3d6aca *: require semicolon after DEFINE_MTYPE & co
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-17 06:18:17 +01:00
Donald Sharp 5c997d2916 babeld: We do not need to put Warning into our warning messages
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-03-14 22:56:07 +01:00
Mark Stapp b3d6bc6ef0 * : update signature of thread_cancel api
Change thread_cancel to take a ** to an event, NULL-check
before dereferencing, and NULL the caller's pointer. Update
many callers to use the new signature.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-10-23 08:59:34 -04:00
Rafael Zalamena 5920b3eb38 *: replace all random() calls
Replace all `random()` calls with a function called `frr_weak_random()`
and make it clear that it is only supposed to be used for weak random
applications.

Use the annotation described by the Coverity Scan documentation to
ignore `random()` call warnings.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2020-04-17 20:57:43 -03:00
David Lamparter f4b8291fcb *: move CLI node names to cmd_node->name
And again for the name.  Why on earth would we centralize this, just so
people can forget to update it?

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:59 +02:00
David Lamparter 243895805a *: move CLI parent data to cmd_node->parent_node
Same as before, instead of shoving this into a big central list we can
just put the parent node in cmd_node.

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
David Lamparter 612c2c15d8 *: remove second parameter on install_node()
There is really no reason to not put this in the cmd_node.

And while we're add it, rename from pointless ".func" to ".config_write".

[v2: fix forgotten ldpd config_write]

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
David Lamparter 249a771b63 *: remove cmd_node->vtysh
The only nodes that have this as 0 don't have a "->func" anyway, so the
entire thing is really just pointless.

Signed-off-by: David Lamparter <equinox@diac24.net>
2020-04-16 12:53:00 +02:00
Donatas Abraitis 0d6f7fd6fd *: Replace sizeof something to sizeof(something)
Satisfy checkpatch.pl requirements (check for sizeof without parenthesis)

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-08 21:44:53 +02:00
Donald Sharp be04d1487f babeld: GCC complaining about no return in non-void function
The babel_main_loop function did not have a return for
a non-void function.  For some reason gcc is starting to complain
about this now.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2020-02-13 08:44:40 -05:00
Quentin Young b3ba5dc7fe *: don't null after XFREE; XFREE does this itself
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-02-03 11:22:13 -05:00
Donald Sharp a36898e755
Revert "Ospf missing interface handling 2" 2019-06-23 19:46:39 -04:00
Donald Sharp a12bb225a6
Merge pull request #3775 from pguibert6WIND/ospf_missing_interface_handling_2
Ospf missing interface handling 2
2019-06-22 13:35:45 -04:00
David Lamparter 8b7454e9c2 babeld: use MTYPE_STATIC
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2019-06-21 08:54:25 +02:00
Philippe Guibert f11e98eca3 *: change if_lookup_by_name() api with vrf
the vrf_id parameter is replaced by struct vrf * parameter.
this impacts most of the daemons that look for an interface based on the
name and the vrf identifier.
Also, it fixes 2 lookup calls in zebra and sharpd, where the vrf_id was
ignored until now.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2019-06-12 08:37:54 +02:00
Ruben Kerkhof 4d762f2607 Treewide: use ANSI function definitions
Signed-off-by: Ruben Kerkhof <ruben@rubenkerkhof.com>
2019-01-24 11:21:59 +01:00
Philippe Guibert 03a38493f8 lib, rip, ripng, babel, eigrp: add ctx pointer to distribute api
a distribute_ctx context pointer is returned after initialisation to the
calling daemon. this context pointer will be further used to do
discussion with distribute service. Today, there is no specific problem
with old api, since the pointer is the same in all the memory process.
but the pointer will be different if we have multiple instances. Right
now, this is not the case, but if that happens, that work will be used
for that.
distribute-list initialisation is split in two. the vty initialisation
is done at global level, while the context initialisation is done for
each routing daemon instance.
babel daemon is being equipped with a routing returning the main babel
instance.
also, a delete routine is available when the daemon routing instance is
suppressed.
a list of contexts is used inside distribute_list. This will permit
distribute_list utility to handle in the same daemon to handle more than
one context. This will be very useful in the vrf context.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2018-12-28 18:18:40 +01:00
Quentin Young 450971aa99 *: LIB_[ERR|WARN] -> EC_LIB
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-13 19:34:28 +00:00