Commit graph

342 commits

Author SHA1 Message Date
Donald Sharp
664660cc97 babeld: Declarations should have variable names
Our coding standard is that all function declarations
should have actual function names.  Let's try to clean
up all that is missing this in babeld.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-11-07 10:54:55 -05:00
Donald Sharp
c05e7b1ca2 *: Stop using thread as a variable name
The code went through a conversion from naming events
'thread' to 'event' a couple of years ago.  At this
time we still have a non-trivial number of vestigal
references to a `struct event *thread` let's go ahead
and convert them in mass to `struct event *event`.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-11-03 14:27:17 -05:00
Donald Sharp
0bbe9b16d7 babeld: MESSAGE_REQUEST does not send a seqno
Testing for a Sequence number in the sent message makes
no sense as that a MESSAGE_REQUEST never attempts to
send this data.  Additionally there is no need to test
for this because this code does not read past it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-10-09 15:14:09 -04:00
Mark Stapp
d970392f41 babeld,vnc,eigrp,nhrpd: use zclient route_init api
Replace raw memset of zapi_route struct with zapi init api.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-09-03 14:14:14 -04:00
Donald Sharp
755a879be5 *: Convert proto_redistnum to return a uint8_t
There are places that we are playing fast and loose
with signed -vs- unsigned integers.  Let's convert
proto_redistnum to only return a uint8_t.  Find
and fix all the places that matter.  This was
found by coverity.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-08-20 09:31:15 -04:00
Donald Sharp
9fb545253e babeld: Align with checkpatch
Make babeld use checkpatch.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-06-12 11:41:46 -04:00
Donald Sharp
4aaab9d28a babeld: Convert all code to use our code formatting rules
The babeld code was originally kept in a non-standard
format, at least to how FRR formats code, because the
code came from outside the project and it was hoped
that updates would be coming from the originators.
That has not turned out to be true and we've been slowly
getting bug-fixes for the code over the last year
as it is being used.  Let's just bite the bullet
and convert over to our internal format for consistency.

Signed-off-by: Donald Sharp <donaldsharp72@gmail.com>
2025-06-12 11:36:22 -04:00
Mark Stapp
098d692b6f *: expose and clean up 'noreturn' functions
Enable the -Wmissing-noreturn warning, and resolve warnings
for gcc and clang. Add a FRR_NORETURN macro and use that for
the new changes.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-04-24 13:41:23 -04:00
Donald Sharp
2c37a21743
Merge pull request #16735 from zmw12306/babel_nonzeroMBZ
babeld: Add MBZ and Reserved field checking
2025-04-11 08:42:45 -04:00
Jafar Al-Gharaibeh
fc3e1ec15f
Merge pull request #18472 from zmw12306/Update-TLV
babeld: Add input validation for update TLV.
2025-04-10 09:59:13 -05:00
Jafar Al-Gharaibeh
2355683c72
Merge pull request #18548 from zmw12306/request_subtlv_type
babeld: fix incorrect type assignment in parse_request_subtlv
2025-04-10 09:56:14 -05:00
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
Russ White
e9e9b2ba7e
Merge pull request #18585 from zmw12306/babel-knownae
babel: fix incorrect check in known_ae()
2025-04-08 10:55:24 -04:00
Russ White
9f59a2d05c
Merge pull request #18584 from zmw12306/babel_get_myid
babeld: Add a check to prevent all-ones case
2025-04-08 10:54:50 -04:00
Russ White
53a8868331
Merge pull request #18582 from zmw12306/route_lost
babeld: Fix starvation handling on route loss per RFC 8966 §3.8.2.1
2025-04-08 10:52:39 -04:00
Russ White
59b62ca788
Merge pull request #18581 from zmw12306/request_forward
babeld: Request forwarding does not prioritize feasible routes
2025-04-08 10:52:08 -04:00
Russ White
28d66ef7f1
Merge pull request #18547 from zmw12306/Hop-Count
babeld: Hop Count must not be 0.
2025-04-08 10:31:01 -04:00
zmw12306
16a0458dbc babel: fix incorrect check in known_ae()
The known_ae() function accepts AE values up to 4, but the RFC only defines AE values 0-3.

Signed-off-by: zmw12306 <zmw12306@gmail.com>
2025-04-05 15:24:06 -04: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
zmw12306
8a8c43c891 babeld: Fix starvation handling on route loss per RFC 8966 §3.8.2.1
When all feasible routes to a destination are lost, but unexpired unfeasible routes exist, the node MUST send a seqno request to prevent starvation.

Signed-off-by: zmw12306 <zmw12306@gmail.com>
2025-04-05 14:26:32 -04:00
zmw12306
49f6e9a385 babeld: Request forwarding does not prioritize feasible routes
Modify route selection to check feasibility first, then fall back to non-feasible routes as per SHOULD requirement.

Signed-off-by: zmw12306 <zmw12306@gmail.com>
2025-04-05 14:00:41 -04:00
Russ White
ec1fcc1799
Merge pull request #18470 from zmw12306/NH_Init
babeld: Add next hop initialization
2025-04-01 10:13:11 -04:00
zmw12306
1571607c6b babeld: fix incorrect type assignment in parse_request_subtlv
parse_request_subtlv accesses type using fixed offset instead of current position.

Signed-off-by: zmw12306 <zmw12306@gmail.com>
2025-03-31 00:08:38 -04:00
zmw12306
2b2bebfa92 babeld: Hop Count must not be 0.
According to RFC 8966:
Hop Count The maximum number of times that this TLV may be forwarded, plus 1. This MUST NOT be 0.

Signed-off-by: zmw12306 <zmw12306@gmail.com>
2025-03-31 00:01:53 -04:00
zmw12306
c2e69624ba babeld: Add input validation for update TLV.
1. If the metric is infinite and AE is 0, Plen and Omitted MUST both be 0
2. Use INFINITY to replace 0xFFFF
3. Ignore unkown ae
4. If the metric field if 0xFFFF, a retraction happens So it is acceptable for no router_id when metric is 0xFFFF while ae is not 0.

Signed-off-by: zmw12306 <zmw12306@gmail.com>
2025-03-31 00:01:30 -04:00
Donald Sharp
fbdce3358e *: Ensure prefix lists are freed on shutdown.
Several daemons were not calling prefix_list_reset
to clean up memory on shutdown.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-03-30 17:00:38 -04:00
Donatas Abraitis
03d0a27418
Merge pull request #18448 from Shbinging/fix_babel_hello_interval
babeld: fix hello packets not sent with configured hello timer
2025-03-26 10:37:58 +02:00
Russ White
053aeaf58b
Merge pull request #18474 from zmw12306/Hop-Count
babeld: Hop Count must not be 0.
2025-03-25 10:38:23 -04:00
Donald Sharp
ab6d15b42b
Merge pull request #18471 from zmw12306/NH-TLV
babeld: add check incorrect AE value for NH TLV.
2025-03-25 09:03:16 -04:00
Shbinging
3c7a635722 babeld: fix hello packets not sent with configured hello timer
Same issue occurring as previously addressed in https://github.com/FRRouting/frr/pull/9092. The root cause is: "Sending a Hello message before restarting the hello timer to avoid session flaps in case of larger hello interval configurations."

Signed-off-by: Shbinging <bingshui@smail.nju.edu.cn>
2025-03-25 20:14:34 +08:00
zmw12306
eea39974ad babeld: add check incorrect AE value for NH TLV.
According to RFC 8966, for NH TLV, AE SHOULD be 1 (IPv4) or 3 (link-local IPv6), and MUST NOT be 0.
Signed-off-by: zmw12306 <zmw12306@gmail.com>
2025-03-24 15:55:08 -04:00
zmw12306
3b5d421207 babeld: Hop Count must not be 0.
According to RFC 8966:
Hop Count The maximum number of times that this TLV may be forwarded, plus 1. This MUST NOT be 0.
Signed-off-by: zmw12306 <zmw12306@gmail.com>
2025-03-24 15:32:18 -04:00
zmw12306
7c48a717f0 babeld: Missing Validation for AE=0 and Plen!=0
A Request TLV with AE set to 0 and Plen not set to 0 MUST be ignored.
Signed-off-by: zmw12306 <zmw12306@gmail.com>
2025-03-23 22:37:59 -04:00
zmw12306
a031da53db babeld: Add next hop initialization
Initialize v4_nh/v6_nh from source address at the beginning of packet parsing
Signed-off-by: zmw12306 <zmw12306@gmail.com>
2025-03-23 19:02:14 -04:00
zmw12306
476cf0e1fc babeld: babeld: Add MBZ and Reserved field checking
Signed-off-by: zmw12306 <zmw12306@gmail.com>
2025-03-23 15:33:21 -04:00
Shbinging
6af2af83be babled: set wired/wireless internal only when wired/wireless status changes
As stated in doc, interface's attributes such noninterfering/interfering are reset when the wired/wireless status of an interface is changed. If wired/wireless status is not changed, such as wired->wired, we should not reset internal attributes.

Signed-off-by: Shbinging <bingshui@smail.nju.edu.cn>
2025-03-18 10:38:12 +08: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
a05c6af88f babel: Clean babel related config on 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>
2025-01-02 13:15:45 +02:00
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
63e2c092a3 babeld: Do not remove route when replacing
When sending down a babel route do not remove then
add it back.  Just send down the change.  This
change will not cause packets to be dropped now.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-22 10:24:42 -04:00
Donald Sharp
b4c88abe9f babeld: Send the route's metric down to zebra.
Babel was thinking it was talking to the kernel for
route installation instead of zebra.  Pass down the
metric instead.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-22 10:22:58 -04:00
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
Y Bharath
ae885a7e7f babel: Added null check after retrieving babel_ifp
Asserting the further instructions when the babel interface pointer is
NULL

Signed-off-by: y-bharath14 <y.bharath@samsung.com>
2024-07-10 13:44:22 +05:30
sri-mohan1
c8287d97db 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-02-20 00:25:27 +05:30
sri-mohan1
21b7f32a2c 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-02-14 00:00:31 +05:30
Mark Stapp
72b31b96fc *: create a single registry of daemons' default port values
Create a single registry of default port values that daemons
are using. Most of these are vty ports, but there are some
others for features like ospfapi and zebra FPM.

Signed-off-by: Mark Stapp <mjs@labn.net>
2024-02-01 11:40:02 -05:00