Commit graph

31325 commits

Author SHA1 Message Date
Donald Sharp 328b64fcb5
Merge pull request #13119 from mjstapp/fix_mgmt_proto_makefile
build: clean up mgmtd lib protobuf make syntax
2023-03-28 06:35:19 -04:00
Mark Stapp 9b8f605bbb build: clean up mgmtd lib protobuf make syntax
Fix the makefile rules for the new mgmtd lib module that's
generated from a protobuf spec file.

Signed-off-by: Mark Stapp <mjs@labn.net>
2023-03-27 16:44:27 -04:00
Donatas Abraitis c4e3d5569f
Merge pull request #13086 from donaldsharp/suppress_fib_pending
bgpd: Ensure suppress-fib-pending works with network statements
2023-03-27 21:55:58 +03:00
Donatas Abraitis 6bfb662245
Merge pull request #12931 from SaiGomathiN/yang
pim6d: custom error-message for non-multicast groups
2023-03-27 13:45:00 +03:00
Donald Sharp fd8044a4fc
Merge pull request #13084 from opensourcerouting/fix/bgp_vrf_md5_password
bgpd: Set md5 TCP socket option for outgoing connections on listener
2023-03-26 08:21:31 -04:00
Donald Sharp 35bd38705f
Merge pull request #13101 from opensourcerouting/fix/bindir_for_frr-reload
tools: Set correct directory of vtysh for frr-reload.py
2023-03-26 08:20:33 -04:00
Donald Sharp aa2602bf60
Merge pull request #13108 from opensourcerouting/clippy-string-warn
lib: improve clippy behavior with invalid input
2023-03-25 12:57:00 -04:00
David Lamparter be95afe196 lib/clippy: bail out on newline inside string
While C compilers will generally process strings across lines, we really
don't want that.  I rather treat this as the indication of the typo it
probably is warn about it than support this odd C edge case.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-03-25 12:34:35 +09:00
David Lamparter 9e92984f32 lib/clippy: don't SEGV on invalid tokens in DEFPY
The token value can be NULL if we run into something that failed to
parse.  Throw a Python exception rather than SEGV.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-03-25 12:33:14 +09:00
Jafar Al-Gharaibeh 06f54ff416
Merge pull request #12953 from donaldsharp/struct_event
Struct event
2023-03-24 13:48:53 -05:00
Donatas Abraitis c9bdc0c79e tools: Set correct directory of vtysh for frr-reload.py
Before it was setting SDIR, which is /usr/lib/frr, but the vtysh binary is put
under bindir (which is /usr/local by default). And running `/usr/lib/frr/frr reload`
failed.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-03-24 19:38:46 +02:00
Donald Sharp d54d0ead76
Merge pull request #13093 from manojvn/ospf_mem_leaks
ospfd: Fix for memory leak issue in ospf related to flood_reduction tests.
2023-03-24 10:23:18 -04:00
Donald Sharp 6c8ad437e7
Merge pull request #13100 from opensourcerouting/fix/bgp_cap_llgr_length_check
bgpd: Check 7 bytes for Long-lived Graceful-Restart capability
2023-03-24 10:22:48 -04:00
Donatas Abraitis b1d33ec293 bgpd: Check 7 bytes for Long-lived Graceful-Restart capability
It's not 4 bytes, it was assuming the same as Graceful-Restart tuples.

LLGR has more 3 bytes (Long-lived Stale Time).

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-03-24 15:36:17 +02:00
mobash-rasool 18c9215985
Merge pull request #13088 from donaldsharp/pim_use_after
pimd: Fix use after free issue for ifp's moving vrfs
2023-03-24 18:33:05 +05:30
Donald Sharp 970bbd8b89
Merge pull request #13094 from loganaden/master
mgmtd: Fix fd leak.
2023-03-24 08:41:11 -04:00
Donald Sharp 02e701e49e *: Fixup formatting issues due to reordering
All the event changes exposed a bunch of places where
we were not properly following our standards.  Just
clean them up in one big fell swoop.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:37:21 -04: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 cd9d053741 *: Convert struct event_master to struct event_loop
Let's find a better name for it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp ce50d11c4d *: Convert thread_master_XXX functions to event_master_XXX
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 70d4d90c82 lib, zebra: Convert THREAD_TIMER_STRLEN to EVENT_TIMER_STRLEN
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp 04ec66797c lib: change cpu_thread_history to cpu_event_history
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp 5163a1c560 lib: convert xref_threadsched to xref_eventsched
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp 3905fb7393 lib: convert thread internal lists to event internal lists
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp 2453d15dbf *: Convert struct thread_master to struct event_master and it's ilk
Convert the `struct thread_master` to `struct event_master`
across the code base.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp 5f6eaa9b96 *: Convert a bunch of thread_XX to event_XX
Convert these functions:

thread_getrusage
thread_cmd_init
thread_consumed_time
thread_timer_to_hhmmss
thread_is_scheduled
thread_ignore_late_timer

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp 70c35c11f2 *: Convert thread_should_yield and thread_set_yield_time
Convert thread_should_yield and thread_set_yield_time
to event_should_yield and event_set_yield_time

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 8c1186d38e *: Convert thread_execute to event_execute
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp ba7d2705d6 lib: Convert THREAD_YIELD_TIME_SLOT to EVENT_YIELD_TIME_SLOT
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp de2754be3a *: Convert thread_fetch and thread_call to event_fetch and event_call
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -04:00
Donald Sharp 2ccccdf5d0 lib: Convert thread_type to event_type and make an enum
a) Convert thread types to a enum
b) Convert MTYPES to EVENT instead of THREAD

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-24 08:32:17 -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 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
Donald Sharp 173786f6b5
Merge pull request #13065 from rgirada/ospf_abr_summary 2023-03-23 19:57:08 -04:00
Loganaden Velvindron b69017f455 mgmtd: Fix fd leak.
Close fd before returning to avoid leaks.

Signed-off-by: Loganaden Velvindron <logan@cyberstorm.mu>
2023-03-23 23:07:06 +04:00
Manoj Naragund 1746f71bc8 ospfd: Fix for memory leak issue in ospf related to flood_reduction tests.
Problem:
Multiple memory leaks after pr12366

RCA:
ospf_lsa_unlock was not happening for the few of the LSAs in
ospf_lsa_refresh_walker after pr12366 due to which memory
related to lsas was leaking.

Fix:
Moved the ospf_lsa_unlock outside if check.

Signed-off-by: Manoj Naragund <mnaragund@vmware.com>
2023-03-23 05:59:38 -07:00
Donatas Abraitis 6927446645
Merge pull request #13074 from donaldsharp/hash_clean_and_free
*: Add a hash_clean_and_free() function
2023-03-23 14:08:29 +02:00
Donald Sharp 9cc377d4d7
Merge pull request #13078 from opensourcerouting/fix/set_distance_zero
bgpd: Do not allow setting `set distance` via route-maps to zero
2023-03-23 07:50:35 -04:00
Donald Sharp e60308f498 pimd: Fix use after free issue for ifp's moving vrfs
We have this valgrind trace:

==1125== Invalid read of size 4
==1125==    at 0x170A7D: pim_if_delete (pim_iface.c:203)
==1125==    by 0x170C01: pim_if_terminate (pim_iface.c:80)
==1125==    by 0x174F34: pim_instance_terminate (pim_instance.c:68)
==1125==    by 0x17535B: pim_vrf_terminate (pim_instance.c:260)
==1125==    by 0x1941CF: pim_terminate (pimd.c:161)
==1125==    by 0x1B476D: pim_sigint (pim_signals.c:44)
==1125==    by 0x4910C22: frr_sigevent_process (sigevent.c:133)
==1125==    by 0x49220A4: thread_fetch (thread.c:1777)
==1125==    by 0x48DC8E2: frr_run (libfrr.c:1222)
==1125==    by 0x15E12A: main (pim_main.c:176)
==1125==  Address 0x6274d28 is 1,192 bytes inside a block of size 1,752 free'd
==1125==    at 0x48369AB: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1125==    by 0x174FF1: pim_vrf_delete (pim_instance.c:181)
==1125==    by 0x4925480: vrf_delete (vrf.c:264)
==1125==    by 0x4925480: vrf_delete (vrf.c:238)
==1125==    by 0x49332C7: zclient_vrf_delete (zclient.c:2187)
==1125==    by 0x4934319: zclient_read (zclient.c:4003)
==1125==    by 0x492249C: thread_call (thread.c:2008)
==1125==    by 0x48DC8D7: frr_run (libfrr.c:1223)
==1125==    by 0x15E12A: main (pim_main.c:176)
==1125==  Block was alloc'd at
==1125==    at 0x4837B65: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1125==    by 0x48E80AF: qcalloc (memory.c:116)
==1125==    by 0x1750DA: pim_instance_init (pim_instance.c:90)
==1125==    by 0x1750DA: pim_vrf_new (pim_instance.c:161)
==1125==    by 0x4924FDC: vrf_get (vrf.c:183)
==1125==    by 0x493334C: zclient_vrf_add (zclient.c:2157)
==1125==    by 0x4934319: zclient_read (zclient.c:4003)
==1125==    by 0x492249C: thread_call (thread.c:2008)
==1125==    by 0x48DC8D7: frr_run (libfrr.c:1223)
==1125==    by 0x15E12A: main (pim_main.c:176)

and you do this series of events:

a) Create a vrf, put an interface in it
b) Turn on pim on that interface and turn on pim in that vrf
c) Delete the vrf
d) Do anything with the interface, in this case shutdown the system

The move of the interface to a new vrf is leaving the pim_ifp->pim pointer pointing
at the old pim instance, which was just deleted, so the instance pointer was freed.

Let's clean up the pim pointer in the interface pointer as well.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-22 18:29:56 -04:00
Jafar Al-Gharaibeh b817ff9c8a
Merge pull request #13059 from FRRouting/dev/mgmtd
Introduce the centralized management daemon
2023-03-22 12:37:14 -05:00
Donald Sharp 3fdb2079f6 bgpd: Ensure suppress-fib-pending works with network statements
The flag for telling BGP that a route is expected to be installed
first before notifying a peer was always being set upon receipt
of a path that could be accepted as bestpath.  This is not correct:
imagine that you have a peer sending you a route and you have a
network statement that covers the same route.  Irrelevant if the
network statement would win the flag on the dest was being set
in bgp_update.  Thus you could get into a situation where
the network statement path wins but since the flag is set on
the node, it will never be announced to a peer.

Let's just move the setting of the flag into bgp_zebra_announce
and _withdraw.  In _announce set the flag to TRUE when suppress-fib
is enabled.  In _withdraw just always unset the flag as that a withdrawal
does not need to wait for rib removal before announcing.  This will
cover the case when a network statement is added after the route has
been learned from a peer.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-03-22 11:35:28 -04:00
Donatas Abraitis 2804008474 bgpd: Set TCP_MD5 for outgoing connections when password is set
If configuring `neighbor password` under VRF (not default), the session
will never be established.

Before setting TCP_MD5 for the connection fd, we need to enable this on the
accept direction as well (listener).

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-03-22 15:55:38 +02:00
Donatas Abraitis e1957bcd04 tests: Check if BGP peering with MD5 per-VRF works correctly
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-03-22 15:55:37 +02:00
Donatas Abraitis 51655ef01a
Merge pull request #13075 from donaldsharp/bgp_route_debugs
bgpd: Add vrf name and peer name to some bgp debugs
2023-03-22 12:47:35 +02:00
Donatas Abraitis 8179b7e188
Merge pull request #13080 from chiragshah6/fdev2
zebra: add evpn isDetectionFreeze to json output
2023-03-22 09:23:10 +02:00
Christian Hopps 0b645fd216 lib: mgmtd: fix build warnings (as error)
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-03-22 05:22:56 +00:00