]> git.puffer.fish Git - matthieu/frr.git/log
matthieu/frr.git
2 years agopimd: Fix (S,G) debug issue
Sarita Patra [Wed, 14 Dec 2022 12:37:07 +0000 (04:37 -0800)]
pimd: Fix (S,G) debug issue

Signed-off-by: Sarita Patra <saritap@vmware.com>
2 years agoMerge pull request #12499 from opensourcerouting/ospf-vertex-leak
Donald Sharp [Mon, 12 Dec 2022 23:36:07 +0000 (18:36 -0500)]
Merge pull request #12499 from opensourcerouting/ospf-vertex-leak

ospfd: fix memory leak on SPF calculation

2 years agoMerge pull request #12498 from Jafaral/ospf-typo
Donald Sharp [Mon, 12 Dec 2022 23:35:53 +0000 (18:35 -0500)]
Merge pull request #12498 from Jafaral/ospf-typo

ospfd: fix typo and report the link name in the warning

2 years agoMerge pull request #12485 from opensourcerouting/fix/crash_attrinfo
Donald Sharp [Mon, 12 Dec 2022 18:55:23 +0000 (13:55 -0500)]
Merge pull request #12485 from opensourcerouting/fix/crash_attrinfo

bgpd: Fix crash for `show bgp attribute-info`

2 years agoospfd: fix memory leak on SPF calculation
Rafael Zalamena [Mon, 12 Dec 2022 18:11:27 +0000 (15:11 -0300)]
ospfd: fix memory leak on SPF calculation

Fix the following problems:
- Always free vertex next hops on `vertex_parent_free`
- Signalize failure on `ospf_spf_add_parent` when parent already exists
  so the caller has the chance to `free()` any allocated resources.
- Don't reuse vertex next hops without the reference count logic in
  `ospf_nexthop_calculation`. Instead allocate a new copy so it can be
  `free()`d later without complications

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2 years agoMerge pull request #12496 from opensourcerouting/ldpd-memleak-plug
Mark Stapp [Mon, 12 Dec 2022 16:14:10 +0000 (11:14 -0500)]
Merge pull request #12496 from opensourcerouting/ldpd-memleak-plug

lib: fix capability double resource allocation

2 years agoospfd: fix typo and report the link name in the warning
Jafar Al-Gharaibeh [Mon, 12 Dec 2022 15:12:34 +0000 (09:12 -0600)]
ospfd: fix typo and report the link name in the warning

Submitted-by: Marc Boucher <marc@airvitesse.net>
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2 years agolib: fix capability double resource allocation
Rafael Zalamena [Mon, 12 Dec 2022 12:48:33 +0000 (09:48 -0300)]
lib: fix capability double resource allocation

Don't let `zprivs_caps_init` allocate resources without checking if
there were other caps previously allocated.

This fixes a memory leak that happens on daemons that `fork()` and reuse
the `<daemon>_di` (see `ldpd`/`lde`/`ldpe` code).

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2 years agoMerge pull request #12487 from anlancs/fix/fix-doc-ospf
Donatas Abraitis [Sun, 11 Dec 2022 19:38:30 +0000 (21:38 +0200)]
Merge pull request #12487 from anlancs/fix/fix-doc-ospf

doc: fix an incomplete command for ospf

2 years agoMerge pull request #12457 from donaldsharp/nexthop_free
Donatas Abraitis [Sun, 11 Dec 2022 19:37:27 +0000 (21:37 +0200)]
Merge pull request #12457 from donaldsharp/nexthop_free

bgpd: BGP fails to free the nexthop node

2 years agobgpd: Fix crash for `show bgp attribute-info`
Donatas Abraitis [Fri, 9 Dec 2022 20:46:54 +0000 (22:46 +0200)]
bgpd: Fix crash for `show bgp attribute-info`

attr->srv6_vpn might be NULL as well. Let's check both.

Happened after 073801481b0f298a22fa71ee7bbac74adb5e80b9.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agotests: Add a test to show that BGP does not crash with unnumbered interfaces
Donald Sharp [Wed, 7 Dec 2022 12:54:58 +0000 (07:54 -0500)]
tests: Add a test to show that BGP does not crash with unnumbered interfaces

This series of events will crash BGP prior to the prior commit:

a) Configure an interfaced based peering
b) Shut the interface the peering is over
c) remove the peering from bgp

Show that this no longer happens

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agobgpd: BGP fails to free the nexthop node
Pooja Jagadeesh Doijode [Sat, 8 Oct 2022 00:07:46 +0000 (17:07 -0700)]
bgpd: BGP fails to free the nexthop node

In case of BGP unnumbered, BGP fails to free the nexthop
node for peer if the interface is shutdown before
unconfiguring/deleting the BGP neighbor.

This is because, when the interface is shutdown,
peer's LL neighbor address will be cleared. Therefore,
during neighbor deletion, since the peer's neighbor
address is not available, BGP will skip freeing the
nexthop node of this peer. This results in a stale
nexthop node that points to a peer that's already
been freed.

Ticket: 3191547
Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2 years agodoc: fix an incomplete command for ospf
anlan_cs [Wed, 7 Dec 2022 07:00:27 +0000 (15:00 +0800)]
doc: fix an incomplete command for ospf

The command of "show ip ospf" is incomplete. But "show ipv6 ospf" is fine.

Just complete it with actual parameters.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2 years agoMerge pull request #12472 from donaldsharp/asic_offload_doc
Jafar Al-Gharaibeh [Sat, 10 Dec 2022 02:21:33 +0000 (20:21 -0600)]
Merge pull request #12472 from donaldsharp/asic_offload_doc

doc: Clarify asic offload documentation in zebra

2 years agoMerge pull request #12482 from donaldsharp/mem_this
Jafar Al-Gharaibeh [Sat, 10 Dec 2022 02:19:28 +0000 (20:19 -0600)]
Merge pull request #12482 from donaldsharp/mem_this

Mem this

2 years agoMerge pull request #12462 from opensourcerouting/fix/default_originate_labeled_unicast
Donald Sharp [Sat, 10 Dec 2022 00:44:58 +0000 (19:44 -0500)]
Merge pull request #12462 from opensourcerouting/fix/default_originate_labeled_unicast

bgpd: Labeled unicast with default-originate

2 years agoMerge pull request #12483 from opensourcerouting/feature/add_addpath_labeled_more_tests
Donald Sharp [Sat, 10 Dec 2022 00:43:07 +0000 (19:43 -0500)]
Merge pull request #12483 from opensourcerouting/feature/add_addpath_labeled_more_tests

bgpd: Free memory allocated by info_make() when hitting maximum-prefix

2 years agodoc: Clarify asic offload documentation in zebra
Donald Sharp [Thu, 8 Dec 2022 21:31:50 +0000 (16:31 -0500)]
doc: Clarify asic offload documentation in zebra

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agobgpd: Free memory allocated by info_make() when hitting maximum-prefix
Donatas Abraitis [Fri, 9 Dec 2022 18:01:56 +0000 (20:01 +0200)]
bgpd: Free memory allocated by info_make() when hitting maximum-prefix

```
Direct leak of 112 byte(s) in 1 object(s) allocated from:
    0 0x7feb66337a06 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cc:153
    1 0x7feb660cbcc3 in qcalloc lib/memory.c:116
    2 0x55cc3cba02d1 in info_make bgpd/bgp_route.c:3831
    3 0x55cc3cbab4f1 in bgp_update bgpd/bgp_route.c:4733
    4 0x55cc3cbb0620 in bgp_nlri_parse_ip bgpd/bgp_route.c:6111
    5 0x55cc3cb79473 in bgp_update_receive bgpd/bgp_packet.c:2020
    6 0x55cc3cb7c34a in bgp_process_packet bgpd/bgp_packet.c:2929
    7 0x7feb6610ecc5 in thread_call lib/thread.c:2006
    8 0x7feb660bfb77 in frr_run lib/libfrr.c:1198
    9 0x55cc3cb17232 in main bgpd/bgp_main.c:520
    10 0x7feb65ae5082 in __libc_start_main ../csu/libc-start.c:308

SUMMARY: AddressSanitizer: 112 byte(s) leaked in 1 allocation(s).
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoMerge pull request #12477 from opensourcerouting/feature/add_addpath_labeled_more_tests
Donald Sharp [Fri, 9 Dec 2022 18:03:39 +0000 (13:03 -0500)]
Merge pull request #12477 from opensourcerouting/feature/add_addpath_labeled_more_tests

tests: Add more tests for labeled-unicast and addpath

2 years agoMerge pull request #12466 from opensourcerouting/bsd-fixes-20221208
Donald Sharp [Fri, 9 Dec 2022 18:00:39 +0000 (13:00 -0500)]
Merge pull request #12466 from opensourcerouting/bsd-fixes-20221208

build: FreeBSD fixes

2 years agoMerge pull request #12464 from taspelund/vxlan_config_docs
Donatas Abraitis [Fri, 9 Dec 2022 17:02:15 +0000 (19:02 +0200)]
Merge pull request #12464 from taspelund/vxlan_config_docs

doc: add FRR/Linux configuration examples for EVPN

2 years agoMerge pull request #12467 from opensourcerouting/fix/advertised_routes_json_naming
Donald Sharp [Fri, 9 Dec 2022 16:54:13 +0000 (11:54 -0500)]
Merge pull request #12467 from opensourcerouting/fix/advertised_routes_json_naming

bgpd: Deprecate `bgpStatusCodes` and `bgpOriginCodes`

2 years agozebra: Free up routemap name memory on vrf deletion event
Donald Sharp [Fri, 9 Dec 2022 13:51:34 +0000 (08:51 -0500)]
zebra: Free up routemap name memory on vrf deletion event

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agolib: Hide list macros in linklist.c
Donald Sharp [Fri, 9 Dec 2022 13:37:45 +0000 (08:37 -0500)]
lib: Hide list macros in linklist.c

The LISTNODE_ATTACH|DELETE macros are only used in
linklist.c.  Let's remove temptation from people
to use them.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agoospf6d: Don't allocate json memory in non-json path
Donald Sharp [Fri, 9 Dec 2022 13:32:12 +0000 (08:32 -0500)]
ospf6d: Don't allocate json memory in non-json path

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agozebra: Actually free all memory associated ctx->u.iptable.interface_name_list
Donald Sharp [Fri, 9 Dec 2022 13:14:31 +0000 (08:14 -0500)]
zebra: Actually free all memory associated ctx->u.iptable.interface_name_list

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years 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

2 years agoisisd: Fix sadj memory leak
Donald Sharp [Fri, 9 Dec 2022 12:44:26 +0000 (07:44 -0500)]
isisd: Fix sadj memory leak

In some cases the sadj was directly dropped.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agotests: Add more tests for labeled-unicast and addpath
Donatas Abraitis [Fri, 9 Dec 2022 12:12:32 +0000 (14:12 +0200)]
tests: Add more tests for labeled-unicast and addpath

Check if we advertise more routes when an additional path comes up, and
if we withdraw if dissapears.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years 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

2 years 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

2 years 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>
2 years 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>
2 years agodoc: add FRR/Linux configuration examples for EVPN
Trey Aspelund [Wed, 7 Dec 2022 19:57:09 +0000 (14:57 -0500)]
doc: add FRR/Linux configuration examples for EVPN

The existing EVPN documentation in bgp.rst does not provide a holistic
configuration, just examples of individual features, and doesn't give
an operator any idea of what a compatible Linux netdev configuration
might look like. This introduces evpn.rst which includes a sample
frr.conf and corresponding Linux interface config (via iproute2) that
an operator can use to setup a basic EVPN topology and model their
interface manager's config from.

This initial version of evpn.rst shows Linux netdev config for
traditional bridges (vlan_filtering=0) and traditional vxlan devices
(single VNI). Later changes to this file will cover the use of
VLAN-aware bridges (vlan_filtering=1), single VXLAN devices
(multi VNI), and eventually bonds (for EVPN-MH).

Eventually the plan is to move the existing EVPN content from bgp.rst
into evpn.rst, but for now let's get some user-facing documentation in
place for interface configs.

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
2 years 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

2 years 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

2 years 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>
2 years 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

2 years 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>
2 years 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

2 years agobgpd: Deprecate `bgpStatusCodes` and `bgpOriginCodes`
Donatas Abraitis [Thu, 8 Dec 2022 13:46:43 +0000 (15:46 +0200)]
bgpd: Deprecate `bgpStatusCodes` and `bgpOriginCodes`

```
donatas-pc# sh ip bgp neighbors 192.168.10.124 advertised-routes json
{
  "bgpTableVersion":11,
  "bgpLocalRouterId":"192.168.10.17",
  "defaultLocPrf":100,
  "localAS":65002,
  "bgpStatusCodes":{
    "suppressed":"s",
    "damped":"d",
    "history":"h",
    "valid":"*",
    "best":">",
    "multipath":"=",
    "internal":"i",
    "ribFailure":"r",
    "stale":"S",
    "removed":"R"
  },
  "bgpOriginCodes":{
    "igp":"i",
    "egp":"e",
    "incomplete":"?"
  },
  "advertisedRoutes":{
    "200.200.200.200\/32":{
      "addrPrefix":"200.200.200.200",
      "prefixLen":32,
      "network":"200.200.200.200\/32",
      "nextHopGlobal":"2a02:4780:abc::2",
      "weight":0,
      "path":"65001",
      "bgpOriginCode":"?",
      "origin":"incomplete", <<<<<<<
      "valid":true, <<<<<<<<
      "best":true,  <<<<<<<<
      "appliedStatusSymbols":{
        "*":true,
        ">":true
      }
    }
  },
  "totalPrefixCounter":1,
  "filteredPrefixCounter":0
}
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agodoc: add FreeBSD 13 build docs
David Lamparter [Thu, 8 Dec 2022 13:17:17 +0000 (14:17 +0100)]
doc: add FreeBSD 13 build docs

Some minor changes since FreeBSD 11, mostly fewer extra sauce.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2 years agobuild: pim6d is Linux only
David Lamparter [Thu, 8 Dec 2022 11:45:38 +0000 (12:45 +0100)]
build: pim6d is Linux only

This stops breaking build on FreeBSD.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2 years agobuild: fix sed regex in Lua macro
David Lamparter [Thu, 8 Dec 2022 11:35:03 +0000 (12:35 +0100)]
build: fix sed regex in Lua macro

Using `\s` to match whitespace is not portable, use `[[:space:]]`
instead.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2 years 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>
2 years 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>
2 years agotests: Check if default-originate works with labeled-unicast
Donatas Abraitis [Wed, 7 Dec 2022 21:24:28 +0000 (23:24 +0200)]
tests: Check if default-originate works with labeled-unicast

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agobgpd: Announce labeled-unicast default-originate
Donatas Abraitis [Wed, 7 Dec 2022 20:57:29 +0000 (22:57 +0200)]
bgpd: Announce labeled-unicast default-originate

Without this patch, this just crashes:

```
(gdb) bt
0  raise (sig=sig@entry=11) at ../sysdeps/unix/sysv/linux/raise.c:51
1  0x00007f66d977b10c in core_handler (signo=11, siginfo=0x7ffd87aa0430, context=<optimized out>) at lib/sigevent.c:261
2  <signal handler called>
3  stream_put_labeled_prefix (s=s@entry=0x55bd3ce53050, p=p@entry=0x7ffd87aa0a20, label=label@entry=0x0, addpath_capable=<optimized out>, addpath_tx_id=addpath_tx_id@entry=1)
    at lib/stream.c:1057
4  0x000055bd3bfba176 in bgp_packet_mpattr_prefix (s=s@entry=0x55bd3ce53050, afi=afi@entry=AFI_IP, safi=safi@entry=SAFI_LABELED_UNICAST, p=p@entry=0x7ffd87aa0a20, prd=prd@entry=0x0,
    label=label@entry=0x0, num_labels=0, addpath_capable=true, addpath_tx_id=1, attr=0x7ffd87aa2c20) at bgpd/bgp_attr.c:3964
5  0x000055bd3bfba2b5 in bgp_packet_attribute (bgp=0x55bd3cd8e470, bgp@entry=0x0, peer=peer@entry=0x55bd3cf21fc0, s=s@entry=0x55bd3ce53050, attr=attr@entry=0x7ffd87aa2c20,
    vecarr=vecarr@entry=0x7ffd87aa0a10, p=p@entry=0x7ffd87aa0a20, afi=AFI_IP, safi=SAFI_LABELED_UNICAST, from=0x7f66d9ba9010, prd=0x0, label=0x0, num_labels=0, addpath_capable=true,
    addpath_tx_id=1, bpi=0x0) at bgpd/bgp_attr.c:4139
6  0x000055bd3c04d455 in subgroup_default_update_packet (subgrp=subgrp@entry=0x55bd3cd885b0, attr=attr@entry=0x7ffd87aa2c20, from=from@entry=0x7f66d9ba9010) at bgpd/bgp_updgrp_packet.c:1129
7  0x000055bd3c04a9a5 in subgroup_default_originate (subgrp=0x55bd3cd885b0, withdraw=withdraw@entry=0) at bgpd/bgp_updgrp_adv.c:972
8  0x000055bd3c022668 in bgp_default_originate (peer=peer@entry=0x7f66d574a010, afi=afi@entry=AFI_IP, safi=safi@entry=SAFI_LABELED_UNICAST, withdraw=withdraw@entry=0)
    at bgpd/bgp_route.c:5037
9  0x000055bd3c0922e0 in peer_default_originate_set (peer=0x7f66d574a010, afi=afi@entry=AFI_IP, safi=safi@entry=SAFI_LABELED_UNICAST, rmap=rmap@entry=0x0, route_map=route_map@entry=0x0)
    at bgpd/bgpd.c:5428
10 0x000055bd3c076c07 in peer_default_originate_set_vty (set=1, rmap=0x0, safi=SAFI_LABELED_UNICAST, afi=AFI_IP, peer_str=<optimized out>, vty=0x55bd3ce4c900) at bgpd/bgp_vty.c:6941
11 neighbor_default_originate (self=<optimized out>, vty=0x55bd3ce4c900, argc=<optimized out>, argv=<optimized out>) at bgpd/bgp_vty.c:6958
12 0x00007f66d9721dc0 in cmd_execute_command_real (vline=vline@entry=0x55bd3cd874d0, vty=vty@entry=0x55bd3ce4c900, cmd=cmd@entry=0x0, up_level=up_level@entry=0, filter=FILTER_RELAXED)
    at lib/command.c:996
13 0x00007f66d9721f39 in cmd_execute_command (vline=vline@entry=0x55bd3cd874d0, vty=vty@entry=0x55bd3ce4c900, cmd=cmd@entry=0x0, vtysh=vtysh@entry=0) at lib/command.c:1055
14 0x00007f66d9722162 in cmd_execute (vty=vty@entry=0x55bd3ce4c900, cmd=cmd@entry=0x55bd3cd8a230 "neighbor 192.168.34.4 default-originate ", matched=matched@entry=0x0, vtysh=vtysh@entry=0)
    at lib/command.c:1223
15 0x00007f66d9792337 in vty_command (vty=vty@entry=0x55bd3ce4c900, buf=<optimized out>) at lib/vty.c:486
16 0x00007f66d9792570 in vty_execute (vty=0x55bd3ce4c900) at lib/vty.c:1249
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years 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>
2 years 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

2 years 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>
2 years 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>
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
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"
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
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
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
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
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
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
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
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
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
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
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>