Commit Graph

30776 Commits

Author SHA1 Message Date
Quentin Young
ae830bc355 vrrpd: give null when using null ifp to lookup vr
This is still causing crashes somehow.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
(cherry picked from commit ed331629de)
2023-02-14 14:30:22 +00:00
Jafar Al-Gharaibeh
a5ee9bf40c
Merge pull request #12788 from FRRouting/mergify/bp/dev/8.5/pr-12776
pim6d: Modify "show ipv6 mld join json" o/p (backport #12776)
2023-02-10 10:59:19 -06:00
Sarita Patra
f6e48df868 pim6d: Modify "show ipv6 mld join json" o/p
Currently "show ipv6 mld join json" o/p is
frr# show ipv6 mld joins json
{
  "default":{
    "ens192":{
      "ff02:2":{
        "::":{
          "state":"JOIN",
          "created":"00:01:50.595",
          "lastSeen":"00:00:38.403",
        }
      }
    }
  }
}

Here, I modified the o/p as below for better understanding.
frr# show ipv6 mld joins json
{
  "default":{
    "vrf":"default",
    "ens192":{
      "ff02::2":{
        "*":{
          "state":"JOIN",
          "created":"00:00:42.766",
          "lastSeen":"00:00:05.266"
        }
      }
    }
  }
}

Issue: #12755

Signed-off-by: Sarita Patra <saritap@vmware.com>
(cherry picked from commit 58971e1574)
2023-02-10 13:08:16 +00:00
Donatas Abraitis
badd2b2647
Merge pull request #12784 from FRRouting/mergify/bp/dev/8.5/pr-12781
lib: Release memory of YANG translation module on error (backport #12781)
2023-02-10 10:41:11 +02:00
Donatas Abraitis
6ba732890d
Merge pull request #12786 from FRRouting/mergify/bp/dev/8.5/pr-12782
bgpd: Intern default-originate attributes to avoid use-after-free (backport #12782)
2023-02-10 06:42:06 +02:00
Donatas Abraitis
350fdbe2fb tests: Check if BGP default-originate withdraw works correctly
And also do not crash when we do `clear ip bgp ...`.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 35b7ce08a8)
2023-02-10 00:26:28 +00:00
Donatas Abraitis
474555e15c bgpd: Intern default-originate attributes to avoid use-after-free
When we receive a default route from a peer and we originate default route
using `neighbor default-originate`, we do not track of struct attr we use,
and when we do `no neighbor default-originate` we withdraw our generated
default route, but we announce default-route from the peer.

After we do this, we unintern aspath (which was used for default-originate),
BUT it was used also for peer's default route we received.

And here we have a use-after-free crash, because bgp_process_main_one()
reaps old paths that are marked as BGP_PATH_REMOVED with aspath->refcnt > 0,
but here it's 0.

```
0 0x55c24bbcd022 in aspath_key_make bgpd/bgp_aspath.c:2070
1 0x55c24b8f1140 in attrhash_key_make bgpd/bgp_attr.c:777
2 0x7f52322e66c9 in hash_release lib/hash.c:220
3 0x55c24b8f6017 in bgp_attr_unintern bgpd/bgp_attr.c:1271
4 0x55c24ba0acaa in bgp_path_info_free_with_caller bgpd/bgp_route.c:283
5 0x55c24ba0a7de in bgp_path_info_unlock bgpd/bgp_route.c:309
6 0x55c24ba0af6d in bgp_path_info_reap bgpd/bgp_route.c:426
7 0x55c24ba17b9a in bgp_process_main_one bgpd/bgp_route.c:3333
8 0x55c24ba18a1d in bgp_process_wq bgpd/bgp_route.c:3425
9 0x7f52323c2cd5 in work_queue_run lib/workqueue.c:282
10 0x7f52323aab92 in thread_call lib/thread.c:2006
11 0x7f5232300dc7 in frr_run lib/libfrr.c:1198
12 0x55c24b8ea792 in main bgpd/bgp_main.c:520
13 0x7f5231c3a082 in __libc_start_main ../csu/libc-start.c:308
14 0x55c24b8ef0bd in _start (/usr/lib/frr/bgpd+0x2c90bd)
    ```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit e9340ff429)
2023-02-10 00:26:28 +00:00
Donatas Abraitis
14f5d3478f lib: Free dnode before returning if YANG translator model is already loaded
Seems just a missed one because at `goto error` we release dnode.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit ecf82aa41e)
2023-02-10 00:26:00 +00:00
Donatas Abraitis
21f0622727 lib: Release memory of YANG translation module on error
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit b9941b3fec)
2023-02-10 00:25:59 +00:00
Donatas Abraitis
818d7301b0
Merge pull request #12778 from FRRouting/mergify/bp/dev/8.5/pr-12773
pbrd: fix large tableids displayed as negative (backport #12773)
2023-02-09 15:19:28 +02:00
Wesley Coakley
504dff06ea pbrd: fix large tableids displayed as negative
Ticket: 2699411
Signed-off-by: Wesley Coakley <wcoakley@nvidia.com>
(cherry picked from commit 8dc2001c91)
2023-02-09 10:48:36 +00:00
Donatas Abraitis
a769fe4b29
Merge pull request #12770 from FRRouting/mergify/bp/dev/8.5/pr-12768
tests: do not use exclude grep (backport #12768)
2023-02-09 09:47:20 +02:00
Donald Sharp
b2b7efda8f
Merge pull request #12771 from FRRouting/mergify/bp/dev/8.5/pr-12769
tools: Fix missing pbrd in rsyslog.d 45-frr.conf file (backport #12769)
2023-02-08 20:15:49 -05:00
Donald Sharp
28ce07f909 tools: Fix missing pbrd in rsyslog.d 45-frr.conf file
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 7386031781)
2023-02-08 20:41:16 +00:00
Louis Scalbert
ac6bb62c99 tests: do not use exclude grep
Filter out keys in JSON output with "grep -v" does not work when JSON
does not use the pretty format.

Use native python code to filter out keys.

Fixes: 6c13bd5744 ("topotests: fix bgp_vpnv4_noretain")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit a8d6faa986)
2023-02-08 19:54:01 +00:00
Donatas Abraitis
fb2c52d15d
Merge pull request #12765 from FRRouting/mergify/bp/dev/8.5/pr-12761
bgpd: fix use-after-free crash for evpn (backport #12761)
2023-02-08 13:54:29 +02:00
anlan_cs
b3b3a910a6 bgpd: fix use-after-free crash for evpn
```
anlan(config-router-af)# vni 33
anlan(config-router-af-vni)# route-target both 44:55
anlan(config-router-af-vni)# no route-target both 44:55
vtysh: error reading from bgpd: Resource temporarily unavailable (11)Warning: closing connection to bgpd because of an I/O error!
```

When `bgp_evpn_vni_rt_cmd` deals with "both" type, it wrongly created
only one node ( should be two nodes ) for lists of both `vpn->import_rtl` and
`vpn->export_rtl`.  At this time, the two lists are already wrong.

In `no route-target both RT`, it will free the single node from lists of both
`vpn->import_rtl` and `vpn->export_rtl`.  After freed from `vpn->import_rtl`,
it is "use-after-free" at the time of freeing it from `vpn->export_rtl`.
It causes crash sometimes, or other unexpected behaviours.

This issue is introduced by commit `3b7e8d`, which have adjusted both
`bgp_evpn_vni_rt_cmd` and `bgp_evpn_vrf_rt_cmd`.

Since `bgp_evpn_vrf_rt_cmd/no_bgp_evpn_vrf_rt_cmd` works well again
unintentionally with commit `7022da`, only `bgp_evpn_vni_rt_cmd` needs to
modify - add two nodes for "both" type and some explicit comments for this
special case of "both" type.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
(cherry picked from commit 432ff4b036)
2023-02-08 08:07:50 +00:00
Jafar Al-Gharaibeh
2285f5aca8
Merge pull request #12722 from opensourcerouting/vim-xref
tools: add `GotoXref` vim script
2023-02-07 10:43:27 -06:00
Jafar Al-Gharaibeh
6e1ae0137d
Merge pull request #12715 from opensourcerouting/fix/contribution_guid_squash_random_commits
Commits hygiene
2023-02-07 10:42:53 -06:00
Russ White
0b1a6ca322
Merge pull request #12748 from opensourcerouting/fix/route_map_vpn_import
tests: Check if route-map vpn import basic funtionality works fine
2023-02-07 11:40:03 -05:00
Russ White
24caf3069b
Merge pull request #12720 from opensourcerouting/fix/ecommunity_ipv6_missing_token
bgpd: ecommunity_token_rt6 is not handled
2023-02-07 09:21:07 -05:00
Donatas Abraitis
b313408c01
Merge pull request #12741 from thesamesam/missing-time
pceplib: add <time.h> include for time_t
2023-02-07 11:05:46 +02:00
Sam James
3c8c112df4
pceplib: add <time.h> include for time_t
Fixes build on musl. Used for time_t in the header.

Bug: https://bugs.gentoo.org/862558
Signed-off-by: Sam James <sam@gentoo.org>
2023-02-06 20:31:22 +00:00
Donatas Abraitis
4ee5265aa7 bgpd: Add more context in logs about from where to where routes are leaked
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-02-06 18:44:11 +02:00
Donatas Abraitis
1aa2c93e2c bgpd: Drop struct bgp from vpn_leak_to_vrf_withdraw()
Not used at all, just drop it.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-02-06 18:44:11 +02:00
Donatas Abraitis
1c2ba4a23f tests: Check if route-map vpn import basic funtionality works fine
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-02-06 18:44:10 +02:00
Donatas Abraitis
d83c36ee44
Merge pull request #12740 from vfreex/babel-fix-filtering
babeld: Fix filtering against all interfaces
2023-02-06 15:24:56 +02:00
Yuxiang Zhu
0f9650ca95 babeld: Fix filtering against all interfaces
The first argument of `access_list_lookup` and `prefix_list_lookup`
should be `AFI_` constants instead of `AF_` constants.

Signed-off-by: Yuxiang Zhu <vfreex@gmail.com>
2023-02-06 11:08:25 +00:00
Donatas Abraitis
51c48bdefd
Merge pull request #12668 from anlancs/fix/zebra-evpn-missing-advertise
zebra: fix wrong conversion for evpn advertising
2023-02-04 12:52:22 +02:00
Mark Stapp
9d5c511864
Merge pull request #12732 from donaldsharp/fix_bgp_open_issues
bgpd: Don't try to recursively hold peer io mutex
2023-02-03 07:17:00 -05:00
Donald Sharp
f1b1efdefc bgpd: Don't try to recursively hold peer io mutex
BGP was modified in a0b937de42
to grab the peer->io_mtx before validating the header to ensure
that the input Queue was not being modified by anyone else at that
moment in time.  Unfortunately validate_header can detect a problem
and attempt to relock the mutex, which deadlocks.  This deadlock in
the bgp_io pthread is the lone deadlock at first, eventually though
bgp attempts to write another packet to the peer( say when the
it's time to send the next packet ) and the main pthread of bgpd
becomes deadlocked and then the whole bgpd process is stuck at that
point in time leaving us dead in the water.

The point of locking the mutex earlier was to ensure that the input
Queue wasn't being modified by anyone else, (Say reading off it )
as that we wanted to ensure that we don't hold more packets then necessary.

Let's grab the mutex long enough to look at the input Q size, this
ensure that we have room and then we can validate_header and do the right
thing from there.  We'll need to lock the mutex when we actually move it
into the input Q as well.

Fixes: #12725
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-02-02 16:39:01 -05:00
Russ White
73fb874e0a
Merge pull request #12731 from donaldsharp/remove_pretty_print
lib, bgpd: Add ability to specify that some json output should not be…
2023-02-02 15:44:45 -05:00
Donald Sharp
2d4460de6f bgpd: Convert evpn output to not pretty print json
Commit: 3cdb03fba7
changed the vty_json output to not be pretty printing.
The previous commit in the tree added vty_json_no_pretty
let's use that instead

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-02-02 10:42:21 -05:00
Donald Sharp
d7c6467ba2 lib, bgpd: Add ability to specify that some json output should not be pretty
Initial commit: 23b2a7ef52
changed the json output of `show bgp <afi> <safi> json` to
not have pretty print because when under a situation where
there are a bunch of routes with a large scale ecmp show
output was taking forever and this commit cut 2 minutes out
of vtysh run time.

Subusequent commit: f4ec52f7cc
changed this back.

When upgrading to latest version the long run time was noticed
due to testing.  Let's add back this functionality such that
FRR can have reduced run times with vtysh when it's really
needed.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-02-02 10:28:19 -05:00
Donald Sharp
7d1cbd75e1
Merge pull request #12729 from opensourcerouting/fix/treat-as-withdraw_nlri_update
bgpd: Set attr to NULL when passing NLRI_UPDATE with treat-as-withdraw
2023-02-02 08:29:59 -05:00
Donatas Abraitis
b1d7888f9b bgpd: Set attr to NULL when passing NLRI_UPDATE with treat-as-withdraw
Before this patch, we always passed `struct attr` for NLRI_UPDATE, but if we
have a situation with treat-as-withdraw (for example: malformed attribute, or
using a command like `neighbor path-attribute treat-as-withdraw`) the route
MUST be withdrawn form the BGP table.

Hence, we MUST pass attr as NULL, in this case we already have this check
under NLRI_ATTR_ARG() macro, just reuse it properly.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-02-01 23:07:56 +02:00
Donatas Abraitis
7461589c2e
Merge pull request #12672 from donaldsharp/remove_insecure
vtysh: Remove shell access code
2023-02-01 22:45:20 +02:00
Donald Sharp
33303f08bf
Merge pull request #12713 from opensourcerouting/fix/json_naming_deprecation
*: Drop deprecated incorrect JSON fields with wrong naming
2023-02-01 15:39:18 -05:00
Christian Hopps
b54ec1733b
Merge pull request #12721 from opensourcerouting/format-warnings-redux
*: more format string fixing
2023-02-01 11:13:46 -05:00
Donald Sharp
0876b4c1b8 vtysh: Schedule shell access for deprecation
Schedule shell access for deprecation and removal in
a years time.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-02-01 10:29:02 -05:00
David Lamparter
ba727609c6 tests: add missing printf attribute
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-01 03:00:22 +01:00
David Lamparter
da63485331 tests: yank asprintfrr duplicate
I think this one predates the existence of asprintfrr.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-01 03:00:22 +01:00
David Lamparter
bd90faea56 lib: fix one more b0rked format string
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-01 03:00:22 +01:00
David Lamparter
e3a7fc5021 bgpd/rfapi: add missing printf attribute
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-01 03:00:22 +01:00
David Lamparter
c695bdbedb lib: apply more printf attributes
... missed some functions in the earlier commits :(

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-01 03:00:18 +01:00
David Lamparter
40e98aa8c8 tools: add GotoXref vim script
Let's make these unique IDs actually a bit useful.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-01-31 23:20:03 +01:00
Donatas Abraitis
aa16204dfb
Merge pull request #12667 from donaldsharp/zebra_rib_fixup
tests: zebra_rib remove a sleep
2023-01-31 21:41:30 +02:00
Donald Sharp
125ef88d29 bgpd: ecommunity_token_rt6 is not handled
The function ecommunity_str2com_internal appears to want to handle
the ecommunity_token_rt6 enum but skips over it.  Commit
9a659715df tried to add this but I really
don't see how this is going to behave correctly.  Add the
ecommunity_token_rt6 case to the switch statement so it is handled
appropriately?

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-01-31 21:04:42 +02:00
Donatas Abraitis
6520483a8f
Merge pull request #12704 from donaldsharp/pim6_route_map
pimd: v6 intentionally turned off route-maps.  Turn it on.
2023-01-31 20:51:45 +02:00
Donatas Abraitis
f932966b02 tests: Use JSON camelCase naming for tests
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-01-31 20:49:44 +02:00