]> git.proxmox.com Git - mirror_frr.git/log
mirror_frr.git
18 months agoMerge pull request #12471 from opensourcerouting/fix/gh_actions_on_forks_forbidden
Mark Stapp [Fri, 9 Dec 2022 13:34:55 +0000 (08:34 -0500)]
Merge pull request #12471 from opensourcerouting/fix/gh_actions_on_forks_forbidden

github: Prevent running actions on forked repositories

18 months agoMerge pull request #12470 from donaldsharp/cleanup_topos
Donatas Abraitis [Fri, 9 Dec 2022 07:20:00 +0000 (09:20 +0200)]
Merge pull request #12470 from donaldsharp/cleanup_topos

tests: ospf_gr_helper tests are slow

18 months agoMerge pull request #12473 from donaldsharp/ensure_used
Donatas Abraitis [Fri, 9 Dec 2022 07:17:45 +0000 (09:17 +0200)]
Merge pull request #12473 from donaldsharp/ensure_used

bgpd: Don't always allocate json memory in non-json path

18 months agobgpd: Don't always allocate json memory in non-json path
Donald Sharp [Thu, 8 Dec 2022 23:22:17 +0000 (18:22 -0500)]
bgpd: Don't always allocate json memory in non-json path

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
18 months agogithub: Prevent running actions on forked repositories
Donatas Abraitis [Thu, 8 Dec 2022 20:54:28 +0000 (22:54 +0200)]
github: Prevent running actions on forked repositories

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
18 months agoMerge pull request #12463 from opensourcerouting/fix/totalPrefixCounter_with_default_...
Donald Sharp [Thu, 8 Dec 2022 19:31:31 +0000 (14:31 -0500)]
Merge pull request #12463 from opensourcerouting/fix/totalPrefixCounter_with_default_originate

bgpd: totalPrefixCounter incorectly shows sent prefix count

18 months agoMerge pull request #12468 from mjstapp/fix_log_command_types
Donald Sharp [Thu, 8 Dec 2022 19:22:36 +0000 (14:22 -0500)]
Merge pull request #12468 from mjstapp/fix_log_command_types

lib: fix zlog command types table

18 months agotests: ospf_gr_helper tests are slow
Donald Sharp [Thu, 8 Dec 2022 15:25:34 +0000 (10:25 -0500)]
tests: ospf_gr_helper tests are slow

With a dead interval of 40 seconds, each tests is waiting 40+
seconds for ospf convergence to occurr because the DR is re-elected

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
18 months agoMerge pull request #12430 from opensourcerouting/accords
Quentin Young [Thu, 8 Dec 2022 17:39:48 +0000 (12:39 -0500)]
Merge pull request #12430 from opensourcerouting/accords

18 months agolib: fix zlog command types table
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>
18 months agoMerge pull request #12461 from donaldsharp/evpn_mh_crash
Donatas Abraitis [Thu, 8 Dec 2022 14:35:11 +0000 (16:35 +0200)]
Merge pull request #12461 from donaldsharp/evpn_mh_crash

bgpd: Prevent crash in evpn when using default vrf

18 months agodoc: introduce FRR community "accords"
David Lamparter [Fri, 2 Dec 2022 10:39:56 +0000 (11:39 +0100)]
doc: introduce FRR community "accords"

The idea here is to pass "non-code agreements" through the PR review
mechanism, and have them visible in the git tree.

Two "example" (but real) accords are included, mostly to illustrate the
idea.  Both of these should be non-controversial and have had some
previous discussion in random places.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
18 months agobgpd: totalPrefixCounter incorectly shows sent prefix count
Donatas Abraitis [Wed, 7 Dec 2022 21:31:36 +0000 (23:31 +0200)]
bgpd: totalPrefixCounter incorectly shows sent prefix count

Using: show bgp ipv4 unicast neighbors 192.168.12.2 advertised-routes json

Before:

```
  "bgpOriginatingDefaultNetwork":"0.0.0.0\/0",
  "advertisedRoutes":{
    "192.168.12.0\/24":{
      "addrPrefix":"192.168.12.0",
      "prefixLen":24,
      "network":"192.168.12.0\/24",
      "nextHop":"0.0.0.0",
      "metric":0,
      "weight":32768,
      "path":"",
      "bgpOriginCode":"?",
      "appliedStatusSymbols":{
        "*":true,
        ">":true
      }
    }
  },
  "totalPrefixCounter":1,
  "filteredPrefixCounter":0
```

After:

```
  "bgpOriginatingDefaultNetwork":"0.0.0.0\/0",
  "advertisedRoutes":{
    "192.168.12.0\/24":{
      "addrPrefix":"192.168.12.0",
      "prefixLen":24,
      "network":"192.168.12.0\/24",
      "nextHop":"0.0.0.0",
      "metric":0,
      "weight":32768,
      "path":"",
      "bgpOriginCode":"?",
      "appliedStatusSymbols":{
        "*":true,
        ">":true
      }
    }
  },
  "totalPrefixCounter":2,
  "filteredPrefixCounter":0
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
18 months agobgpd: Prevent crash in evpn when using default vrf
Donald Sharp [Wed, 7 Dec 2022 19:06:12 +0000 (14:06 -0500)]
bgpd: Prevent crash in evpn when using default vrf

The default vrf in bgp when created, ends up having the
bgp->name as NULL.  This of course crashes the ilk
of `json_object_string_add` when a NULL is passed in.

Go through all the places in bgp_evpn_mh.c and fix
so that it doesn't crash.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
18 months agoMerge pull request #12460 from opensourcerouting/msdp-fixes
Donald Sharp [Wed, 7 Dec 2022 18:17:25 +0000 (13:17 -0500)]
Merge pull request #12460 from opensourcerouting/msdp-fixes

pimd: two MSDP packet handling fixes

18 months agopimd: fix MSDP packet debug crashes
Rafael Zalamena [Wed, 7 Dec 2022 14:49:26 +0000 (11:49 -0300)]
pimd: fix MSDP packet debug crashes

Add some safe guards to avoid crashes and alert us about programming
errors in packet build.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
18 months agopimd: fix MSDP crash on unexpected TLV sizes
Rafael Zalamena [Wed, 7 Dec 2022 14:48:47 +0000 (11:48 -0300)]
pimd: fix MSDP crash on unexpected TLV sizes

Increase the MSDP peer stream buffer size to handle the whole TLV
(maximum is 65KiB due to 16bit field). If the stream is not resized
there will be a crash in the read function attempting to put more than
9192 (`PIM_MSDP_SA_TLV_MAX_SIZE`) bytes.

According to the RFC 3618 Section 12 we should accept the TLV and we
should not reset the peer connection.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
18 months 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

18 months agobgpd: Adopt addpath functionality for labeled-unicast
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>
18 months 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>
18 months 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

18 months 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

18 months 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

18 months 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>
18 months agoRevert "tools: stop zebra daemon last"
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>
18 months 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

18 months 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

18 months 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

18 months 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

18 months 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

18 months 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

18 months 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

18 months 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

18 months agobgpd: Make bgp_keepalives.c not use MTYPE_TMP
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>
18 months 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>
18 months 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>
18 months 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>
18 months agozebra: use real MTYPEs for various objects
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>
18 months agobgpd: Change fsm to use an enum for passing state
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>
18 months 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>
18 months 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>
18 months 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>
18 months 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>
18 months 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>
18 months 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>
18 months 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>
18 months 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>
18 months agovtysh: Cleanup memory leak
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>
18 months 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>
18 months 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>
18 months agobgpd: Fix 2 read beyond end of streams in bgp srv6 packet processing
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>
18 months agovtysh: free memory given to us by readline
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>
18 months 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

18 months 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

18 months 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

18 months 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

18 months agozebra: Add missing newline in SRv6 config write
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>
18 months agodoc: Update BGP community-list handling example
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>
18 months 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>
18 months agogithub: Build `master` daily docker images and for stable/X.Y on push
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>
18 months agobgpd: Fix delete_vrf_tovpn_sid
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>
18 months 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>
18 months 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>
18 months 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

18 months 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>
18 months agobgpd: Fix unaligned output of advertised-routes, bestpath-routes, etc.
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>
18 months 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>
18 months 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

18 months agobuild: enable pim6d by default
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>
18 months 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

18 months 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`

18 months 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

18 months agotests: Fix `bgp_srv6l3vpn_to_bgp_vrf2` topotest
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>
18 months 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

18 months 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

18 months agotests: Improve `bgp_maximum_prefix_invalid_update` test case
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>
18 months agovtysh: add motd command
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>
18 months 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.

18 months agobgpd: inet_ntop() adjustments
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>
18 months 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

18 months 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)

18 months 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

18 months 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>
18 months 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>
18 months 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

18 months 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>
18 months 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>
18 months 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

18 months 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

18 months agozebra: json support for show ip nht
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>
18 months agodoc: add vrrp interoperability help and command
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>
18 months 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

18 months agodoc: Do not forget to update the reference table for release dates
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>
18 months 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>
18 months agoospf6d: Consolidate to ospf6_route_is_identical
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>
18 months 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>
18 months 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>
18 months 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>
18 months 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>
18 months 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