Commit Graph

32667 Commits

Author SHA1 Message Date
Christian Hopps
884fe82ceb tests: add regression test for issue $13920
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-07-14 19:29:57 -04:00
Christian Hopps
07035ce954 vtysh: track and fix file-lock use in the workaround from 2004
There's a workaround in the code from a bug from back in 2004, it ends
and re-enters config mode anytime an `exit` is done from a level below
the top-level config node (e.g., from a `router isis` node). We need to
re-enter config mode with or without a lock according to how we actually
entered it to begin with.

fixes #13920

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-07-14 18:24:44 -04:00
Christian Hopps
76835fd558 lib: mgmtd: only clear pending for the in-progress command
The lock/unlocks are being done short-circuit so they are never pending;
however, the handling of the unlock notification was always resuming the command
if pending was set. In all cases pending is set for another command. For example
implicit commit locks then when notified its done unlocks which was clearing the
set-config pending flag and resuming that command incorrectly.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-07-14 18:24:30 -04:00
Donald Sharp
2ba2c284ba bgpd: Prevent use after free
When running bgp_always_compare_med, I am frequently seeing a crash
After running with valgrind I am seeing this and a invalid write
immediately after this as well.

==311743== Invalid read of size 2
==311743==    at 0x4992421: route_map_counter_decrement (routemap.c:3308)
==311743==    by 0x35664D: peer_route_map_unset (bgpd.c:7259)
==311743==    by 0x306546: peer_route_map_unset_vty (bgp_vty.c:8037)
==311743==    by 0x3066AC: no_neighbor_route_map (bgp_vty.c:8081)
==311743==    by 0x49078DE: cmd_execute_command_real (command.c:990)
==311743==    by 0x4907A63: cmd_execute_command (command.c:1050)
==311743==    by 0x490801F: cmd_execute (command.c:1217)
==311743==    by 0x49C5535: vty_command (vty.c:551)
==311743==    by 0x49C7459: vty_execute (vty.c:1314)
==311743==    by 0x49C97D1: vtysh_read (vty.c:2223)
==311743==    by 0x49BE5E2: event_call (event.c:1995)
==311743==    by 0x494786C: frr_run (libfrr.c:1204)
==311743==    by 0x1F7655: main (bgp_main.c:505)
==311743==  Address 0x9ec2180 is 64 bytes inside a block of size 120 free'd
==311743==    at 0x484B27F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==311743==    by 0x495A1BA: qfree (memory.c:130)
==311743==    by 0x498D412: route_map_free_map (routemap.c:748)
==311743==    by 0x498D176: route_map_add (routemap.c:672)
==311743==    by 0x498D79B: route_map_get (routemap.c:857)
==311743==    by 0x499C256: lib_route_map_create (routemap_northbound.c:102)
==311743==    by 0x49702D8: nb_callback_create (northbound.c:1234)
==311743==    by 0x497107F: nb_callback_configuration (northbound.c:1578)
==311743==    by 0x4971693: nb_transaction_process (northbound.c:1709)
==311743==    by 0x496FCF4: nb_candidate_commit_apply (northbound.c:1103)
==311743==    by 0x496FE4E: nb_candidate_commit (northbound.c:1136)
==311743==    by 0x497798F: nb_cli_classic_commit (northbound_cli.c:49)
==311743==    by 0x4977B4F: nb_cli_pending_commit_check (northbound_cli.c:88)
==311743==    by 0x49078C1: cmd_execute_command_real (command.c:987)
==311743==    by 0x4907B44: cmd_execute_command (command.c:1068)
==311743==    by 0x490801F: cmd_execute (command.c:1217)
==311743==    by 0x49C5535: vty_command (vty.c:551)
==311743==    by 0x49C7459: vty_execute (vty.c:1314)
==311743==    by 0x49C97D1: vtysh_read (vty.c:2223)
==311743==    by 0x49BE5E2: event_call (event.c:1995)
==311743==    by 0x494786C: frr_run (libfrr.c:1204)
==311743==    by 0x1F7655: main (bgp_main.c:505)
==311743==  Block was alloc'd at
==311743==    at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==311743==    by 0x495A068: qcalloc (memory.c:105)
==311743==    by 0x498D0C8: route_map_new (routemap.c:646)
==311743==    by 0x498D128: route_map_add (routemap.c:658)
==311743==    by 0x498D79B: route_map_get (routemap.c:857)
==311743==    by 0x499C256: lib_route_map_create (routemap_northbound.c:102)
==311743==    by 0x49702D8: nb_callback_create (northbound.c:1234)
==311743==    by 0x497107F: nb_callback_configuration (northbound.c:1578)
==311743==    by 0x4971693: nb_transaction_process (northbound.c:1709)
==311743==    by 0x496FCF4: nb_candidate_commit_apply (northbound.c:1103)
==311743==    by 0x496FE4E: nb_candidate_commit (northbound.c:1136)
==311743==    by 0x497798F: nb_cli_classic_commit (northbound_cli.c:49)
==311743==    by 0x4977B4F: nb_cli_pending_commit_check (northbound_cli.c:88)
==311743==    by 0x49078C1: cmd_execute_command_real (command.c:987)
==311743==    by 0x4907B44: cmd_execute_command (command.c:1068)
==311743==    by 0x490801F: cmd_execute (command.c:1217)
==311743==    by 0x49C5535: vty_command (vty.c:551)
==311743==    by 0x49C7459: vty_execute (vty.c:1314)
==311743==    by 0x49C97D1: vtysh_read (vty.c:2223)
==311743==    by 0x49BE5E2: event_call (event.c:1995)
==311743==    by 0x494786C: frr_run (libfrr.c:1204)

Effectively the route_map that is being stored has been freed already
but we have not cleaned up properly yet.  Go through and clean the
code up by ensuring that the pointer actually exists instead of trusting
it does when doing the decrement operation.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-07-14 12:16:38 -04:00
Donatas Abraitis
8d51fafdcb bgpd: Drop bgp_static_update_safi() function
Combine bgp_static_update() and bgp_static_update_safi() into a single one.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-07-14 19:12:01 +03:00
Donatas Abraitis
b8ca2d4fb8 bgpd: Drop bgp_static_withdraw_safi() function
Combine bgp_static_withdraw() and bgp_static_withdraw_safi() into a single one.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-07-14 19:12:01 +03:00
Christian Hopps
2a1787aef8 tests: fix/improve the printing of backtrace from cores
Signed-off-by: Christian Hopps <chopps@labn.net>
2023-07-14 11:12:39 -04:00
Donatas Abraitis
eb6a8a02f3
Merge pull request #13575 from anlancs/fix/zebra-if-vrf-change
zebra: Fix wrong vrf change procedure
2023-07-14 12:11:38 +03:00
Donatas Abraitis
31a985729e
Merge pull request #13993 from achernavin22/fix-rmap-on-match2
lib: fix on-match when added to existing route-map entry
2023-07-14 12:05:02 +03:00
Donatas Abraitis
58ac0f408f doc: Add RFC 5396 to the supported BGP RFC list
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-07-14 10:29:45 +03:00
Rajesh Gangam
509c7e5cd9 tests: Fix Compilation Error and RuntimePath changes for test_grpc
The runtime path for grpc.so has been changed for test_grpc.cpp
and also there were couple of definitions which are duplicate,
hence renamed them.

Signed-off-by: Rajesh Gangam <rajeshgangam@gmail.com>
2023-07-14 01:17:35 +00:00
Philippe Guibert
58592be577 bgpd: upon if event, evaluate bnc with matching nexthop
In BGP, when an interface event is detected or triggered,
the BNC that have a next-hop that matches the interface
are not evaluated.

The paths attached to the bnc context are evaluated in the
following situation:
- In the up event case, if at least one next-hop interface
matched the event interface.
- In the down event case, if there is no alternate next-hop
that does not use the event interface.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-07-13 12:05:15 +02:00
Philippe Guibert
1b34877af6 bgpd: rename bnc->ifindex to bnc->ifindex_ipv6_ll
This commit changes the 'ifindex' name of the bnc structure.
As it is used only to handle ipv6 link local addresses, let
us use the 'ifindex_ipv6_ll' naming to avoid any confusions
with the ifindex value of the resolved next-hops of the bnc
structure.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-07-13 12:05:15 +02:00
Alexander Chernavin
633eb6ee77 lib: fix on-match when added to existing route-map entry
Currently, "on-match (next|goto)" only works if already present in a
route-map entry when the route-map is applied to the routes. However, if
the command is added to an existing route-map entry, the route-map is
not reapplied to the routes in order to accommodate the changes. And
service restart is needed. The problem is that setting the command
doesn't signal about the change to the listener (i.e. to a routing
daemon).

With this fix, signal to the listener about addition of "on-match
(next|goto)" to a route-map entry.

Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
2023-07-13 08:40:36 +00:00
anlan_cs
871d78e90f bgpd: ignore the wrong interface for nht procedure
`bnc->ifindex` should not be with 0 ( IFINDEX_INTERNAL ), so we can ignore
the wrong interface to make it safe.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2023-07-13 15:51:08 +08:00
anlan_cs
a99521a26f zebra: Fix wrong vrf change procedure
Currently the vrf change procedure for the deleted interface is after
its deletion, it causes problem for upper daemons.

Here is the problem of `bgp`:

After deletion of one **irrelevant** interface in the same vrf, its
`ifindex` is set to 0. And then, the vrf change procedure will send
"ZEBRA_INTERFACE_DOWN" to `bgpd`.

Normally, `bgp_nht_ifp_table_handle()` should igore this message for
no correlation. However, it wrongly matched `ifindex` of 0, and removed
the related routes for the down `bnc`.

Adjust the location of the vrf change procedure to fix this issue.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2023-07-13 15:25:31 +08:00
mobash-rasool
88236d4e95
Merge pull request #13717 from anlancs/fix/pimd-igmp-prot-back-2
pimd: Fix wrong protocol for SSM
2023-07-13 11:04:52 +05:30
mobash-rasool
e4100463c3
Merge pull request #13937 from donaldsharp/ospf6_lsa_unlock_fix
ospf6d: Convert ospf6_lsa_unlock to a better api
2023-07-13 09:12:37 +05:30
Donald Sharp
0cbd5855a9 ospf6d: Convert ospf6_lsa_unlock to a better api
Make the ospf6_lsa_unlock take the same parameters
that the ospf_lsa_unlock does to make it consistent
and to also ensure that no-one can make the mistake
of getting the pointer cleared up.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-07-12 17:56:29 -04:00
Donald Sharp
89bbdb5fdb
Merge pull request #13891 from opensourcerouting/fix/ignore_errors_from_frr-reload.py
tools: Ignore errors for frr reload stuff
2023-07-12 15:11:58 -04:00
Donald Sharp
c362e274b2
Merge pull request #13977 from anlancs/fix/mgmt-bool-change
mgmtd: adjust one unnecessary bool convert
2023-07-12 14:45:58 -04:00
Donald Sharp
e445039e47
Merge pull request #13983 from WiMoVE-OSS/bgpd-memory-leak-table-stats-single
bgpd: Fix memory leak by moving allocation of json object
2023-07-12 14:45:09 -04:00
Farid Mihoub
d748544769 topotests: add basic bgp bmp test
Test BMP messages logging.
Configure the BMP monitoring policy, add and withdraw IPv4/v6 prefixes.
Check if the received messages coincide with the monitored router BGP
session activity.

Signed-off-by: Farid Mihoub <farid.mihoub@6wind.com>
2023-07-12 14:54:06 +02:00
Farid Mihoub
875511c466 topotests: add basic bmp collector
Signed-off-by: Farid Mihoub <farid.mihoub@6wind.com>
2023-07-12 14:54:06 +02:00
Philippe Guibert
492b93bea0 zebra: fix imported static routes deletion
When unconfiguring 'no import <table>', a static route imported
from a routing table number is never deleted.

When importing a route from a given table, a default distance of
15 is applied. At the time of deletion, when trying to compare
the original route with the new one, the distance does not match,
because the static route applies a default distance of 1.

If the imported route has the distance set, unset the distance
flag to avoid comparing it.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-07-12 14:06:00 +02:00
Philippe Guibert
23cd58e857 topotests: add isis redistribute table functionality
Add a test to ensure that isis redistribution works
well.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-07-12 14:06:00 +02:00
Philippe Guibert
4aee03bfd5 isisd: add the 'redistribute table' internal support
The 'redistribute table' command does not create the internal
contexts with the appropriate table identifier.

Redistributed prefixes in IS-IS do not care about the
table identifier. Add a linked list of redistribution
contexts, and map the nb configuration to the linked list.

- A new 'table' attribute is added in the 'struct
isis_redist' context.
- The 'isis_redist_update_zebra_subscriptions()' function
is removed and is replaced by direct call to zebra API
for turning on/off redirection.
- The redistributed routes coming from zebra import the
'tableid' information.
- The fabricd redistribute running-config is reworked,
and the 'get_redist_settings()' function is removed.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-07-12 14:06:00 +02:00
Philippe Guibert
2150647069 isisd: add redistribute table identifier in nb configuration
The yang model does not handle the table identifier in IS-IS.
For each redistributed each address family, a new list of
table elements is added to store the table identifier to
redistribute, and also the optional metric and route-map values
for each table identifier.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-07-12 14:06:00 +02:00
anlan_cs
c826c838d4 mgmtd: adjust one unnecessary bool convert
It is unnecessary to do the bool calculation for expression.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2023-07-12 17:29:28 +08:00
anlan_cs
f8d94e8a62 zebra: remove unnecessary check for default vrf
The default vrf is generally non-NULL, except when shutdown. So, most
of the time it is not necessary to check if it is NULL, we should
remove the useless checks for it.

Searched them with exact match:
```
grep -rI "zebra_vrf_lookup_by_id(VRF_DEFAULT)" | wc -l
31
```

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2023-07-12 17:00:27 +08:00
Donald Sharp
6934a1d31d
Merge pull request #13968 from zhengxiang311019/patch-1
doc: fix the error path.
2023-07-11 12:25:40 -04:00
Russ White
b569109b90
Merge pull request #13963 from chiragshah6/fdev4
tools: fix ospf area stub summary in frr-reload
2023-07-11 11:52:02 -04:00
Russ White
916feb7acc
Merge pull request #13885 from donaldsharp/tests_need_to_be_stricter
Tests need to be stricter
2023-07-11 11:49:38 -04:00
Russ White
89aba318f7
Merge pull request #13876 from LabNConsulting/mjs/nhrp_resolving
Allow NHRP routes to validate incoming nexthops
2023-07-11 11:48:16 -04:00
Russ White
6e89a5db22
Merge pull request #13691 from LabNConsulting/aceelindem/ospf-opaque-interface-disable
ospfd: Configurable interface-level 'capability opaque' support
2023-07-11 11:47:32 -04:00
Donald Sharp
c8971388a9
Merge pull request #13958 from opensourcerouting/fix/coverity
Coverity fixes
2023-07-11 11:26:47 -04:00
Russ White
f46dc78367
Merge pull request #13880 from mjstapp/fix_ospf_intf_socket
ospfd: fix per-interface sockets
2023-07-11 10:23:37 -04:00
Russ White
d602e01745
Merge pull request #13936 from ryndia/fix_ospf_lsa_leak
ospfd: fix lsa leak
2023-07-11 10:22:22 -04:00
Alexander Sohn
2dfc9167ab
bgpd: Fix memory leak by moving allocation of json object
Signed-off-by: Alexander Sohn <github@asohn.de>
2023-07-11 16:21:57 +02:00
Russ White
91336417f5
Merge pull request #13947 from opensourcerouting/feature/bgpd_show_version_if_description_is_not_defined
bgpd: Show neighbors software version if description is not set
2023-07-11 10:20:04 -04:00
Russ White
220d7b1a89
Merge pull request #13948 from opensourcerouting/fix/bgpd_rfc7606_adjustments
bgpd: Some rfc7606 adjustments
2023-07-11 10:19:30 -04:00
Russ White
684ab69ca2
Merge pull request #13955 from opensourcerouting/fix/deprecate_orf_bgpd_130
bgpd: Deprecate Prestandard Outbound Route Filtering capability
2023-07-11 10:18:19 -04:00
Russ White
7682b3f5b4
Merge pull request #13956 from chiragshah6/fdev2
bgpd: fix evpn zclient_send_messge return code
2023-07-11 10:16:55 -04:00
Russ White
f0f2c7be41
Merge pull request #13964 from pguibert6WIND/mpls_again
zebra: fix mpls config on ifaces created post frr
2023-07-11 10:12:04 -04:00
Russ White
49bf7b319f
Merge pull request #13970 from ton31337/fix/bgpd_tunnel_encap_attr
bgpd: Get 1 or 2 octets for Sub-TLV length (Tunnel Encap attr)
2023-07-11 10:09:25 -04:00
Russ White
8467a99b02
Merge pull request #13971 from opensourcerouting/fix-bgp-delayopen-expire-test
tests: fix BGP delayopen timer expiration test
2023-07-11 10:09:01 -04:00
Russ White
29e232a443
Merge pull request #13975 from mjstapp/fix_isis_gmtime
isisd: replace gmtime with gmtime_r
2023-07-11 10:05:43 -04:00
Donatas Abraitis
d052f417cb
Merge pull request #13976 from anlancs/fix/cleanup-23
zebra: adjust one debug info
2023-07-11 13:21:09 +03:00
Donatas Abraitis
41e35fe8c0
Merge pull request #13972 from donaldsharp/bgp_sync_issue
bgpd: Fix table manager to use the synchronous client
2023-07-11 12:53:44 +03:00
Donatas Abraitis
7bd42a835c
Merge pull request #13715 from patrasar/pim_nexthop
pimd, pim6d: Added pimEnabled field in "show ip pim nexthop json" cli
2023-07-11 11:25:18 +03:00