]> git.puffer.fish Git - mirror/frr.git/log
mirror/frr.git
2 years agolib: fix zlog command types table 12468/head
Mark Stapp [Thu, 8 Dec 2022 16:37:51 +0000 (11:37 -0500)]
lib: fix zlog command types table

Fix a number of differences between the zapi message enum
and the log description table.

Signed-off-by: Mark Stapp <mjs@labn.net>
2 years agoMerge pull request #12456 from opensourcerouting/fix/bgpd_labeled_unicast_rr_addpath
Donald Sharp [Wed, 7 Dec 2022 13:03:59 +0000 (08:03 -0500)]
Merge pull request #12456 from opensourcerouting/fix/bgpd_labeled_unicast_rr_addpath

bgpd: Labeled unicast fixes for addpath capability

2 years agobgpd: Adopt addpath functionality for labeled-unicast 12456/head
Donatas Abraitis [Tue, 6 Dec 2022 16:28:17 +0000 (18:28 +0200)]
bgpd: Adopt addpath functionality for labeled-unicast

The same as for RIB, labeled-unicast allocations should live in
unicast space.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agobgpd: Show in JSON if the advertised path is multipath
Donatas Abraitis [Tue, 6 Dec 2022 16:27:40 +0000 (18:27 +0200)]
bgpd: Show in JSON if the advertised path is multipath

```
  "advertisedRoutes":{
    "10.0.0.1\/32":{
      "addrPrefix":"10.0.0.1",
      "prefixLen":32,
      "network":"10.0.0.1\/32",
      "nextHop":"0.0.0.0",
      "weight":0,
      "path":"65001",
      "bgpOriginCode":"?",
      "appliedStatusSymbols":{
        "*":true,
        ">":true,
        "=":true
      }
    }
  },
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoMerge pull request #12339 from anlancs/fix/bgpd-null-show
Donald Sharp [Tue, 6 Dec 2022 19:11:47 +0000 (14:11 -0500)]
Merge pull request #12339 from anlancs/fix/bgpd-null-show

bgpd: fix null pointer dereference

2 years agoMerge pull request #12455 from mjstapp/revert_stop_zebra_last
Donald Sharp [Tue, 6 Dec 2022 19:11:03 +0000 (14:11 -0500)]
Merge pull request #12455 from mjstapp/revert_stop_zebra_last

tools: revert stop zebra daemon last

2 years agoMerge pull request #12415 from donaldsharp/bgp_use_after_free
Russ White [Tue, 6 Dec 2022 16:29:31 +0000 (11:29 -0500)]
Merge pull request #12415 from donaldsharp/bgp_use_after_free

Bgp use after free

2 years agotests: Check if labeled-unicast works correctly with addpath capability
Donatas Abraitis [Tue, 6 Dec 2022 16:24:13 +0000 (18:24 +0200)]
tests: Check if labeled-unicast works correctly with addpath capability

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoRevert "tools: stop zebra daemon last" 12455/head
Mark Stapp [Tue, 6 Dec 2022 16:21:02 +0000 (11:21 -0500)]
Revert "tools: stop zebra daemon last"

This reverts commit 2000ac4075bbe1a9557ee30286309d3ade72b3a7.

There were concerns that ensuring zebra stopped last led to
problems with zebra's "-r" flag, so we'll revert that for the
time being and reconsider this area.

Signed-off-by: Mark Stapp <mjs@labn.net>
2 years agoMerge pull request #12322 from fdumontet6WIND/confed_num
Russ White [Tue, 6 Dec 2022 13:59:44 +0000 (08:59 -0500)]
Merge pull request #12322 from fdumontet6WIND/confed_num

bgp:  fix case where confederation id same as member-as

2 years agoMerge pull request #12390 from sigeryang/vrrp-interop
Russ White [Tue, 6 Dec 2022 13:57:17 +0000 (08:57 -0500)]
Merge pull request #12390 from sigeryang/vrrp-interop

vrrpd: add IPv4 pseudoheader option for VRRPv3

2 years agoMerge pull request #12410 from ghzserg/master
Russ White [Tue, 6 Dec 2022 13:55:20 +0000 (08:55 -0500)]
Merge pull request #12410 from ghzserg/master

Add motd command

2 years agoMerge pull request #12432 from mjstapp/use_real_mtypes
Donald Sharp [Tue, 6 Dec 2022 13:34:36 +0000 (08:34 -0500)]
Merge pull request #12432 from mjstapp/use_real_mtypes

lib, zebra: Use real mtypes instead of MTYPE_TMP

2 years agoMerge pull request #12443 from donaldsharp/vtysh_mem_leak_2
Donatas Abraitis [Tue, 6 Dec 2022 06:57:00 +0000 (08:57 +0200)]
Merge pull request #12443 from donaldsharp/vtysh_mem_leak_2

vtysh: free memory given to us by readline

2 years agoMerge pull request #12436 from donaldsharp/general_use
Donatas Abraitis [Tue, 6 Dec 2022 06:51:39 +0000 (08:51 +0200)]
Merge pull request #12436 from donaldsharp/general_use

General use

2 years agoMerge pull request #12445 from donaldsharp/more_mtype_tmp
Donatas Abraitis [Tue, 6 Dec 2022 06:23:01 +0000 (08:23 +0200)]
Merge pull request #12445 from donaldsharp/more_mtype_tmp

More mtype tmp

2 years agoMerge pull request #12433 from donaldsharp/more_use_after_use_and_use
Donatas Abraitis [Mon, 5 Dec 2022 20:46:07 +0000 (22:46 +0200)]
Merge pull request #12433 from donaldsharp/more_use_after_use_and_use

bgpd: Fix 2 read beyond end of streams in bgp srv6 packet processing

2 years agobgpd: Make bgp_keepalives.c not use MTYPE_TMP 12445/head
Donald Sharp [Mon, 5 Dec 2022 17:17:00 +0000 (12:17 -0500)]
bgpd: Make bgp_keepalives.c not use MTYPE_TMP

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agoospf6d: Stop using MTYPE_TMP in some cases
Donald Sharp [Mon, 5 Dec 2022 17:10:25 +0000 (12:10 -0500)]
ospf6d: Stop using MTYPE_TMP in some cases

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agoospfd, ospfclient: Do not just include .c files in another .c
Donald Sharp [Mon, 5 Dec 2022 16:55:14 +0000 (11:55 -0500)]
ospfd, ospfclient: Do not just include .c files in another .c

ospfclient.c includes .c files directly from ospfd.  Let's separate
these out a bit.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agoospfd: Remove MTYPE_TMP
Donald Sharp [Mon, 5 Dec 2022 16:43:57 +0000 (11:43 -0500)]
ospfd: Remove MTYPE_TMP

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agozebra: use real MTYPEs for various objects 12432/head
Mark Stapp [Fri, 2 Dec 2022 16:10:58 +0000 (11:10 -0500)]
zebra: use real MTYPEs for various objects

Don't use MTYPE_TMP for many things in zebra: add specific
mem types.

Signed-off-by: Mark Stapp <mjs@labn.net>
2 years agobgpd: Change fsm to use an enum for passing state 12415/head
Donald Sharp [Mon, 5 Dec 2022 15:10:36 +0000 (10:10 -0500)]
bgpd: Change fsm to use an enum for passing state

The BGP fsm uses return codes to pass event success/fail
as well as some extra data to the bgp_event_update function.
Convert this to use a enum instead of an int to track the
changes.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agobgpd: When creating peer convey if it is a CONFIG_NODE or not
Donald Sharp [Fri, 2 Dec 2022 17:59:30 +0000 (12:59 -0500)]
bgpd: When creating peer convey if it is a CONFIG_NODE or not

When actually creating a peer in BGP, tell the creation if
it is a config node or not.  There were cases where the
CONFIG_NODE was being set *after* being placed into
the bgp->peerhash, thus causing collisions between the
doppelganger and the peer and eventually use after free's.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agobgpd: Hash release before we change the underlying hash assumptions
Donald Sharp [Fri, 2 Dec 2022 17:51:34 +0000 (12:51 -0500)]
bgpd: Hash release before we change the underlying hash assumptions

The bgp->peerhash is made up of the sockunion and the CONFIG_NODE
flag.  If the CONFIG_NODE flag is moved around or changed then
we get into a situation where both the doppelganger and the peer
actually hash to the exact same thing.  Leading to wrongful deletion
and pointers being used after freed.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agobgpd: Peer events should be cleaned up on shutdown
Donald Sharp [Wed, 30 Nov 2022 16:49:51 +0000 (11:49 -0500)]
bgpd: Peer events should be cleaned up on shutdown

Currently bgp does not stop any events that are on the thread
system for execution on peer deletion.  This is not good.
Stop those events and prevent use after free's.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agobgpd: When copying from src to dest do not overwrite the CONFIG_NODE
Donald Sharp [Wed, 30 Nov 2022 15:41:54 +0000 (10:41 -0500)]
bgpd: When copying from src to dest do not overwrite the CONFIG_NODE

When the decision has been made to copy a peer configuration from
a peer to another peer because one is taking over.  Do not automatically
set the CONFIG_NODE flag.  Instead we need to handle that appropriately
when the final decision is made to transfer.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agobgpd: Prevent use after free of peer structure
Donald Sharp [Mon, 28 Nov 2022 20:16:15 +0000 (15:16 -0500)]
bgpd: Prevent use after free of peer structure

When changing the peers sockunion structure the bgp->peer
list was not being updated properly.  Since the peer's su
is being used for a sorted insert then the change of it requires
that the value be pulled out of the bgp->peer list and then
put back into as well.

Additionally ensure that the hash is always released on peer
deletion.

Lead to this from this decode in a address sanitizer run.

=================================================================
==30778==ERROR: AddressSanitizer: heap-use-after-free on address 0x62a0000d8440 at pc 0x7f48c9c5c547 bp 0x7ffcba272cb0 sp 0x7ffcba272ca8
READ of size 2 at 0x62a0000d8440 thread T0
    #0 0x7f48c9c5c546 in sockunion_same lib/sockunion.c:425
    #1 0x55cfefe3000f in peer_hash_same bgpd/bgpd.c:890
    #2 0x7f48c9bde039 in hash_release lib/hash.c:209
    #3 0x55cfefe3373f in bgp_peer_conf_if_to_su_update bgpd/bgpd.c:1541
    #4 0x55cfefd0be7a in bgp_stop bgpd/bgp_fsm.c:1631
    #5 0x55cfefe4028f in peer_delete bgpd/bgpd.c:2362
    #6 0x55cfefdd5e97 in no_neighbor_interface_config bgpd/bgp_vty.c:4267
    #7 0x7f48c9b9d160 in cmd_execute_command_real lib/command.c:949
    #8 0x7f48c9ba1112 in cmd_execute_command lib/command.c:1009
    #9 0x7f48c9ba1573 in cmd_execute lib/command.c:1162
    #10 0x7f48c9c87402 in vty_command lib/vty.c:526
    #11 0x7f48c9c87832 in vty_execute lib/vty.c:1291
    #12 0x7f48c9c8e741 in vtysh_read lib/vty.c:2130
    #13 0x7f48c9c7a66d in thread_call lib/thread.c:1585
    #14 0x7f48c9bf64e7 in frr_run lib/libfrr.c:1123
    #15 0x55cfefc75a15 in main bgpd/bgp_main.c:540
    #16 0x7f48c96b009a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)
    #17 0x55cfefc787f9 in _start (/usr/lib/frr/bgpd+0xe27f9)

0x62a0000d8440 is located 576 bytes inside of 23376-byte region [0x62a0000d8200,0x62a0000ddd50)
freed by thread T0 here:
    #0 0x7f48c9eb9fb0 in __interceptor_free (/lib/x86_64-linux-gnu/libasan.so.5+0xe8fb0)
    #1 0x55cfefe3fe42 in peer_free bgpd/bgpd.c:1113
    #2 0x55cfefe3fe42 in peer_unlock_with_caller bgpd/bgpd.c:1144
    #3 0x55cfefe4092e in peer_delete bgpd/bgpd.c:2457
    #4 0x55cfefdd5e97 in no_neighbor_interface_config bgpd/bgp_vty.c:4267
    #5 0x7f48c9b9d160 in cmd_execute_command_real lib/command.c:949
    #6 0x7f48c9ba1112 in cmd_execute_command lib/command.c:1009
    #7 0x7f48c9ba1573 in cmd_execute lib/command.c:1162
    #8 0x7f48c9c87402 in vty_command lib/vty.c:526
    #9 0x7f48c9c87832 in vty_execute lib/vty.c:1291
    #10 0x7f48c9c8e741 in vtysh_read lib/vty.c:2130
    #11 0x7f48c9c7a66d in thread_call lib/thread.c:1585
    #12 0x7f48c9bf64e7 in frr_run lib/libfrr.c:1123
    #13 0x55cfefc75a15 in main bgpd/bgp_main.c:540
    #14 0x7f48c96b009a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agobgpd: Ensure correct flags when inheriting config from a peer group
Donald Sharp [Thu, 1 Dec 2022 18:06:40 +0000 (13:06 -0500)]
bgpd: Ensure correct flags when inheriting config from a peer group

When a peer is a peer-group based peer, and the config is inherited
from the peer group, let's ensure that the CONFIG_NODE flag stays
no matter what.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agobgpd: Fix several use after free's in bgp for the peer
Donald Sharp [Thu, 1 Dec 2022 18:12:40 +0000 (13:12 -0500)]
bgpd: Fix several use after free's in bgp for the peer

Three fixes:

a) When calling bgp_fsm_change_status with `Deleted` do
not add a new event to the peer's t_event because
we are already in the process of deleting everything

b) When bgp_stop decides to delete a peer return a notification
that it is happening to bgp_event_update so that it does not
set the peer state back to idle or do other processing.

c) bgp_event_update can cause a peer deletion, because
the peer can be deleted in the fsm function but the peer
data structure is still pointed to and used after words.
So lock the peer before entering and prevent a use after
free.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agobgpd: peer creation now takes care of the su
Donald Sharp [Tue, 29 Nov 2022 14:00:39 +0000 (09:00 -0500)]
bgpd: peer creation now takes care of the su

At some point in the past the peer creation was not
properly setting the su and the code had the release
and re-add when setting the su.  Since peer_create
got a bit of code to handle the su properly the
need to release then add it back in is negated
so remove the code.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agovtysh: Cleanup memory leak 12436/head
Donald Sharp [Sat, 3 Dec 2022 12:16:36 +0000 (07:16 -0500)]
vtysh: Cleanup memory leak

When multiple daemons report a exit line for the same
node, vtysh was just dropping the previous pointer.
Ensure that we free it first.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agozebra: Cleanup use after free in shutdown
Donald Sharp [Sat, 3 Dec 2022 12:14:54 +0000 (07:14 -0500)]
zebra: Cleanup use after free in shutdown

On shutdown a use after free was being seen of a route table.
Basically the pointer was kept around and resent for cleanup.
Probably something needs to be unwound to make this better
in the future.  Just cleaning up the use after free.

./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-=================================================================
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929:==911929==ERROR: AddressSanitizer: heap-use-after-free on address 0x606000127a00 at pc 0x7fb9ad546f5b bp 0x7ffc3cff0330 sp 0x7ffc3
cff0328
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-READ of size 8 at 0x606000127a00 thread T0
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-    #0 0x7fb9ad546f5a in route_table_free /home/sharpd/frr8/lib/table.c:103:13
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-    #1 0x7fb9ad546f04 in route_table_finish /home/sharpd/frr8/lib/table.c:61:2
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-    #2 0x6b94ba in zebra_ns_disable_internal /home/sharpd/frr8/zebra/zebra_ns.c:141:2
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-    #3 0x6b9158 in zebra_ns_disabled /home/sharpd/frr8/zebra/zebra_ns.c:116:9
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-    #4 0x7fb9ad43f0f5 in ns_disable_internal /home/sharpd/frr8/lib/netns_linux.c:273:4
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-    #5 0x7fb9ad43e634 in ns_disable /home/sharpd/frr8/lib/netns_linux.c:368:2
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-    #6 0x7fb9ad43e251 in ns_delete /home/sharpd/frr8/lib/netns_linux.c:330:2
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-    #7 0x7fb9ad43fbb3 in ns_terminate /home/sharpd/frr8/lib/netns_linux.c:524:3
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-    #8 0x54f8de in zebra_finalize /home/sharpd/frr8/zebra/main.c:232:2
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-    #9 0x7fb9ad5655e6 in thread_call /home/sharpd/frr8/lib/thread.c:2006:2
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-    #10 0x7fb9ad3d3343 in frr_run /home/sharpd/frr8/lib/libfrr.c:1198:3
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-    #11 0x550b48 in main /home/sharpd/frr8/zebra/main.c:476:2
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-    #12 0x7fb9acd30d09 in __libc_start_main csu/../csu/libc-start.c:308:16
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-    #13 0x443549 in _start (/usr/lib/frr/zebra+0x443549)
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-0x606000127a00 is located 0 bytes inside of 56-byte region [0x606000127a00,0x606000127a38)
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-freed by thread T0 here:
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-    #0 0x4bd33d in free (/usr/lib/frr/zebra+0x4bd33d)
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-    #1 0x7fb9ad42cc80 in qfree /home/sharpd/frr8/lib/memory.c:141:2
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-    #2 0x7fb9ad547305 in route_table_free /home/sharpd/frr8/lib/table.c:141:2
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-    #3 0x7fb9ad546f04 in route_table_finish /home/sharpd/frr8/lib/table.c:61:2
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-    #4 0x6b94ba in zebra_ns_disable_internal /home/sharpd/frr8/zebra/zebra_ns.c:141:2
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-    #5 0x6b9692 in zebra_ns_early_shutdown /home/sharpd/frr8/zebra/zebra_ns.c:164:2
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-    #6 0x7fb9ad43f228 in ns_walk_func /home/sharpd/frr8/lib/netns_linux.c:386:9
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-    #7 0x55014f in sigint /home/sharpd/frr8/zebra/main.c:194:2
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-    #8 0x7fb9ad50db99 in frr_sigevent_process /home/sharpd/frr8/lib/sigevent.c:130:6
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-    #9 0x7fb9ad560d07 in thread_fetch /home/sharpd/frr8/lib/thread.c:1775:4
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-    #10 0x7fb9ad3d332d in frr_run /home/sharpd/frr8/lib/libfrr.c:1197:9
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-    #11 0x550b48 in main /home/sharpd/frr8/zebra/main.c:476:2
--
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-    #7 0x7fb9acd30d09 in __libc_start_main csu/../csu/libc-start.c:308:16
./bfd_vrf_topo1.test_bfd_vrf_topo1/r2.zebra.asan.911929-

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agoldpd: Clean up use after free in shutdown
Donald Sharp [Sat, 3 Dec 2022 12:13:49 +0000 (07:13 -0500)]
ldpd: Clean up use after free in shutdown

Config data was being freed just prior to it
being used for cleanup in shutdown.  Prevent this
from happening.

./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-=================================================================
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142:==2274142==ERROR: AddressSanitizer: heap-use-after-free on address 0x61d00000c880 at pc 0x0000004d94d1 bp 0x7ffd46637810 sp 0
x7ffd46637808
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-READ of size 4 at 0x61d00000c880 thread T0
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-    #0 0x4d94d0 in ldp_rtr_id_get /home/sharpd/frr8/ldpd/ldpd.c:983:20
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-    #1 0x56ff92 in gen_ldp_hdr /home/sharpd/frr8/ldpd/packet.c:47:19
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-    #2 0x56a4b0 in send_notification_full /home/sharpd/frr8/ldpd/notification.c:49:9
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-    #3 0x56c4b3 in send_notification /home/sharpd/frr8/ldpd/notification.c:117:2
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-    #4 0x573fb7 in session_shutdown /home/sharpd/frr8/ldpd/packet.c:666:3
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-    #5 0x4e2ef1 in adj_del /home/sharpd/frr8/ldpd/adjacency.c:145:3
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-    #6 0x55d425 in ldpe_shutdown /home/sharpd/frr8/ldpd/ldpe.c:231:3
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-    #7 0x55a9a0 in ldpe_dispatch_main /home/sharpd/frr8/ldpd/ldpe.c:631:3
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-    #8 0x7f0c00c035e6 in thread_call /home/sharpd/frr8/lib/thread.c:2006:2
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-    #9 0x5586f2 in ldpe /home/sharpd/frr8/ldpd/ldpe.c:138:3
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-    #10 0x4d46d2 in main /home/sharpd/frr8/ldpd/ldpd.c:339:3
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-    #11 0x7f0c00476d09 in __libc_start_main csu/../csu/libc-start.c:308:16
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-    #12 0x429cb9 in _start (/usr/lib/frr/ldpd+0x429cb9)
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-0x61d00000c880 is located 0 bytes inside of 2008-byte region [0x61d00000c880,0x61d00000d058)
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-freed by thread T0 here:
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-    #0 0x4a3aad in free (/usr/lib/frr/ldpd+0x4a3aad)
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-    #1 0x4de6c8 in config_clear /home/sharpd/frr8/ldpd/ldpd.c:2001:2
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-    #2 0x55d12d in ldpe_shutdown /home/sharpd/frr8/ldpd/ldpe.c:211:2
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-    #3 0x55a9a0 in ldpe_dispatch_main /home/sharpd/frr8/ldpd/ldpe.c:631:3
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-    #4 0x7f0c00c035e6 in thread_call /home/sharpd/frr8/lib/thread.c:2006:2
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-    #5 0x5586f2 in ldpe /home/sharpd/frr8/ldpd/ldpe.c:138:3
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-    #6 0x4d46d2 in main /home/sharpd/frr8/ldpd/ldpd.c:339:3
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-    #7 0x7f0c00476d09 in __libc_start_main csu/../csu/libc-start.c:308:16
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-previously allocated by thread T0 here:
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-    #0 0x4a3ea2 in calloc (/usr/lib/frr/ldpd+0x4a3ea2)
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-    #1 0x4d6146 in config_new_empty /home/sharpd/frr8/ldpd/ldpd.c:1967:10
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-    #2 0x558678 in ldpe /home/sharpd/frr8/ldpd/ldpe.c:134:11
--
./isis_rlfa_topo1.test_isis_rlfa_topo1/rt8.ldpd.asan.2274142-    #4 0x7f0c00476d09 in __libc_start_main csu/../csu/libc-start.c:308:16

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agobgpd: Fix 2 read beyond end of streams in bgp srv6 packet processing 12433/head
Donald Sharp [Fri, 2 Dec 2022 16:15:54 +0000 (11:15 -0500)]
bgpd: Fix 2 read beyond end of streams in bgp srv6 packet processing

It's possible to send less data then the length you say you are.

Reported-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agovtysh: free memory given to us by readline 12443/head
Donald Sharp [Mon, 5 Dec 2022 13:26:01 +0000 (08:26 -0500)]
vtysh: free memory given to us by readline

The rl_callback_handler_install function manual says this:

Set up the terminal for Readline I/O and display the initial expanded value of prompt.
Save the value of lhandler to use as a handler function to call when a complete line
of input has been entered. The handler function receives the text of the line as an
argument. As with readline(), the handler function should free the line when it is
finished with it.

Adding a free removes this memory leak that I am seeing with address sanitizer enabled;

SUMMARY: AddressSanitizer: 99 byte(s) leaked in 5 allocation(s).:
2022-12-05 07:50:57,231 INFO: topolog.r7: vtysh result:
Hello, this is FRRouting (version 8.5-dev).
Copyright 1996-2005 Kunihiro Ishiguro, et al.

r7# clear log cmdline-targets
r7# conf t
r7(config)# log file staticd.log debug
r7(config)# log commands
r7(config)# log timestamp precision 3
r7(config)#

=================================================================
==976989==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 99 byte(s) in 5 object(s) allocated from:
    #0 0x49cadd in malloc (/usr/bin/vtysh+0x49cadd)
    #1 0x7fc57135d8e8 in xmalloc build/shlib/./xmalloc.c:59:10

SUMMARY: AddressSanitizer: 99 byte(s) leaked in 5 allocation(s).

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agoMerge pull request #12437 from proelbtn/proelbtn-fix-srv6-tests
Donald Sharp [Mon, 5 Dec 2022 12:38:18 +0000 (07:38 -0500)]
Merge pull request #12437 from proelbtn/proelbtn-fix-srv6-tests

bgpd, tests: Fix topotests for SRv6 L3VPN and misuse of sid_unregister

2 years agoMerge pull request #12439 from opensourcerouting/feature/docker_build_and_push_latest
Donald Sharp [Mon, 5 Dec 2022 12:36:40 +0000 (07:36 -0500)]
Merge pull request #12439 from opensourcerouting/feature/docker_build_and_push_latest

docker: Build docker images with Github Actions

2 years agoMerge pull request #12440 from opensourcerouting/fix/community_list_match_or
Donald Sharp [Mon, 5 Dec 2022 12:36:01 +0000 (07:36 -0500)]
Merge pull request #12440 from opensourcerouting/fix/community_list_match_or

doc: Fix BGP community-list misleading example

2 years agoMerge pull request #12442 from cscarpitta/fix/fix-srv6-behavior-in-config-write
Donald Sharp [Mon, 5 Dec 2022 12:33:46 +0000 (07:33 -0500)]
Merge pull request #12442 from cscarpitta/fix/fix-srv6-behavior-in-config-write

zebra: Fix missing newline character in the of SRv6 config write function

2 years agozebra: Add missing newline in SRv6 config write 12442/head
Carmine Scarpitta [Mon, 5 Dec 2022 08:08:23 +0000 (09:08 +0100)]
zebra: Add missing newline in SRv6 config write

The `behavior usid` command is installed under the SRv6 Locator node in
the zebra VTY. However, in the SRv6 config write function this command
is wrongly put on the same line as the `prefix X:X::X:X/M` command.
This causes a failure when an SRv6 uSID locator is configured in zebra
and  `frr-reload.py` is used to reload the FRR configuration.

This commit prepends a newline character to the  `behavior usid` command
in the SRv6 config write function. The output of `show running-config`
before and after this commit is shown below.

Before:

```
Building configuration...

Current configuration:
!
frr version 8.5-dev
!
segment-routing
 srv6
  locators
   locator loc1
    prefix fc00:0:1::/48 block-len 32 node-len 16    behavior usid
   exit
   !
  exit
  !
 exit
 !
exit
!
end
```

After:

```
Building configuration...

Current configuration:
!
segment-routing
 srv6
  locators
   locator loc1
    prefix fc00:0:1::/48 block-len 32 node-len 16
    behavior usid
   exit
   !
  exit
  !
 exit
 !
exit
!
end
```

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2 years agodoc: Update BGP community-list handling example 12440/head
Donatas Abraitis [Sun, 4 Dec 2022 20:28:26 +0000 (22:28 +0200)]
doc: Update BGP community-list handling example

Documentation ways that community-list works as OR when multiple community
values specified per entry, but it's wrong. It must be AND, let's fix this.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agotests: Check if community-list works as expected
Donatas Abraitis [Sun, 4 Dec 2022 19:52:05 +0000 (21:52 +0200)]
tests: Check if community-list works as expected

AND/OR cases.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agogithub: Build `master` daily docker images and for stable/X.Y on push 12439/head
Donatas Abraitis [Fri, 2 Dec 2022 16:06:23 +0000 (18:06 +0200)]
github: Build `master` daily docker images and for stable/X.Y on push

frrouting/frr:master will be generated every day
frrouting/frr:vX.Y.Z will be generated every time a new push is done on the
stable/X.Y branch.

Takes up to 3 hours to build and publish images.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agobgpd: Fix delete_vrf_tovpn_sid 12437/head
Ryoga Saito [Sun, 4 Dec 2022 07:53:48 +0000 (16:53 +0900)]
bgpd: Fix delete_vrf_tovpn_sid

The first argument of sid_unregister should be default bgp instance.
However, these functions passed VRF bgp instance to this funciton.

Signed-off-by: Ryoga Saito <ryoga.saito@linecorp.com>
2 years agotests: Fix topotests for bgp_srv6l3vpn
Ryoga Saito [Sun, 4 Dec 2022 07:51:24 +0000 (16:51 +0900)]
tests: Fix topotests for bgp_srv6l3vpn

In bgp_srv6l3vpn tests, check_ping checks reachability. However, this
function have a bug and if we set expect_connected to True, check will
pass even if all ping packets are lost. This commit fixes this issue.

Signed-off-by: Ryoga Saito <ryoga.saito@linecorp.com>
2 years agolib: use specific MTYPE for interface descriptions
Mark Stapp [Fri, 2 Dec 2022 16:10:24 +0000 (11:10 -0500)]
lib: use specific MTYPE for interface descriptions

Don't use MTYPE_TMP, use a real mem type.

Signed-off-by: Mark Stapp <mjs@labn.net>
2 years agoMerge pull request #12429 from opensourcerouting/fix/bgp_nits
Donald Sharp [Fri, 2 Dec 2022 15:42:18 +0000 (10:42 -0500)]
Merge pull request #12429 from opensourcerouting/fix/bgp_nits

bgpd: Cosmetic changes

2 years agodocker: Use Alpine 3.17 as base image
Donatas Abraitis [Fri, 2 Dec 2022 13:42:00 +0000 (15:42 +0200)]
docker: Use Alpine 3.17 as base image

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agobgpd: Fix unaligned output of advertised-routes, bestpath-routes, etc. 12429/head
Donatas Abraitis [Fri, 2 Dec 2022 08:36:32 +0000 (10:36 +0200)]
bgpd: Fix unaligned output of advertised-routes, bestpath-routes, etc.

This commit eaeba5e868fccba4b48145bc953774faf01a121a changed a bit a formatting,
but this part was missed, let's fix it.

An example before the patch:

```
r3# sh ip bgp ipv4 labeled-unicast neighbors 192.168.34.4 advertised-routes
BGP table version is 3, local router ID is 192.168.34.3, vrf id 0
Default local pref 100, local AS 65003
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

    Network          Next Hop            Metric LocPrf Weight Path
*> 10.0.0.1/32      0.0.0.0                                0 65001 ?

Total number of prefixes 1
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agobgpd: Do not print cumulated bandwidth prefixed with `u`
Donatas Abraitis [Fri, 2 Dec 2022 08:20:10 +0000 (10:20 +0200)]
bgpd: Do not print cumulated bandwidth prefixed with `u`

This seems just a mistake, drop `u` prefix.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoMerge pull request #12427 from mjstapp/pim6d_enabled
Jafar Al-Gharaibeh [Fri, 2 Dec 2022 05:55:55 +0000 (23:55 -0600)]
Merge pull request #12427 from mjstapp/pim6d_enabled

build: enable pim6d by default

2 years agobuild: enable pim6d by default 12427/head
Mark Stapp [Thu, 1 Dec 2022 18:57:46 +0000 (13:57 -0500)]
build: enable pim6d by default

Change configure.ac so that pim6d is enabled by default; a
command-line option can disable it.

Signed-off-by: Mark Stapp <mjs@labn.net>
2 years agoMerge pull request #12397 from opensourcerouting/vscode-intro
Donald Sharp [Thu, 1 Dec 2022 16:01:45 +0000 (11:01 -0500)]
Merge pull request #12397 from opensourcerouting/vscode-intro

lib: handle visual studio code C/C++ extension

2 years agoMerge pull request #12418 from opensourcerouting/fix/tests_for_while_true
Donald Sharp [Thu, 1 Dec 2022 16:00:23 +0000 (11:00 -0500)]
Merge pull request #12418 from opensourcerouting/fix/tests_for_while_true

Fix old tests with `while true`

2 years agoMerge pull request #12425 from cscarpitta/fix/fix-bgp-srv6l3vpn-to-bgp-vrf2-topotest
Rafael Zalamena [Thu, 1 Dec 2022 10:46:52 +0000 (07:46 -0300)]
Merge pull request #12425 from cscarpitta/fix/fix-bgp-srv6l3vpn-to-bgp-vrf2-topotest

tests: Fix `bgp_srv6l3vpn_to_bgp_vrf2` topotest failures

2 years agotests: Fix `bgp_srv6l3vpn_to_bgp_vrf2` topotest 12425/head
Carmine Scarpitta [Wed, 30 Nov 2022 21:18:49 +0000 (22:18 +0100)]
tests: Fix `bgp_srv6l3vpn_to_bgp_vrf2` topotest

The `bgp_srv6l3vpn_to_bgp_vrf2` topotest tests the SRv6 IPv4 L3VPN
functionality. It applies the appropriate configuration in `bgpd` and
`zebra`, and then checks that the RIB is updated correctly.

The topotest expects to find the AS-Path in the RIB, which is only
present if the `bgp send-extra-data zebra` option is enabled in the
`bgpd` configuration.

Currently, the `bgp send-extra-data zebra` option is not set in the
`bgpd` configuration, which always causes the topotest to fail.

This commit fixes the `bgp_srv6l3vpn_to_bgp_vrf2` topotest by enabling
the `bgp send-extra-data zebra` option for both routers `r1` and `r2`.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2 years agoMerge pull request #12325 from AbhishekNR/ttable_pim_nexthop
Donatas Abraitis [Wed, 30 Nov 2022 19:40:30 +0000 (21:40 +0200)]
Merge pull request #12325 from AbhishekNR/ttable_pim_nexthop

pimd, pim6d: Using ttable for displaying "show ip/ipv6 pim nexthop" command output

2 years agoMerge pull request #12416 from opensourcerouting/fix/inet_ntop
mobash-rasool [Wed, 30 Nov 2022 18:27:11 +0000 (23:57 +0530)]
Merge pull request #12416 from opensourcerouting/fix/inet_ntop

bgpd: inet_ntop() adjustments

2 years agotests: Improve `bgp_maximum_prefix_invalid_update` test case 12418/head
Donatas Abraitis [Wed, 30 Nov 2022 15:22:43 +0000 (17:22 +0200)]
tests: Improve `bgp_maximum_prefix_invalid_update` test case

Drop `grep'ing` stuff, and check JSON data if notification was send or not.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agovtysh: add motd command 12410/head
Sergei Rozhkov [Mon, 28 Nov 2022 11:14:25 +0000 (16:14 +0500)]
vtysh: add motd command

Add "show motd" commad.
The vtysh user can call the "show motd" command to re-show the welcome message.
This is necessary if the user saves frequently used commands in motd.

Signed-off-by: Sergei Rozhkov <gh@zserg.ru>
2 years agoMerge pull request #12367 from rgirada/ospf_valgrind_fix
Russ White [Tue, 29 Nov 2022 16:23:27 +0000 (11:23 -0500)]
Merge pull request #12367 from rgirada/ospf_valgrind_fix

ospfd: Fixing a memleak.

2 years agobgpd: inet_ntop() adjustments 12416/head
Donatas Abraitis [Tue, 29 Nov 2022 08:23:20 +0000 (10:23 +0200)]
bgpd: inet_ntop() adjustments

Use %pI4/%pI6 where possible, otherwise at least atjust stack buffer sizes
for inet_ntop() calls.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoMerge pull request #12334 from ylopez/patch-1
Russ White [Tue, 29 Nov 2022 15:11:32 +0000 (10:11 -0500)]
Merge pull request #12334 from ylopez/patch-1

Increase maximum packet size in ospf API

2 years agoMerge pull request #12384 from opensourcerouting/feature/snmp_bgp4V2PeerErrorsTable
Russ White [Tue, 29 Nov 2022 15:05:29 +0000 (10:05 -0500)]
Merge pull request #12384 from opensourcerouting/feature/snmp_bgp4V2PeerErrorsTable

bgpd: Implement SNMP BGP4V2-MIB (bgp4V2PeerErrorsTable)

2 years agoMerge pull request #12386 from opensourcerouting/bfd-ipv4-source-bind
Russ White [Tue, 29 Nov 2022 15:03:44 +0000 (10:03 -0500)]
Merge pull request #12386 from opensourcerouting/bfd-ipv4-source-bind

bfdd: fix IPv4 socket source selection

2 years agobgpd: Adjust received prefix count only when we validate the nexthop
Donatas Abraitis [Tue, 29 Nov 2022 14:56:36 +0000 (16:56 +0200)]
bgpd: Adjust received prefix count only when we validate the nexthop

bgp_pcount_adjust() is called only when calling bgp_path_info_set_flag().

Before this patch the pcount is not advanced before checking for overflow.

Additionally, print:

```
[RZMGQ-A03CG] 192.168.255.1(r1) rcvd UPDATE about 172.16.255.254/32 IPv4 unicast -- DENIED due to: maximum-prefix overflow
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agotests: Refactor bgp_maximum_prefix_invalid_update test case
Donatas Abraitis [Tue, 29 Nov 2022 13:30:11 +0000 (15:30 +0200)]
tests: Refactor bgp_maximum_prefix_invalid_update test case

Just drop `while true` stuff.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoMerge pull request #12329 from opensourcerouting/feature/graceful-shutdown_per_peer
Russ White [Tue, 29 Nov 2022 13:47:20 +0000 (08:47 -0500)]
Merge pull request #12329 from opensourcerouting/feature/graceful-shutdown_per_peer

bgpd: Implement graceful-shutdown command per neighbor

2 years agotests: Refactor bgp_local_as_private_remove test case
Donatas Abraitis [Tue, 29 Nov 2022 13:19:56 +0000 (15:19 +0200)]
tests: Refactor bgp_local_as_private_remove test case

Just drop `while true` stuff.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agotests: Refactor bgp_comm-list_delete test case
Donatas Abraitis [Tue, 29 Nov 2022 13:08:09 +0000 (15:08 +0200)]
tests: Refactor bgp_comm-list_delete test case

Just drop `while true` stuff.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoMerge pull request #12413 from donaldsharp/misc_and_then_some
Donatas Abraitis [Tue, 29 Nov 2022 08:27:43 +0000 (10:27 +0200)]
Merge pull request #12413 from donaldsharp/misc_and_then_some

Misc and then some

2 years agoMerge pull request #12375 from chiragshah6/fdev1
Donatas Abraitis [Tue, 29 Nov 2022 07:39:53 +0000 (09:39 +0200)]
Merge pull request #12375 from chiragshah6/fdev1

zebra: json support for show ip nht

2 years agozebra: json support for show ip nht 12375/head
Sindhu Parvathi Gopinathan [Tue, 15 Nov 2022 03:33:56 +0000 (19:33 -0800)]
zebra: json support for show ip nht

show ip/ipv6 nht vrf <all | name> json support added.

Commands enhanced with JSON:
----------------------------
show ip nht json
show ip nht <addr> json
show ipv6 nht json
show ipv6 nht <addr> json
show ip nht vrf <name> json
show ip nht vrf all json
show ipv6 nht vrf <name> json
show ipv6 nht vrf all json
show ip nht vrf default <addr> json
show ipv6 nht vrf default <addr> json

Sample JSON output:
-------------------

tor-1# show ip nht vrf default json
{
  "default":{
    "nexthops":{
      "27.0.0.5":{
        "nhtConnected":false,
        "clientList":[
          {
            "protocol":"bgp",
            "socket":70,
            "protocolFiltered":"none"
          }
        ],
        "gates":[
          {
            "ip":"fe80::202:ff:fe00:2b",
            "interface":"uplink_1"
          },
          {
            "ip":"fe80::202:ff:fe00:35",
            "interface":"uplink_2"
          }
        ],
        "resolvedProtocol":"bgp"
      },
      "27.0.0.6":{
        "nhtConnected":false,
        "clientList":[
          {
            "protocol":"bgp",
            "socket":70,
            "protocolFiltered":"none"
          }
        ],
        "gates":[
          {
            "ip":"fe80::202:ff:fe00:2b",
            "interface":"uplink_1"
          },
          {
            "ip":"fe80::202:ff:fe00:35",
            "interface":"uplink_2"
          }
        ],
        "resolvedProtocol":"bgp"
      }
    }
  }
}

tor-1# show ipv6 nht vrf default json
{
  "default": {
    "nexthops": {
      "fe80::202:ff:fe00:25": {
        "nhtConnected": true,
        "clientList": [
          {
            "protocol": "bgp",
            "socket": 45,
            "protocolFiltered": "none"
          }
        ],
        "gates": [
          {
            "interface": "swp1",
            "directlyConnected": true
          }
        ],
        "resolvedProtocol": "connected"
      },
      "fe80::202:ff:fe00:2b": {
        "nhtConnected": true,
        "clientList": [
          {
            "protocol": "bgp",
            "socket": 45,
            "protocolFiltered": "none"
          }
        ],
        "gates": [
          {
            "interface": "swp1",
            "directlyConnected": true
          }
        ],
        "resolvedProtocol": "connected"
      }
    }
  }
}

tor-1# show ipv6 nht vrf all json
{
  "default": {
    "nexthops": {
      "fe80::202:ff:fe00:25": {
        "nhtConnected": true,
        "clientList": [
          {
            "protocol": "bgp",
            "socket": 45,
            "protocolFiltered": "none"
          }
        ],
        "gates": [
          {
            "interface": "swp1",
            "directlyConnected": true
          }
        ],
        "resolvedProtocol": "connected"
      },
      "fe80::202:ff:fe00:2b": {
        "nhtConnected": true,
        "clientList": [
          {
            "protocol": "bgp",
            "socket": 45,
            "protocolFiltered": "none"
          }
        ],
        "gates": [
          {
            "interface": "swp1",
            "directlyConnected": true
          }
        ],
        "resolvedProtocol": "connected"
      }
    }
  },
  "mgmt": {
    "nexthops": {}
  },
  "sym_1": {
    "nexthops": {}
  }
}

Ticket:#3229013
Issue:3229013

Testing Done: Unit test completed.

Signed-off-by: Chirag Shah <chirag@nvidia.com>
Signed-off-by: Sindhu Parvathi Gopinathan <sgopinathan@nvidia.com>
2 years agodoc: add vrrp interoperability help and command 12390/head
Siger Yang [Mon, 28 Nov 2022 19:59:23 +0000 (03:59 +0800)]
doc: add vrrp interoperability help and command

Add VRRPv3 `checksum-with-ipv4-pseudoheader` command and
interoperability help text.

Signed-off-by: Siger Yang <siger.yang@outlook.com>
2 years agoMerge pull request #12414 from opensourcerouting/fix/update_workflow
Jafar Al-Gharaibeh [Mon, 28 Nov 2022 19:36:54 +0000 (14:36 -0500)]
Merge pull request #12414 from opensourcerouting/fix/update_workflow

Some doc changes

2 years agodoc: Do not forget to update the reference table for release dates 12414/head
Donatas Abraitis [Mon, 28 Nov 2022 15:31:29 +0000 (17:31 +0200)]
doc: Do not forget to update the reference table for release dates

As a part of release, an additional checkpoint when creating a stabilization
branch.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agodoc: Update release dates and add a hint on how to get dates correctly
Donatas Abraitis [Mon, 28 Nov 2022 15:26:39 +0000 (17:26 +0200)]
doc: Update release dates and add a hint on how to get dates correctly

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoospf6d: Consolidate to ospf6_route_is_identical 12413/head
Donald Sharp [Mon, 28 Nov 2022 14:46:39 +0000 (09:46 -0500)]
ospf6d: Consolidate to ospf6_route_is_identical

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agoospf6d: ospf6_route_cmp_nexthops make return sane
Donald Sharp [Mon, 28 Nov 2022 14:41:03 +0000 (09:41 -0500)]
ospf6d: ospf6_route_cmp_nexthops make return sane

The ospf6_route_cmp_nexthops function was returning 0 for same
and 1 for not same.  Let's reverse the polarity and actually make
the returns useful long term.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agoospfd: Do not auto-debug DR-Election notifications
Donald Sharp [Mon, 28 Nov 2022 13:57:38 +0000 (08:57 -0500)]
ospfd: Do not auto-debug DR-Election notifications

Every 1/2 hour my logs are filling up with this:
2022-11-26 13:54:47.531 [DEBG] ospfd: [P4PQ9-K4XFD] DR-Election[1st]: Backup 192.168.119.229
2022-11-26 13:54:47.531 [DEBG] ospfd: [HBZ7F-65Y86] DR-Election[1st]: DR     192.168.119.229
2022-11-26 13:54:47.531 [DEBG] ospfd: [H01MF-RN00N] DR-Election[2nd]: Backup 0.0.0.0
2022-11-26 13:54:47.531 [DEBG] ospfd: [R7BJ4-KP8JT] DR-Election[2nd]: DR     192.168.119.229

This should be guarded by an if check to ensure that the operator really
wants to see this.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agoospfd: Do not always debug joining AllDRouters Multicast group
Donald Sharp [Mon, 28 Nov 2022 13:53:20 +0000 (08:53 -0500)]
ospfd: Do not always debug joining AllDRouters Multicast group

My log file is filling up with:
2022-11-26 13:24:47.532 [DEBG] ospfd: [RY794-DQ7AK] interface 192.168.119.229 [2] join AllDRouters Multicast group.

Every 1/2 hour.  There is nothing an operator needs to do here and nothing
that they can change.  Let's guard this output.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agobgpd: Null checking is not needed on failure
Donald Sharp [Mon, 28 Nov 2022 13:52:48 +0000 (08:52 -0500)]
bgpd: Null checking is not needed on failure

Memory allocations that fail crash the program.  Checking
for NULL is not going to do anything.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agoMerge pull request #12389 from opensourcerouting/ospf6d-asbr-infinite-loop
Donald Sharp [Mon, 28 Nov 2022 13:45:50 +0000 (08:45 -0500)]
Merge pull request #12389 from opensourcerouting/ospf6d-asbr-infinite-loop

ospf6d: fix infinite loop when adding ASBR route

2 years agotopotest: add test for confederation 12322/head
Francois Dumontet [Wed, 23 Nov 2022 14:35:14 +0000 (15:35 +0100)]
topotest: add test for confederation

add a test dedicated to confederation. it also take into
account the support of AS memberwith same id  that the
confederation id.

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
2 years agoMerge pull request #12405 from opensourcerouting/static-improv
Donald Sharp [Mon, 28 Nov 2022 13:13:09 +0000 (08:13 -0500)]
Merge pull request #12405 from opensourcerouting/static-improv

staticd: improve CLI/northbound translation code

2 years agoMerge pull request #12342 from opensourcerouting/fix/small_waiting_times
Donald Sharp [Mon, 28 Nov 2022 13:10:23 +0000 (08:10 -0500)]
Merge pull request #12342 from opensourcerouting/fix/small_waiting_times

tests: Fail tests immediately if they use too low wait/count values

2 years agoMerge pull request #12363 from opensourcerouting/feature/add_size_label_github
Donald Sharp [Mon, 28 Nov 2022 12:48:52 +0000 (07:48 -0500)]
Merge pull request #12363 from opensourcerouting/feature/add_size_label_github

github: Create size label for every PR

2 years agoMerge pull request #12408 from opensourcerouting/fix/mpls_vtysh_print
Donald Sharp [Mon, 28 Nov 2022 12:48:16 +0000 (07:48 -0500)]
Merge pull request #12408 from opensourcerouting/fix/mpls_vtysh_print

zebra: Use `mpls enable`, not `mpls` when generating a config

2 years agolib: handle visual studio code C/C++ extension 12397/head
Rafael Zalamena [Mon, 28 Nov 2022 11:19:59 +0000 (08:19 -0300)]
lib: handle visual studio code C/C++ extension

Add some `pragma`s to handle errors that the C/C++ extension is not able
to understand.

Move `TRANSPARENT_UNION` to `lib/compiler.h` for consistency.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2 years agoMerge pull request #12369 from mruprich/frr-run-as-non-root
Donatas Abraitis [Mon, 28 Nov 2022 09:31:36 +0000 (11:31 +0200)]
Merge pull request #12369 from mruprich/frr-run-as-non-root

tools: Enable start of FRR for non-root user

2 years agozebra: Use `mpls enable`, not `mpls` when generating a config 12408/head
Donatas Abraitis [Mon, 28 Nov 2022 09:14:06 +0000 (11:14 +0200)]
zebra: Use `mpls enable`, not `mpls` when generating a config

If we enable MPLS for an interface via sysctl, we should write `mpls enable`,
not `mpls`.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoMerge pull request #12403 from donaldsharp/echo_exclusion
Donatas Abraitis [Mon, 28 Nov 2022 08:07:44 +0000 (10:07 +0200)]
Merge pull request #12403 from donaldsharp/echo_exclusion

Echo exclusion

2 years agoMerge pull request #12399 from opensourcerouting/fix/static_color_crash
mobash-rasool [Sat, 26 Nov 2022 19:25:40 +0000 (00:55 +0530)]
Merge pull request #12399 from opensourcerouting/fix/static_color_crash

staticd: Fix crash for an existing route with color

2 years agolib: Do not log `echo PING` commands from watchfrr 12403/head
Donald Sharp [Sat, 26 Nov 2022 14:23:50 +0000 (09:23 -0500)]
lib: Do not log `echo PING` commands from watchfrr

Since the `echo PING` commands are from watchfrr and are sent
a whole bunch when an operator has `log commands` on the amount
of logging done is quite significant.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agozebra: Fix tracepoint changes for lttng
Donald Sharp [Sat, 26 Nov 2022 14:28:14 +0000 (09:28 -0500)]
zebra: Fix tracepoint changes for lttng

The recent tracepoint additions in c317d3f246769e8261df0f9d1eb787bea7b5da06
did not properly setup the tracepoints for lttng.  Fix this.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agostaticd: improve CLI/northbound translation code 12405/head
Rafael Zalamena [Fri, 25 Nov 2022 18:59:21 +0000 (15:59 -0300)]
staticd: improve CLI/northbound translation code

Simplify all DEFUNs by moving all logic to the northbound translation
function and transforming all function parameters into a single
structure.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2 years agoMerge pull request #12370 from opensourcerouting/fix/crash_rmap_vpn_nexthop
Jafar Al-Gharaibeh [Fri, 25 Nov 2022 15:18:40 +0000 (10:18 -0500)]
Merge pull request #12370 from opensourcerouting/fix/crash_rmap_vpn_nexthop

bgpd: Fix crash for `set ipv4/ipv6 vpn next-hop` command

2 years agobgp: fix case where confederation id same as member-as
Francois Dumontet [Tue, 8 Nov 2022 15:25:15 +0000 (16:25 +0100)]
bgp:  fix case where confederation id same as member-as

currently the following configuration

dut:

!
interface ntfp2
 ip router isis 1
!
router bgp 200
 no bgp ebgp-requires-policy
 bgp confederation identifier 300
 bgp confederation peers 300
 neighbor 192.168.1.1 remote-as 100
 neighbor 192.168.2.2 remote-as 300
 !
 address-family ipv4 unicast
  neighbor 192.168.2.2 default-originate
 exit-address-family
!
router isis 1
 is-type level-2-only
 net 49.0001.0002.0002.0002.00
 redistribute ipv4 connected level-2
!
end

router:

!
interface ntfp2
 ip router isis 1
 isis circuit-type level-2-only
!
router bgp 300
 no bgp ebgp-requires-policy
 bgp confederation identifier 300
 bgp confederation peers 200
 neighbor 192.168.2.1 remote-as 200
 neighbor 192.168.3.2 remote-as 400
 !
 address-family ipv4 unicast
  network 3.3.3.0/24
 exit-address-family
!
router isis 1
 is-type level-2-only
 net 49.0001.0003.0003.0003.00
 redistribute ipv4 connected level-2
!
end

on dut result of show bgp ipv4 unicast command is:
show bgp ipv4 unicast

  BGP table version is 1, local router ID is 192.168.2.1, vrf id 0
  Default local pref 100, local AS 200
  Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
                 i internal, r RIB-failure, S Stale, R Removed
  Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
  Origin codes:  i - IGP, e - EGP, ? - incomplete
  RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
  *> 1.1.1.0/24       192.168.1.1              0             0 100 i

instead of

sho bgp ipv4 unicast
BGP table version is 3, local router ID is 192.168.2.1, vrf id 0
Default local pref 100, local AS 200
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

   Network          Next Hop            Metric LocPrf Weight Path
*> 1.1.1.0/24       192.168.1.1              0             0 100 i
*> 3.3.3.0/24       192.168.2.2              0    100      0 (300) i
*> 4.4.4.0/24       192.168.3.2              0    100      0 (300) 400 i

Displayed  3 routes and 3 total paths

According to RFC 5065:the usage of one of the member AS number as the
confederation identifier is not forbidden.

fixes are the following

in bgp_route.c:
in bgp_update remove the test for presence of confederation id in
as_path since, this case is allowed;

in bgp_vty.c
bgp_confederation_peers, remove the test on peer as value

in bgpd.c
bgp_confederation_peers_add
remove the test on peer as value
invert the order of setting peer->sort value and peer->local_as,
since peer->sort is depending from current peer->local_as value

bgp_confederation_peers_remove
invert the order of setting peer->sort value and peer->local_as,
since peer->sort is depending from current peer->local_as value

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
2 years agostaticd: Do not crash when modifying an existing static route with color 12399/head
Donatas Abraitis [Fri, 25 Nov 2022 14:19:28 +0000 (16:19 +0200)]
staticd: Do not crash when modifying an existing static route with color

```
$ vtysh -c 'conf' -c 'ip route 192.168.0.0/32 192.168.10.65 color 123'
$ vtysh -c 'show ip route 192.168.0.0/32 json' | jq '."192.168.0.0/32"[0].nexthops[0].srteColor'
123
$ vtysh -c 'conf' -c 'ip route 192.168.0.0/32 192.168.10.65'
$ vtysh -c 'show ip route 192.168.0.0/32 json' | jq '."192.168.0.0/32"[0].nexthops[0].srteColor'
0
```

Before this patch:
```
STATIC: Received signal 6 at 1666938633 (si_addr 0x4e1a, PC 0x7f295139c438); aborting...
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(zlog_backtrace_sigsafe+0x70) [0x7f29519ef0a0]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(zlog_signal+0xec) [0x7f29519ef28c]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(+0xccee2) [0x7f2951a1aee2]
STATIC: /lib/x86_64-linux-gnu/libpthread.so.0(+0x11390) [0x7f2951742390]
STATIC: /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38) [0x7f295139c438]
STATIC: /lib/x86_64-linux-gnu/libc.so.6(abort+0x16a) [0x7f295139e03a]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(_zlog_assert_failed+0xe6) [0x7f2951a46766]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(+0xae7ee) [0x7f29519fc7ee]
STATIC: /home/u1/mGIT/frr-master/staticd/.libs/lt-staticd(routing_control_plane_protocols_control_plane_protocol_staticd_route_list_src_
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(+0xaf264) [0x7f29519fd264]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(+0xafb4f) [0x7f29519fdb4f]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(nb_candidate_commit_apply+0x33) [0x7f29519fde33]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(nb_candidate_commit+0x9e) [0x7f29519fdf6e]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(+0xb0469) [0x7f29519fe469]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(+0xb3055) [0x7f2951a01055]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(nb_cli_apply_changes+0xd8) [0x7f2951a01358]
STATIC: /home/u1/mGIT/frr-master/staticd/.libs/lt-staticd() [0x407ec2]
STATIC: /home/u1/mGIT/frr-master/staticd/.libs/lt-staticd() [0x40a307]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(+0x74923) [0x7f29519c2923]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(cmd_execute_command+0xe4) [0x7f29519c2aa4]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(cmd_execute+0xc9) [0x7f29519c2c49]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(+0xe4184) [0x7f2951a32184]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(+0xe4436) [0x7f2951a32436]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(+0xe6fcc) [0x7f2951a34fcc]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(thread_call+0x98) [0x7f2951a2cc28]
STATIC: /home/u1/mGIT/frr-master/lib/.libs/libfrr.so.0(frr_run+0xe8) [0x7f29519e7518]
STATIC: /home/u1/mGIT/frr-master/staticd/.libs/lt-staticd(main+0xda) [0x40572a]
STATIC: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7f2951387840]
STATIC: /home/u1/mGIT/frr-master/staticd/.libs/lt-staticd(_start+0x29) [0x4058e9]
STATIC: in thread vtysh_read scheduled from lib/vty.c:2710 vty_event()
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>