Commit graph

308 commits

Author SHA1 Message Date
Mark Stapp 27ba9956a1 lib,ripd: resolve clang SA warnings
Looks like there were a couple of SA warnings lurking; fix
them.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-04-08 14:41:27 -04:00
Donald Sharp 735809756f ripd: Use route_node_match instead of route_node_match_ipv4
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-11-25 13:12:10 -05:00
anlan_cs c0b6095856 ripd: adjust header for display command
Continue to adjust `show ip rip` 's header for display comand.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2024-07-05 09:32:50 +08:00
T-Nicolas 1a64fe4254
ripd: Change the start value of sequence 1 to 0
Signed-off-by: T-Nicolas <github@toselli.email>
2024-06-27 10:42:48 +02:00
Igor Ryzhov dbaf05ae3d ripd: convert RPC commands to mgmtd
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-04-22 16:36:23 +03:00
Igor Ryzhov 58a8ebc1fc lib: rework northbound RPC callback
Change input/output arguments of the RPC callback from lists of
(xpath/value) tuples to YANG data trees.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-04-22 16:36:22 +03:00
Igor Ryzhov 1ba97510e2 ripd: fix "clear ip rip" command
mgmtd doesn't support YANG RPCs yet, so this command must go directly to
ripd.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-03-09 00:00:12 +02:00
Christian Hopps 83abe9c3cb ripd: ripd convert to mgmtd
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-26 12:34:46 -05:00
Christian Hopps 8f7a9355f2 ripd: use new distribute-list northbound code.
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-01-22 11:33:33 +00:00
Donald Sharp 2bf051a577 *: Remove Crypto openSSL define from zebra.h
Only a couple of places use this.  Move these to a better
spot.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-04 14:02:34 -05:00
David Lamparter 8b23c0b0bd *: convert struct interface->connected to DLIST
Replace `struct list *` with `DLIST(if_connected, ...)`.

NB: while converting this, I found multiple places using connected
prefixes assuming they were IPv4 without checking:

- vrrpd/vrrp.c: vrrp_socket()
- zebra/irdp_interface.c: irdp_get_prefix(), irdp_if_start(),
  irdp_advert_off()

(these fixes are really hard to split off into separate commits as that
would require going back and reapplying the change but with the old list
handling)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-22 23:00:30 +01:00
Donald Sharp 6de9f7fbf5 *: Move distance related defines into their own header
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-11-07 06:47:51 -05:00
Igor Ryzhov 054ca9b9ee Revert "ripd: Cleanup memory allocations on shutdown"
This reverts commit 3d1588d8ed.

This commit introduced a crash. When the VRF is deleted, the RIP instance
should not be freed, because the NB infrastructure still stores the
pointer to it. The instance should be deleted only when it's actually
deleted from the configuration.

To reproduce the crash:
```
frr# conf t
frr(config)# vrf vrf1
frr(config-vrf)# exit
frr(config)# router rip vrf vrf1
frr(config-router)# exit
frr(config)# no vrf vrf1
frr(config)# no router rip vrf vrf1
vtysh: error reading from ripd: Resource temporarily unavailable (11)Warning: closing connection to ripd because of an I/O error!
frr(config)#
```

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2023-06-15 17:43:40 +03:00
Donald Sharp 907183cb35
Merge pull request #13430 from opensourcerouting/feature/rip_allow-ecmp_limit
ripd: Implement allow-ecmp X command
2023-05-11 20:31:46 -04:00
Renato Westphal 76f444a5d3 ripd: fix another memtype mismatch
Fixes #13447.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2023-05-08 12:30:50 -03:00
Donatas Abraitis 75fce4645a ripd: Implement allow-ecmp X command
Allow setting an arbitrary number of paths to be installed instead of ALL.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-05-04 15:43:02 +03:00
Donatas Abraitis da57946b0e
Merge pull request #13366 from zmw12306/rte_tag
ripd: add non-zero check for RIPv1 reserved field
2023-05-02 17:56:09 +03:00
zmw12306 762f54f088 ripd: add non-zero check for RIPv1 reserved field,
According to RFC2453 3.6, the tag of a RIP-1 entry should be zero
Signed-off-by: zmw12306 <zmw12306@gmail.com>
2023-04-25 15:17:01 -04:00
Renato Westphal c262df828b ripd: support BFD integration
Implement RIP peer monitoring with BFD.

RFC 5882 Generic Application of Bidirectional Forwarding Detection
(BFD), Section 10.3 Interactions with RIP.

Co-authored-by: Renato Westphal <renato@opensourcerouting.org>
Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2023-04-19 09:15:01 -03:00
Igor Ryzhov 1d1f77b60d lib: convert if_rmap config output to northbound
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2023-04-12 17:17:03 +03:00
anlan_cs b769fdc88b ripd: Simplify code for distance
Simplify the code for `rip_distance_apply()`.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2023-04-10 15:53:07 +08:00
anlan_cs fa9307852e ripd: Correct one debug log
Correct one debug log, which wrongly mixed address and port.

Before:
```
ripd[469497]: [NDAGH-Z85V7] rip_send_packet 3.3.3.4 > 224.0.0.9 (enp1s0)
ripd[469497]: [VEJY5-67P5X] SEND to 224.0.0.9520
```
After:
```
ripd[471330]: [NDAGH-Z85V7] rip_send_packet 3.3.3.4 > 224.0.0.9 (enp1s0)
ripd[471330]: [T8DFR-P09JH] SEND to 224.0.0.9 port 520
```

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2023-04-10 11:11:30 +08:00
Donald Sharp 24a58196dd *: Convert event.h to frrevent.h
We should probably prevent any type of namespace collision
with something else.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp e16d030c65 *: Convert THREAD_XXX macros to EVENT_XXX macros
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp 4f830a0799 *: Convert thread_timer_remain_XXX to event_timer_remain_XXX
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 cb37cb336a *: Rename thread.[ch] to event.[ch]
This is a first in a series of commits, whose goal is to rename
the thread system in FRR to an event system.  There is a continual
problem where people are confusing `struct thread` with a true
pthread.  In reality, our entire thread.c is an event system.

In this commit rename the thread.[ch] files to event.[ch].

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:16 -04:00
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 3d1588d8ed ripd: Cleanup memory allocations on shutdown
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-10-12 07:39:23 -04:00
Donatas Abraitis 7139b1aeae
Merge pull request #11898 from sri-mohan1/sri-rip-dbg1
ripd: changes for code maintainability
2022-09-04 21:18:12 +03:00
sri-mohan1 99404729cf ripd: changes for code maintainability
these changes are for improving the code maintainability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2022-09-03 00:02:59 +05:30
Donald Sharp 1568e88a8e ripd: Use a sequence number instead of time
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-08-24 08:30:42 -04:00
Donald Sharp f6499a7608 ripd: Convert thread_cancel to THREAD_OFF
Just convert all uses of thread_cancel to THREAD_OFF

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-07-21 08:27:35 -04:00
Donald Sharp 580e37a3fa ripd: Remove various macros that overlap THREAD_OFF
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>
2022-07-21 08:27:35 -04:00
Donatas Abraitis 6006b807b1 *: Properly use memset() when zeroing
Wrong: memset(&a, 0, sizeof(struct ...));
    Good:  memset(&a, 0, sizeof(a));

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-11 14:08:47 +03:00
Donatas Abraitis f51eeb864b ripd: Use correct usage of memcpy() when zeroing struct
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-05-11 14:08:46 +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
Russ White af768d506f
Merge pull request #10593 from donaldsharp/rip_cleanup
ripd: Cleanup ripd.c indentation levels and comments
2022-02-22 11:30:36 -05:00
Donald Sharp 91b508dc2c ripd: Cleanup ripd.c indentation levels and comments
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>
2022-02-16 08:11:00 -05:00
Donald Sharp 114918bd0b ripd: Fix packet send for non primary addresses
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>
2022-02-15 20:02:21 -05:00
Igor Ryzhov ac2cb9bf94 *: rework renaming the default VRF
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-21 22:09:29 +03:00
Donald Sharp 64da2e8ecd ripd: Ensure better struct thread * semantics
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>
2021-10-04 09:36:54 -04:00
schylar ab9939f217 ripd: Fix spelling errors
Signed-off-by: schylar <schylarutley@hotmail.com>
2021-09-07 08:30:42 -05: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 b5b4f44eb3 ripd: fix authentication key length
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>
2021-07-27 11:23:36 +03:00
Donatas Abraitis 12256b84a5 *: Convert numeric 32 into IPV4_MAX_BITLEN for prefixlen
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-07-01 23:50:39 +03:00
Donatas Abraitis 936fbaef47 *: Replace IPV4_MAX_PREFIXLEN to IPV4_MAX_BITLEN
Just drop IPV4_MAX_PREFIXLEN at all, no need keeping both.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2021-07-01 17:44:09 +03:00