Commit Graph

30591 Commits

Author SHA1 Message Date
Jafar Al-Gharaibeh
b7f08a6fbd
Merge pull request #12482 from donaldsharp/mem_this
Mem this
2022-12-09 20:19:28 -06:00
Donald Sharp
e3f5a669e4
Merge pull request #12462 from opensourcerouting/fix/default_originate_labeled_unicast
bgpd: Labeled unicast with default-originate
2022-12-09 19:44:58 -05:00
Donald Sharp
9528d9a97d
Merge pull request #12483 from opensourcerouting/feature/add_addpath_labeled_more_tests
bgpd: Free memory allocated by info_make() when hitting maximum-prefix
2022-12-09 19:43:07 -05:00
Donald Sharp
1d1103a25c doc: Clarify asic offload documentation in zebra
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-09 15:56:14 -05:00
Donatas Abraitis
819e67670c 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>
2022-12-09 20:07:59 +02:00
Donald Sharp
f88420c3a5
Merge pull request #12477 from opensourcerouting/feature/add_addpath_labeled_more_tests
tests: Add more tests for labeled-unicast and addpath
2022-12-09 13:03:39 -05:00
Donald Sharp
c5a018dea5
Merge pull request #12466 from opensourcerouting/bsd-fixes-20221208
build: FreeBSD fixes
2022-12-09 13:00:39 -05:00
Donatas Abraitis
7c06a1bd85
Merge pull request #12464 from taspelund/vxlan_config_docs
doc: add FRR/Linux configuration examples for EVPN
2022-12-09 19:02:15 +02:00
Donald Sharp
42778d2a3a
Merge pull request #12467 from opensourcerouting/fix/advertised_routes_json_naming
bgpd: Deprecate `bgpStatusCodes` and `bgpOriginCodes`
2022-12-09 11:54:13 -05:00
Donald Sharp
cda0f501fb zebra: Free up routemap name memory on vrf deletion event
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-09 09:47:06 -05:00
Donald Sharp
b3faf1aab6 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>
2022-12-09 08:38:50 -05:00
Donald Sharp
21c6569d6f ospf6d: Don't allocate json memory in non-json path
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-09 08:38:50 -05:00
Donald Sharp
1cc380679e zebra: Actually free all memory associated ctx->u.iptable.interface_name_list
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-09 08:38:50 -05:00
Mark Stapp
f29a262d83
Merge pull request #12471 from opensourcerouting/fix/gh_actions_on_forks_forbidden
github: Prevent running actions on forked repositories
2022-12-09 08:34:55 -05:00
Donald Sharp
63e6e11f9f isisd: Fix sadj memory leak
In some cases the sadj was directly dropped.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-09 07:44:26 -05:00
Donatas Abraitis
387a5ffe5a 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>
2022-12-09 14:12:32 +02:00
Donatas Abraitis
c8cfee4e3b
Merge pull request #12470 from donaldsharp/cleanup_topos
tests: ospf_gr_helper tests are slow
2022-12-09 09:20:00 +02:00
Donatas Abraitis
d71f616734
Merge pull request #12473 from donaldsharp/ensure_used
bgpd: Don't always allocate json memory in non-json path
2022-12-09 09:17:45 +02:00
Donald Sharp
5691f760d2 bgpd: Don't always allocate json memory in non-json path
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-12-08 18:22:17 -05:00
Ryoga Saito
2b0efccd05 tests: Add topotest bgp_vrf_leaking_5549_routes
To verify previous changes, this PR introduces topotest to verify
whether imported routes learnt from BGP unnumbered peers will be active
on VPN RIB and other VRF RIB.

Signed-off-by: Ryoga Saito <ryoga.saito@linecorp.com>
2022-12-09 07:13:54 +09:00
Donatas Abraitis
e535be623a github: Prevent running actions on forked repositories
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-12-08 22:54:28 +02:00
Trey Aspelund
433d9566bf 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>
2022-12-08 14:34:20 -05:00
Donald Sharp
57968e38a9
Merge pull request #12463 from opensourcerouting/fix/totalPrefixCounter_with_default_originate
bgpd: totalPrefixCounter incorectly shows sent prefix count
2022-12-08 14:31:31 -05:00
Donald Sharp
abc8c68bea
Merge pull request #12468 from mjstapp/fix_log_command_types
lib: fix zlog command types table
2022-12-08 14:22:36 -05:00
Donald Sharp
f47c65ff87 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>
2022-12-08 14:20:23 -05:00
Quentin Young
71ee1fa3a4
Merge pull request #12430 from opensourcerouting/accords 2022-12-08 12:39:48 -05:00
Mark Stapp
447586fd3c 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>
2022-12-08 11:37:51 -05:00
Donatas Abraitis
ff1163a3b1
Merge pull request #12461 from donaldsharp/evpn_mh_crash
bgpd: Prevent crash in evpn when using default vrf
2022-12-08 16:35:11 +02:00
Donatas Abraitis
dd426a51e3 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>
2022-12-08 15:57:14 +02:00
David Lamparter
d3135b0189 doc: add FreeBSD 13 build docs
Some minor changes since FreeBSD 11, mostly fewer extra sauce.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-12-08 14:19:34 +01:00
David Lamparter
d9a2d546da build: pim6d is Linux only
This stops breaking build on FreeBSD.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-12-08 12:45:38 +01:00
David Lamparter
9e46405ca2 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>
2022-12-08 12:39:17 +01:00
David Lamparter
ad5fef3ded 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>
2022-12-08 12:06:37 +01:00
Donatas Abraitis
65565c9a3f 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>
2022-12-07 23:36:00 +02:00
Donatas Abraitis
31f77524bf tests: Check if default-originate works with labeled-unicast
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-12-07 23:24:28 +02:00
Donatas Abraitis
2de5f5b5f8 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>
2022-12-07 23:18:07 +02:00
Donald Sharp
dc9ca53f94 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>
2022-12-07 14:06:12 -05:00
Donald Sharp
91aaed76c5
Merge pull request #12460 from opensourcerouting/msdp-fixes
pimd: two MSDP packet handling fixes
2022-12-07 13:17:25 -05:00
Rafael Zalamena
1dd422a22b 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>
2022-12-07 11:49:26 -03:00
Rafael Zalamena
d49810329d 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>
2022-12-07 11:48:47 -03:00
Donald Sharp
1b97fa9976
Merge pull request #12456 from opensourcerouting/fix/bgpd_labeled_unicast_rr_addpath
bgpd: Labeled unicast fixes for addpath capability
2022-12-07 08:03:59 -05:00
Donatas Abraitis
8ccee4b8cc 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>
2022-12-06 21:39:15 +02:00
Donatas Abraitis
4d65410c54 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>
2022-12-06 21:39:14 +02:00
Donald Sharp
0fce20b808
Merge pull request #12339 from anlancs/fix/bgpd-null-show
bgpd: fix null pointer dereference
2022-12-06 14:11:47 -05:00
Donald Sharp
d18b34f21f
Merge pull request #12455 from mjstapp/revert_stop_zebra_last
tools: revert stop zebra daemon last
2022-12-06 14:11:03 -05:00
Manoj Naragund
50a275d7c9 tests: Testcase for OSPFv3 learning.
Have added topotest to verify OSPF can learn different types of LSA,
and processes them

Signed-off-by: Manoj Naragund <mnaragund@vmware.com>
2022-12-06 09:11:16 -08:00
Russ White
7ad0f5e07e
Merge pull request #12415 from donaldsharp/bgp_use_after_free
Bgp use after free
2022-12-06 11:29:31 -05:00
Donatas Abraitis
b0ade0a111 tests: Check if labeled-unicast works correctly with addpath capability
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-12-06 18:24:13 +02:00
Mark Stapp
828ac45474 Revert "tools: stop zebra daemon last"
This reverts commit 2000ac4075.

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>
2022-12-06 11:21:02 -05:00
Russ White
17ccfbb6c2
Merge pull request #12322 from fdumontet6WIND/confed_num
bgp:  fix case where confederation id same as member-as
2022-12-06 08:59:44 -05:00