]> git.puffer.fish Git - matthieu/frr.git/log
matthieu/frr.git
17 months agoMerge pull request #14772 from LabNConsulting/fix-darr-memory-acct
Igor Ryzhov [Mon, 13 Nov 2023 03:47:36 +0000 (05:47 +0200)]
Merge pull request #14772 from LabNConsulting/fix-darr-memory-acct

17 months agoMerge pull request #14771 from LabNConsulting/fix-mgmtd-client-memleaks
Igor Ryzhov [Sun, 12 Nov 2023 18:46:04 +0000 (20:46 +0200)]
Merge pull request #14771 from LabNConsulting/fix-mgmtd-client-memleaks

lib: mgmtd: fix debug cli commands and memleaks

17 months agoMerge pull request #14767 from idryzhov/fix-change-value-free
Donatas Abraitis [Sun, 12 Nov 2023 18:16:19 +0000 (20:16 +0200)]
Merge pull request #14767 from idryzhov/fix-change-value-free

lib: fix possible freeing of libyang data

17 months agoMerge pull request #14774 from idryzhov/bgp-snmp-fix-build
Donatas Abraitis [Sun, 12 Nov 2023 09:06:39 +0000 (10:06 +0100)]
Merge pull request #14774 from idryzhov/bgp-snmp-fix-build

bgpd: fix build error

17 months agobgpd: fix build error
Igor Ryzhov [Sun, 12 Nov 2023 00:57:25 +0000 (02:57 +0200)]
bgpd: fix build error

I recieve the following error with GCC 9.4.0:
```
In file included from /usr/include/string.h:495,
                 from ./lib/zebra.h:23,
                 from bgpd/bgp_snmp_bgp4v2.c:7:
In function ‘memset’,
    inlined from ‘bgp4v2PathAttrLookup’ at bgpd/bgp_snmp_bgp4v2.c:605:3,
    inlined from ‘bgp4v2PathAttrTable’ at bgpd/bgp_snmp_bgp4v2.c:747:9:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:71:10: error: ‘__builtin_memset’ offset [9, 20] from the object at ‘paddr’ is out of the bounds of referenced subobject ‘_v4_addr’ with type ‘struct in_addr’ at offset 4 [-Werror=array-bounds]
   71 |   return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest));
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
17 months agoMerge pull request #14773 from LabNConsulting/fix-log-vty-memleak
Donald Sharp [Sat, 11 Nov 2023 23:25:04 +0000 (18:25 -0500)]
Merge pull request #14773 from LabNConsulting/fix-log-vty-memleak

lib: free the log file resources created at startup and config

17 months agotools: suppress some reachable external lib "leaks"
Christian Hopps [Sat, 11 Nov 2023 19:56:26 +0000 (20:56 +0100)]
tools: suppress some reachable external lib "leaks"

- These are just normal reachable allocs from inside external library code;
however, when running valgrind with memleak types "all" in order to find FRR
specific leaks (from memory.h) these are the only other reported leaks. Makes
easier checking and fixing.

Signed-off-by: Christian Hopps <chopps@labn.net>
17 months agolib: free the log file resources created at startup and config
Christian Hopps [Sat, 11 Nov 2023 19:31:13 +0000 (20:31 +0100)]
lib: free the log file resources created at startup and config

Signed-off-by: Christian Hopps <chopps@labn.net>
17 months agolib: darr needs to use memory.h for both alloc and free
Christian Hopps [Sat, 11 Nov 2023 19:27:22 +0000 (20:27 +0100)]
lib: darr needs to use memory.h for both alloc and free

Was using XREALLOC() and then free(). instant "memleaks".

Signed-off-by: Christian Hopps <chopps@labn.net>
17 months agolib: mgmtd: fix debug cli commands and memleaks
Christian Hopps [Sat, 11 Nov 2023 18:21:17 +0000 (19:21 +0100)]
lib: mgmtd: fix debug cli commands and memleaks

- Cannot have 2 cmd_node's with same .node number. Install the mgmtd
client library debug nodes (client frontend and client backend) using
new unique node numbers. Fixes memleaks.

- Fix "debug mgmt client backend" to generate correct config (and not
for frontend).

Signed-off-by: Christian Hopps <chopps@labn.net>
17 months agoMerge pull request #14766 from cscarpitta/fix/fix-missing-debug-guard
Donatas Abraitis [Sat, 11 Nov 2023 17:23:19 +0000 (18:23 +0100)]
Merge pull request #14766 from cscarpitta/fix/fix-missing-debug-guard

bgpd: Add missing guard for `zlog_debug`

17 months agolib: fix possible freeing of libyang data
Igor Ryzhov [Sat, 11 Nov 2023 00:06:11 +0000 (02:06 +0200)]
lib: fix possible freeing of libyang data

mgmtd frees all non-NULL change->value variables at the end of every
commit. We shouldn't assign change->value with data returned by libyang
to prevent freeing of library-allocated memory.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
17 months agobgpd: Add guard for `zlog_debug`
Carmine Scarpitta [Fri, 10 Nov 2023 21:31:09 +0000 (22:31 +0100)]
bgpd: Add guard for `zlog_debug`

Add guard for `zlog_debug` when bgpd is not connected to zebra
or zebra does not know the bgp instance.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
17 months agoMerge pull request #14758 from LabNConsulting/fix-mgmtd-coverity
Donald Sharp [Thu, 9 Nov 2023 13:20:37 +0000 (08:20 -0500)]
Merge pull request #14758 from LabNConsulting/fix-mgmtd-coverity

mgmtd: get rid of unused init value to fix coverity warning

17 months agoMerge pull request #14751 from opensourcerouting/fix/soft_version_cap_received_fix
Donald Sharp [Thu, 9 Nov 2023 12:38:16 +0000 (07:38 -0500)]
Merge pull request #14751 from opensourcerouting/fix/soft_version_cap_received_fix

bgpd: Software capability nits

17 months agoMerge pull request #14756 from opensourcerouting/fix/bgpd_dynamic_cap_addpath_topotest
Donald Sharp [Thu, 9 Nov 2023 12:37:26 +0000 (07:37 -0500)]
Merge pull request #14756 from opensourcerouting/fix/bgpd_dynamic_cap_addpath_topotest

tests: Check received prefixes before immediately sending dynamic capabilities

17 months agoMerge pull request #14727 from fdumontet6WIND/bgp4v2_snmp
Donatas Abraitis [Thu, 9 Nov 2023 09:20:33 +0000 (10:20 +0100)]
Merge pull request #14727 from fdumontet6WIND/bgp4v2_snmp

bgpd: fix bgp4v2 MIB NLRI INDEX format and order

17 months agomgmtd: get rid of unused init value to fix coverity warning
Christian Hopps [Thu, 9 Nov 2023 02:27:29 +0000 (21:27 -0500)]
mgmtd: get rid of unused init value to fix coverity warning

Signed-off-by: Christian Hopps <chopps@labn.net>
17 months agotests: take into account fix for NLRI Index
Francois Dumontet [Fri, 3 Nov 2023 09:46:40 +0000 (10:46 +0100)]
tests: take into account fix for NLRI Index

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
17 months agobgp: fix bgp4v2 MIB NLRI INDEX format and order
Francois Dumontet [Fri, 29 Sep 2023 13:23:24 +0000 (15:23 +0200)]
bgp: fix bgp4v2 MIB NLRI INDEX format and order

With a BGP configuration with ipv4 peering, and ipv6 peering, an snmpwalk
is stopped while walking over the bgp4v2NlriTable

snmpwalk -c TEST -v2c -On -Ln 1.1.1.2 .1.3.6.1.3.5.1.1.4

[...]
.1.3.6.1.3.5.1.1.4.1.2.1.2.32.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1 = Gauge32: 13380
.1.3.6.1.3.5.1.1.9.1.1.1.1.1.1.1.0.24.0.0.0.0 = Gauge32: 0
.1.3.6.1.3.5.1.1.9.1.1.1.1.1.1.1.0.24.0.0.0.0 = Gauge32: 0
 >= .1.3.6.1.3.5.1.1.9.1.1.1.1.1.1.1.0.24.0.0.0.0

The walk stopped because the index used in the NlriTable entries is
decrementing, and this is against the snmp specifications. Also, the
computed index is wrong, and does not match the provided
draft-ietf-idr-bgp4-mibv2-1 specification.

Fix this by computing a valid index, and by finding out the next
consecutive prefix.
The resulting changes do not break the walk, and the output is changed:

root@dut-vm:~# snmpwalk -v 2c -c public -Ln -On localhost 1.3.6.1.3.5.1.1.9.1
.1.3.6.1.3.5.1.1.9.1.1.1.1.1.1.10.200.0.0.24.1.10.125.0.2.1 = Gauge32: 0
.1.3.6.1.3.5.1.1.9.1.1.1.1.1.1.10.244.0.0.24.1.10.125.0.2.1 = Gauge32: 0
.1.3.6.1.3.5.1.1.9.1.2.1.1.1.1.10.200.0.0.24.1.10.125.0.2.1 = INTEGER: 1
.1.3.6.1.3.5.1.1.9.1.2.1.1.1.1.10.244.0.0.24.1.10.125.0.2.1 = INTEGER: 1
.1.3.6.1.3.5.1.1.9.1.3.1.1.1.1.10.200.0.0.24.1.10.125.0.2.1 = INTEGER: 1
.1.3.6.1.3.5.1.1.9.1.3.1.1.1.1.10.244.0.0.24.1.10.125.0.2.1 = INTEGER: 1
.1.3.6.1.3.5.1.1.9.1.4.1.1.1.1.10.200.0.0.24.1.10.125.0.2.1 = INTEGER: 1
.1.3.6.1.3.5.1.1.9.1.4.1.1.1.1.10.244.0.0.24.1.10.125.0.2.1 = INTEGER: 1
.1.3.6.1.3.5.1.1.9.1.5.1.1.1.1.10.200.0.0.24.1.10.125.0.2.1 = Hex-STRING: 0A C8 00 00
.1.3.6.1.3.5.1.1.9.1.5.1.1.1.1.10.244.0.0.24.1.10.125.0.2.1 = Hex-STRING: 0A F4 00 00

Fixes: c681e937d7ae8904f748819fce37498ce0ea8f7d (bgpd: Implement SNMP
BGP4V2-MIB (bgp4V2NlriTable), part 1)
Fixes: 2ce69011c4199bead8172b5ee7e63485e2f861c8 (bgpd: Implement SNMP
BGP4V2-MIB (bgp4V2NlriTable), part 2)

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
17 months agotests: Check received prefixes before immediately sending dynamic capabilities
Donatas Abraitis [Wed, 8 Nov 2023 14:36:07 +0000 (16:36 +0200)]
tests: Check received prefixes before immediately sending dynamic capabilities

If we send capabilities immediately, before receiving an UPDATE message, we end up
with a notification received from the neighbor. Let's wait until we have the fully
converged topology and do the stuff.

Tested locally and can't replicate the failure, let's see how happy is the CI this time.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
17 months agoMerge pull request #14525 from LabNConsulting/chopps/mgmtd-simplify-xpaths
Igor Ryzhov [Wed, 8 Nov 2023 14:30:46 +0000 (16:30 +0200)]
Merge pull request #14525 from LabNConsulting/chopps/mgmtd-simplify-xpaths

chopps/mgmtd simplify xpaths

17 months agoMerge pull request #14544 from idryzhov/mgmt-scratch-buffer
Donald Sharp [Wed, 8 Nov 2023 14:18:27 +0000 (09:18 -0500)]
Merge pull request #14544 from idryzhov/mgmt-scratch-buffer

mgmt: delete candidate scratch buffer

17 months agoMerge pull request #14743 from idryzhov/mgmtd-local-validation
Donald Sharp [Wed, 8 Nov 2023 13:49:01 +0000 (08:49 -0500)]
Merge pull request #14743 from idryzhov/mgmtd-local-validation

mgmtd: fix local validation

17 months agobgpd: Send software version capability for OAD EBGP peers
Donatas Abraitis [Wed, 8 Nov 2023 13:29:32 +0000 (15:29 +0200)]
bgpd: Send software version capability for OAD EBGP peers

We send this capability for iBGP peers by default. Recently OAD support was
merged, and we should adopt sending the capability according to OAD as well.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
17 months agobgpd: Set the software version capability received flag only after a validation
Donatas Abraitis [Wed, 8 Nov 2023 13:26:40 +0000 (15:26 +0200)]
bgpd: Set the software version capability received flag only after a validation

We shouldn't set it blindly once the packet is received, but first we have to
do some sanity checks.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
17 months agoMerge pull request #14741 from donaldsharp/zebra_h_cleanup
Donatas Abraitis [Wed, 8 Nov 2023 08:03:00 +0000 (09:03 +0100)]
Merge pull request #14741 from donaldsharp/zebra_h_cleanup

Zebra h cleanup

17 months agoMerge pull request #14746 from LabNConsulting/valgrind-leak-kinds
Donatas Abraitis [Wed, 8 Nov 2023 08:01:02 +0000 (09:01 +0100)]
Merge pull request #14746 from LabNConsulting/valgrind-leak-kinds

tests: add ability to show all types of valgrind memleaks

17 months agotests: add ability to show all types of valgrind memleaks
Christian Hopps [Tue, 7 Nov 2023 20:27:33 +0000 (15:27 -0500)]
tests: add ability to show all types of valgrind memleaks

Signed-off-by: Christian Hopps <chopps@labn.net>
17 months agoMerge pull request #14698 from opensourcerouting/fix/remove_static_arp_entries_on_ifd...
Russ White [Tue, 7 Nov 2023 14:40:01 +0000 (09:40 -0500)]
Merge pull request #14698 from opensourcerouting/fix/remove_static_arp_entries_on_ifdown_events

zebra: Remove static ARP entries on interface down events

17 months ago*: Move distance related defines into their own header
Donald Sharp [Sat, 4 Nov 2023 08:47:46 +0000 (08:47 +0000)]
*: Move distance related defines into their own header

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months ago*: Remove APPLE #defines from build
Donald Sharp [Sat, 4 Nov 2023 08:30:31 +0000 (08:30 +0000)]
*: Remove APPLE #defines from build

We cannot build on apple machines at all due
to our usage of some gcc extensions that will
probably never see the light of day again.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months ago*: Remove netlink headers from lib/zebra.h
Donald Sharp [Sat, 4 Nov 2023 08:15:54 +0000 (08:15 +0000)]
*: Remove netlink headers from lib/zebra.h

The headers associated with netlink code
really only belong in those that need it.
Move these headers out of lib/zebra.h and
into more appropriate places.  bgp's usage
of the RT_TABLE_XXX defines are probably not
appropriate and will be cleaned up in future
commits.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agomgmtd: fix local validation
Igor Ryzhov [Tue, 7 Nov 2023 01:40:26 +0000 (03:40 +0200)]
mgmtd: fix local validation

When validating the config, we shouldn't also validate state.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
17 months agotools: checkpatch updated with darr_foreach iter macros
Christian Hopps [Tue, 24 Oct 2023 18:58:11 +0000 (14:58 -0400)]
tools: checkpatch updated with darr_foreach iter macros

Also update `checkpatch.sh` so it runs `checkpatch.pl` from the same directory
it resides in. This allows copying them both somewhere else to use a specific
version.

Signed-off-by: Christian Hopps <chopps@labn.net>
17 months agolib: yang: restore old API use now that it's fixed
Christian Hopps [Sun, 9 Jul 2023 20:55:10 +0000 (16:55 -0400)]
lib: yang: restore old API use now that it's fixed

This also avoids a bug in the workaround function if the set variable
wasn't set to NULL the Debug version of libyang would sigsegv.

Signed-off-by: Christian Hopps <chopps@labn.net>
17 months agomgmtd: simplify xpath registries
Christian Hopps [Sun, 9 Jul 2023 03:11:15 +0000 (23:11 -0400)]
mgmtd: simplify xpath registries

- move from client id indexed array of uints for register info
  per client to a u64 bitmask.
- add bit walking FOREACH macro

Walk the client IDs whose bits are set in a mask.

Signed-off-by: Christian Hopps <chopps@labn.net>
17 months agoMerge pull request #14729 from donaldsharp/v6_rr_semantics_zrouter
Donatas Abraitis [Mon, 6 Nov 2023 21:00:50 +0000 (23:00 +0200)]
Merge pull request #14729 from donaldsharp/v6_rr_semantics_zrouter

V6 rr semantics zrouter

17 months agoMerge pull request #14742 from FRRouting/revert-14648-import_no_no_no
Mark Stapp [Mon, 6 Nov 2023 15:38:06 +0000 (10:38 -0500)]
Merge pull request #14742 from FRRouting/revert-14648-import_no_no_no

Revert "bgpd: combine import_check_table and nexthop_check_table"

17 months agoRevert "bgpd: combine import_check_table and nexthop_check_table"
Donald Sharp [Mon, 6 Nov 2023 15:07:58 +0000 (10:07 -0500)]
Revert "bgpd: combine import_check_table and nexthop_check_table"

17 months agozebra: When using Nexthop groups, use v6 RR semantics
Donald Sharp [Mon, 6 Nov 2023 13:56:50 +0000 (08:56 -0500)]
zebra: When using Nexthop groups, use v6 RR semantics

The nexthop group route replace operation was made consistent
across all versions of the kernel.  A v6 route replacement
does not need to do a delete than add when using nexthop
groups

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agozebra: Move v6_rr_semantics to be part of zrouter structure
Donald Sharp [Fri, 3 Nov 2023 16:58:42 +0000 (16:58 +0000)]
zebra: Move v6_rr_semantics to be part of zrouter structure

Move global variable v6_rr_semantics from a global data structure
into the zrouter data structure.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agozebra: Add v6_rr_semantics status to `show zebra`
Donald Sharp [Fri, 3 Nov 2023 16:35:45 +0000 (16:35 +0000)]
zebra: Add v6_rr_semantics status to `show zebra`

The v6_rr_semantics variable was being set but never
reported and had to be inferred from watching netlink
messages to the kernel.  Let's add a bit of code
to `show zebra` so that we can know how it is being
used.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agoMerge pull request #14730 from opensourcerouting/fix/doc_releases
Donald Sharp [Mon, 6 Nov 2023 13:11:03 +0000 (08:11 -0500)]
Merge pull request #14730 from opensourcerouting/fix/doc_releases

doc: Add a quick example on how to use release_notes.py

17 months agoMerge pull request #14734 from opensourcerouting/fix/add_missing_documentation_for_co...
Donald Sharp [Mon, 6 Nov 2023 13:10:45 +0000 (08:10 -0500)]
Merge pull request #14734 from opensourcerouting/fix/add_missing_documentation_for_community_any

doc: Add missing match community exact-match/any

17 months agoMerge pull request #14736 from opensourcerouting/transparent-sockunion
Donald Sharp [Mon, 6 Nov 2023 13:09:48 +0000 (08:09 -0500)]
Merge pull request #14736 from opensourcerouting/transparent-sockunion

lib: create a transparent union `sockunion`

17 months agozebra: Remove static ARP entries on interface down events
Donatas Abraitis [Tue, 31 Oct 2023 15:09:48 +0000 (17:09 +0200)]
zebra: Remove static ARP entries on interface down events

Without this patch, static ARP entries remain active even if the interface is
down, but the kernel already removed them.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
17 months agoMerge pull request #14726 from cscarpitta/fix/fix-openfabric-crash
Igor Ryzhov [Sun, 5 Nov 2023 21:39:14 +0000 (23:39 +0200)]
Merge pull request #14726 from cscarpitta/fix/fix-openfabric-crash

isisd: Fix crash when enabling OpenFabric on an interface

17 months agolib: add a transparent union for sockaddrs
David Lamparter [Wed, 30 Nov 2022 10:19:14 +0000 (11:19 +0100)]
lib: add a transparent union for sockaddrs

As with "prefixptr"/"prefixconstptr", this allows function prototypes to
say "just give me any sockaddr" typing-wise, without having the compiler
complain that a "struct sockaddr_in" is not a "struct sockaddr".

(Split off from other changes that start using this.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
17 months agolib: rename `prefixtype` to `uniontype`
David Lamparter [Sun, 5 Nov 2023 17:16:54 +0000 (18:16 +0100)]
lib: rename `prefixtype` to `uniontype`

About to use this for sockunion, which is not a prefix.  `uniontype`
makes more sense, the macros are for defining transparent unions after
all.

(clang-format off thrown in as it otherwise wrecks formatting.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
17 months agodoc: Add missing match community exact-match/any
Donatas Abraitis [Sun, 5 Nov 2023 06:31:05 +0000 (08:31 +0200)]
doc: Add missing match community exact-match/any

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
17 months agodoc: Add a quick example on how to use release_notes.py
Donatas Abraitis [Sat, 4 Nov 2023 14:32:01 +0000 (16:32 +0200)]
doc: Add a quick example on how to use release_notes.py

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
17 months agoMerge pull request #14724 from donaldsharp/workqueue_cleanup
Donatas Abraitis [Sat, 4 Nov 2023 11:58:55 +0000 (13:58 +0200)]
Merge pull request #14724 from donaldsharp/workqueue_cleanup

Workqueue cleanup

17 months agoMerge pull request #14728 from FRIDM636/rework_debug_pathd_pcep
Donald Sharp [Fri, 3 Nov 2023 22:08:17 +0000 (18:08 -0400)]
Merge pull request #14728 from FRIDM636/rework_debug_pathd_pcep

pathd: rework debug pathd pcep command

17 months agoMerge pull request #14723 from opensourcerouting/if_zapi_hooks_convert
Donald Sharp [Fri, 3 Nov 2023 20:36:17 +0000 (16:36 -0400)]
Merge pull request #14723 from opensourcerouting/if_zapi_hooks_convert

lib: convert `if_zapi_callbacks` into actual hooks

17 months agolib: Remove unused WQ_RETRY_XXX enums
Donald Sharp [Thu, 2 Nov 2023 23:17:48 +0000 (19:17 -0400)]
lib: Remove unused WQ_RETRY_XXX enums

These enum's have been around since 2005 and FRR
still does not have any users of these particular
values.  After almost 20 years, let's simplify the
code slightly and remove them.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agolib: Cleanup some header files in lib
Donald Sharp [Sun, 29 Oct 2023 20:56:27 +0000 (16:56 -0400)]
lib: Cleanup some header files in lib

buffer.h  -> Bring up to our standard
if.h -> Bring up to our standard
workqueue.h -> expand documentation slightly

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agolib: Move workqueue private functions into workqueue.c
Donald Sharp [Sun, 29 Oct 2023 20:13:21 +0000 (16:13 -0400)]
lib: Move workqueue private functions into workqueue.c

Some Functions are not used outside of workqueue.c.
Move them inside of workqueue.c to limit scope.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agozebra: Fix missing break in switch
Donald Sharp [Sun, 29 Oct 2023 20:04:16 +0000 (16:04 -0400)]
zebra: Fix missing break in switch

Recent Changes added the -Wimplicit-fallthrough flag
to FRR's compilation.  Implementor does not build with
lua support and as such this one was missed in the compilation

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agopathd: rework debug pathd pcep command
Farid Mihoub [Fri, 3 Nov 2023 12:53:43 +0000 (13:53 +0100)]
pathd: rework debug pathd pcep command

Rework "debug pathd pcep [...]" command to support the following
configurations:
  - configure one debugging log type at a time.
  - deconfigure one debugging log type at a time.
  - configure all debugging logs in one shot.
  - deconfigure all debugging logs in one shot.

Signed-off-by: Farid Mihoub <farid.mihoub@6wind.com>
17 months agoisisd: Fix style warnings reported by CI
Carmine Scarpitta [Fri, 3 Nov 2023 12:20:29 +0000 (13:20 +0100)]
isisd: Fix style warnings reported by CI

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
17 months agoisisd: Fix openfabric crash
Carmine Scarpitta [Fri, 3 Nov 2023 09:03:46 +0000 (10:03 +0100)]
isisd: Fix openfabric crash

`isis_srv6_area_init` should not use `yang_get_default_*` functions for
fabricd.

Fixes: https://github.com/FRRouting/frr/issues/14722
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
17 months agolib: convert if_zapi_callbacks into actual hooks
David Lamparter [Thu, 2 Nov 2023 20:49:28 +0000 (13:49 -0700)]
lib: convert if_zapi_callbacks into actual hooks

...so that multiple functions can be subscribed.

The create/destroy hooks are renamed to real/unreal because that's what
they *actually* signal.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
17 months agoMerge pull request #14717 from opensourcerouting/fix/coverity_issues
Donald Sharp [Thu, 2 Nov 2023 23:26:05 +0000 (19:26 -0400)]
Merge pull request #14717 from opensourcerouting/fix/coverity_issues

A couple coverity issues

17 months agoMerge pull request #14716 from opensourcerouting/fix/eor_should_be_withdraw
Donald Sharp [Thu, 2 Nov 2023 15:19:00 +0000 (11:19 -0400)]
Merge pull request #14716 from opensourcerouting/fix/eor_should_be_withdraw

bgpd: A couple more bgpd crash fixes for malformed packets

17 months agoMerge pull request #14720 from opensourcerouting/fix/apply_black_formatting_frr-reload
Donald Sharp [Thu, 2 Nov 2023 13:50:25 +0000 (09:50 -0400)]
Merge pull request #14720 from opensourcerouting/fix/apply_black_formatting_frr-reload

tools: Apply black formatting for tools/frr-reload.py

17 months agotools: Apply black formatting for tools/frr-reload.py
Donatas Abraitis [Thu, 2 Nov 2023 11:39:53 +0000 (13:39 +0200)]
tools: Apply black formatting for tools/frr-reload.py

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
17 months agoMerge pull request #14713 from chiragshah6/mdev1
Donatas Abraitis [Thu, 2 Nov 2023 11:38:23 +0000 (13:38 +0200)]
Merge pull request #14713 from chiragshah6/mdev1

tools: fix frr-reload route-map desc cmd

17 months agobgpd: Fix UNINTENDED_INTEGER_DIVISION for bgp_lp_event_zebra_up()
Donatas Abraitis [Wed, 1 Nov 2023 08:29:07 +0000 (10:29 +0200)]
bgpd: Fix UNINTENDED_INTEGER_DIVISION for bgp_lp_event_zebra_up()

CID 1570864.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
17 months agoMerge pull request #14707 from donaldsharp/nocache
Donatas Abraitis [Thu, 2 Nov 2023 10:42:22 +0000 (12:42 +0200)]
Merge pull request #14707 from donaldsharp/nocache

pimd: Ensure upstream points at the correct rpf

17 months agotools: fix frr-reload route-map desc cmd
Chirag Shah [Thu, 2 Nov 2023 05:57:03 +0000 (22:57 -0700)]
tools: fix frr-reload route-map desc cmd

Fix frr-reload script to only render 'no description'
rather than 'no description blah'

Ticket:#3650752
Testing:

route-map TEST permit 140
 description rule for PFIX_IPV6_7
 match ipv6 address prefix-list PFIX_IPV6_7
exit
!
end

torc-11# confi t
torc-11(config)# route-map TEST permit 140
torc-11(config-route-map)# no description rule for PFIX_IPV6_7
% Unknown command: no description rule for PFIX_IPV6_7

torc-11(config-route-map)# no description rule
% There is no matched command.
torc-11(config-route-map)# no description
  <cr>
torc-11(config-route-map)# no description
torc-11(config-route-map)#

Using frr-reload failure log:
2023-10-31 00:30:31,972  INFO: Failed to execute route-map TEST permit 140  no description rule for PFIX_IPV6_7 exit
2023-10-31 00:30:31,972 ERROR: "route-map TEST permit 140 --  no description rule for PFIX_IPV6_7 -- exit" we failed to remove this command
2023-10-31 00:30:31,972 ERROR: % Unknown command:  no description rule for PFIX_IPV6_7

With fix:

2023-11-02 06:10:30,024  INFO: Executed "route-map TEST permit 140  no description exit"

Signed-off-by: Chirag Shah <chirag@nvidia.com>
17 months agozebra: Remove vrf_id check against VRF_DEFAULT for zebra_redistribute()
Donatas Abraitis [Wed, 1 Nov 2023 08:21:05 +0000 (10:21 +0200)]
zebra: Remove vrf_id check against VRF_DEFAULT for zebra_redistribute()

A dead code. When `is_table_direct` is true, vrf_id is always VRF_DEFAULT.

So this block is never called.

CID 1570863.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
17 months agoMerge pull request #14546 from adrianomarto/ospf6-point-to-multipoint
Donald Sharp [Tue, 31 Oct 2023 22:20:04 +0000 (18:20 -0400)]
Merge pull request #14546 from adrianomarto/ospf6-point-to-multipoint

OSPF6 point to multipoint

17 months agopimd: Ensure upstream points at the correct rpf
Donald Sharp [Tue, 31 Oct 2023 17:06:16 +0000 (13:06 -0400)]
pimd: Ensure upstream points at the correct rpf

In the scenario on an intermediate router where a *,G join has
been received and a S,G stream is being sent through that router
on the *,G stream, there exists a situation when the *,G in has been pruned
but the stream is still being received on on incoming interface towards
the RP for the *,G.   In this situation PIM will see the S,G stream
initially as a NOCACHE from the dataplane, PIM will then do a RPF
for the S and notice that it is supposed to be coming in on adifferent
interface.  In this case PIM the original PIM code would create
a blackhole mroute towards the RPF of the *,G( the interface the
stream is being received on ).  The original reason for this is that
if there is a scenario where this particular S1,G stream is sending
at basically line rate, and there also happens to be a different
S2,G stream that is sending at a very low rate.  With certain
dataplanes there is no way to really rate limit the S1 -vs- S2
stream and the S1 stream completely overwhelms the S2 stream
for sending up to the control plane for proper pim handling.
The problem then becomes that FRR never properly responds
to the situation where the *,G is rereceived and the S,G
stream switches back over to the SPT for itself and FRR ends
up with a dead mroute that stops everything from working properly.

This code change, installs the blackhole mroute with the RPF
towards the RP for the G and then resets the RPF to the correct
RPF for the Stream but does not modify the mroute.  When the
*,G is rereceived and we attempt to transition to the S,G stream
this now works.

As a note:  Both David L and myself do not necessarily believe
we fully understand the problem yet.  What this does do is fix
all the inconsistent CI issues we are seeing in the topotests
at this time.  Internally I am seeing other test failures
in PIM that I don't fully understand and we suspect that
there are other problems in the state machine.  We plan to
revisit this problem as we are able to debug the issue better.
In the meantime both David and Myself agree that this gets
the CI working again and Streams end up in the right state.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
17 months agoMerge pull request #14388 from pguibert6WIND/redistribute_table_bgp_2
Russ White [Tue, 31 Oct 2023 17:23:57 +0000 (13:23 -0400)]
Merge pull request #14388 from pguibert6WIND/redistribute_table_bgp_2

Redistribute table bgp without copying data to the default routing table

17 months agoMerge pull request #14699 from FRIDM636/no_commands_pcep_msd
Donald Sharp [Tue, 31 Oct 2023 16:04:21 +0000 (12:04 -0400)]
Merge pull request #14699 from FRIDM636/no_commands_pcep_msd

Add missing pcep no commands

17 months agoMerge pull request #14700 from mjstapp/fix_devdoc_bits
Donald Sharp [Tue, 31 Oct 2023 16:01:53 +0000 (12:01 -0400)]
Merge pull request #14700 from mjstapp/fix_devdoc_bits

docs: clean up some developer doc warnings

17 months agobgpd: Ignore handling NLRIs if we received MP_UNREACH_NLRI
Donatas Abraitis [Sun, 29 Oct 2023 20:44:45 +0000 (22:44 +0200)]
bgpd: Ignore handling NLRIs if we received MP_UNREACH_NLRI

If we receive MP_UNREACH_NLRI, we should stop handling remaining NLRIs if
no mandatory path attributes received.

In other words, if MP_UNREACH_NLRI received, the remaining NLRIs should be handled
as a new data, but without mandatory attributes, it's a malformed packet.

In normal case, this MUST not happen at all, but to avoid crashing bgpd, we MUST
handle that.

Reported-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
17 months agobgpd: Treat EOR as withdrawn to avoid unwanted handling of malformed attrs
Donatas Abraitis [Fri, 27 Oct 2023 08:56:45 +0000 (11:56 +0300)]
bgpd: Treat EOR as withdrawn to avoid unwanted handling of malformed attrs

Treat-as-withdraw, otherwise if we just ignore it, we will pass it to be
processed as a normal UPDATE without mandatory attributes, that could lead
to harmful behavior. In this case, a crash for route-maps with the configuration
such as:

```
router bgp 65001
 no bgp ebgp-requires-policy
 neighbor 127.0.0.1 remote-as external
 neighbor 127.0.0.1 passive
 neighbor 127.0.0.1 ebgp-multihop
 neighbor 127.0.0.1 disable-connected-check
 neighbor 127.0.0.1 update-source 127.0.0.2
 neighbor 127.0.0.1 timers 3 90
 neighbor 127.0.0.1 timers connect 1
 !
 address-family ipv4 unicast
  neighbor 127.0.0.1 addpath-tx-all-paths
  neighbor 127.0.0.1 default-originate
  neighbor 127.0.0.1 route-map RM_IN in
 exit-address-family
exit
!
route-map RM_IN permit 10
 set as-path prepend 200
exit
```

Send a malformed optional transitive attribute:

```
import socket
import time

OPEN = (b"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
b"\xff\xff\x00\x62\x01\x04\xfd\xea\x00\x5a\x0a\x00\x00\x01\x45\x02"
b"\x06\x01\x04\x00\x01\x00\x01\x02\x02\x02\x00\x02\x02\x46\x00\x02"
b"\x06\x41\x04\x00\x00\xfd\xea\x02\x02\x06\x00\x02\x06\x45\x04\x00"
b"\x01\x01\x03\x02\x0e\x49\x0c\x0a\x64\x6f\x6e\x61\x74\x61\x73\x2d"
b"\x70\x63\x00\x02\x04\x40\x02\x00\x78\x02\x09\x47\x07\x00\x01\x01"
b"\x80\x00\x00\x00")

KEEPALIVE = (b"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff"
b"\xff\xff\xff\xff\xff\xff\x00\x13\x04")

UPDATE = bytearray.fromhex("ffffffffffffffffffffffffffffffff002b0200000003c0ff00010100eb00ac100b0b001ad908ac100b0b")

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(('127.0.0.2', 179))
s.send(OPEN)
data = s.recv(1024)
s.send(KEEPALIVE)
data = s.recv(1024)
s.send(UPDATE)
data = s.recv(1024)
time.sleep(100)
s.close()
```

Reported-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
17 months agoMerge pull request #14675 from donaldsharp/evpn_label
Russ White [Tue, 31 Oct 2023 15:12:34 +0000 (11:12 -0400)]
Merge pull request #14675 from donaldsharp/evpn_label

zebra: Add encap type when building packet for FPM

17 months agoMerge pull request #14661 from opensourcerouting/feature/enable_enforce_first_as_by_d...
Russ White [Tue, 31 Oct 2023 14:40:23 +0000 (10:40 -0400)]
Merge pull request #14661 from opensourcerouting/feature/enable_enforce_first_as_by_default

bgpd: Enable `enforce-first-as` by default

17 months agoMerge pull request #14648 from donaldsharp/import_no_no_no
Russ White [Tue, 31 Oct 2023 14:34:30 +0000 (10:34 -0400)]
Merge pull request #14648 from donaldsharp/import_no_no_no

bgpd: combine import_check_table and nexthop_check_table

17 months agoMerge pull request #14343 from pguibert6WIND/bgp_label_manual_allocate_label_mgr
Russ White [Tue, 31 Oct 2023 14:31:11 +0000 (10:31 -0400)]
Merge pull request #14343 from pguibert6WIND/bgp_label_manual_allocate_label_mgr

Bgp label manual allocate label mgr

17 months agodocs: clean up some developer doc warnings
Mark Stapp [Tue, 31 Oct 2023 13:57:13 +0000 (09:57 -0400)]
docs: clean up some developer doc warnings

A few fixups to clean up some dev doc warnings, in the
northbound files especially.

Signed-off-by: Mark Stapp <mjs@labn.net>
17 months agopathd: add no pcep command
Farid Mihoub [Tue, 31 Oct 2023 10:35:29 +0000 (11:35 +0100)]
pathd: add no pcep command

Add "no pcep" command in segment-routing/traffic-engineering context
to deconfigure the whole pcep configuration (pce-config, pce and pcc).

Signed-off-by: Farid Mihoub <farid.mihoub@6wind.com>
17 months agopathd: add no msd command in the pcc context
Farid Mihoub [Mon, 30 Oct 2023 14:11:47 +0000 (15:11 +0100)]
pathd: add no msd command in the pcc context

Add the "no msd" command to deconfigure pcc/msd node.

Signed-off-by: Farid Mihoub <farid.mihoub@6wind.com>
18 months agoMerge pull request #14691 from LabNConsulting/fix-mgmt-msg-valgrind-errors
Donald Sharp [Mon, 30 Oct 2023 20:53:58 +0000 (16:53 -0400)]
Merge pull request #14691 from LabNConsulting/fix-mgmt-msg-valgrind-errors

lib: mgmt_msg: fix a valgrind memleak

18 months agoMerge pull request #14689 from LabNConsulting/topotest-with-valgrind-and-gdb
Donald Sharp [Mon, 30 Oct 2023 20:51:32 +0000 (16:51 -0400)]
Merge pull request #14689 from LabNConsulting/topotest-with-valgrind-and-gdb

tests: add gdb integration with valgrind

18 months agoMerge pull request #14688 from opensourcerouting/fix/ospf_spacing_nit
Mark Stapp [Mon, 30 Oct 2023 12:49:03 +0000 (08:49 -0400)]
Merge pull request #14688 from opensourcerouting/fix/ospf_spacing_nit

ospfd, ospf6d: Fix spacing nit for `show ... summary-address` command

18 months agotests: add gdb integration with valgrind
Christian Hopps [Mon, 30 Oct 2023 07:37:52 +0000 (03:37 -0400)]
tests: add gdb integration with valgrind

Allows you to run daemons under valgrind integrated with gdb. When daemons are
run with the ``--gdb-daemons/--gdb-routers`` options they will be wired up to
valgrind using vgdb (valgrind tool) so gdb will stop when valgrind errors are
encountered.

Signed-off-by: Christian Hopps <chopps@labn.net>
18 months agolib: mgmt_msg: fix a valgrind memleak
Christian Hopps [Mon, 30 Oct 2023 07:30:05 +0000 (03:30 -0400)]
lib: mgmt_msg: fix a valgrind memleak

- Free the outbound stream on destroy.

Signed-off-by: Christian Hopps <chopps@labn.net>
18 months agoMerge pull request #13576 from chiragshah6/mdev1
Donatas Abraitis [Mon, 30 Oct 2023 06:55:49 +0000 (08:55 +0200)]
Merge pull request #13576 from chiragshah6/mdev1

zebra:returns empty dict when evpn is disabled II

18 months agoospfd, ospf6d: Fix spacing nit for `show ... summary-address` command
Donatas Abraitis [Mon, 30 Oct 2023 06:39:21 +0000 (08:39 +0200)]
ospfd, ospf6d: Fix spacing nit for `show ... summary-address` command

```
r1# sh ipv6 ospf6 summary-address
VRF Name: default
aggregation delay interval :5(in seconds)
```

Just hit this random and looks ugly, let's fix it.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
18 months agoMerge pull request #14681 from chiragshah6/pbr_dev
Donatas Abraitis [Mon, 30 Oct 2023 06:30:33 +0000 (08:30 +0200)]
Merge pull request #14681 from chiragshah6/pbr_dev

zebra: display ptmStatus order in interface json

18 months agoMerge pull request #14635 from opensourcerouting/fix/ospf6d_loopback_cost
mobash-rasool [Mon, 30 Oct 2023 04:19:58 +0000 (09:49 +0530)]
Merge pull request #14635 from opensourcerouting/fix/ospf6d_loopback_cost

ospf6d: Set loopback interface cost to 0

18 months agozebra: display ptmStatus order in interface json
Sindhu Parvathi Gopinathan [Wed, 24 Aug 2022 16:17:57 +0000 (09:17 -0700)]
zebra: display ptmStatus order in interface json

Display ptmStatus in correct order in show interface json
output.

Signed-off-by: Sindhu Parvathi Gopinathan's <sgopinathan@nvidia.com>
18 months agozebra:returns empty dict when evpn is disabled II
Sindhu Parvathi Gopinathan [Tue, 4 Apr 2023 12:38:28 +0000 (05:38 -0700)]
zebra:returns empty dict when evpn is disabled II

This is addressing remaining places returning
empty dict, earlier PR-13214 addressed few places.

Code has been changed to return {} for all the evpn clis
when evpn is disabled or no entry available.

```
cumulus@r2:mgmt:~$ sudo vtysh -c "show evpn json"
cumulus@r2:mgmt:~$
```

After Fix:-
```
cumulus@r1:mgmt:~$ sudo vtysh -c "show evpn json"
{
}
cumulus@r1:mgmt:~$
```

Ticket:#3417955

Issue:3417955

Testing: UT done

Signed-off-by: Sindhu Parvathi Gopinathan's <sgopinathan@nvidia.com>
Signed-off-by: Chirag Shah <chirag@nvidia.com>
18 months ago*: modify empty json helper function
Chirag Shah [Sun, 29 Oct 2023 18:20:37 +0000 (11:20 -0700)]
*: modify empty json helper function

Modify empty json object to take input obj
instead of allocating always one.

There are situation where in error condition or no data
case print empty json (`{}`) with already allocated

Signed-off-by: Chirag Shah <chirag@nvidia.com>
18 months agoMerge pull request #14665 from chiragshah6/pbr_dev
Donatas Abraitis [Sun, 29 Oct 2023 08:40:50 +0000 (10:40 +0200)]
Merge pull request #14665 from chiragshah6/pbr_dev

pbrd: fix show pbr map detail json

18 months agozebra: Add encap type when building packet for FPM
Donald Sharp [Sat, 28 Oct 2023 14:03:39 +0000 (10:03 -0400)]
zebra: Add encap type when building packet for FPM

Currently in the single nexthop case w/ evpn sending
down via the FPM the encap type is not being set
for the nexthop.

This looks like the result of some code reorg for the
nexthop happened but the fpm failed to be accounted for.
Let's just move the encap type encoding to where it
will happen.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>