Commit Graph

34980 Commits

Author SHA1 Message Date
Christian Hopps
ab3d0846bd
Merge pull request #15286 from idryzhov/fix-mgmt-startup
Fix conflict in mgmtd on startup
2024-02-07 16:04:11 -05:00
Donatas Abraitis
65497556ed bgpd: Do not show TCP MSS if the socket is broken
Just avoid calling for TCP MSS socket option if it's not in use.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-02-07 23:03:37 +02:00
Donatas Abraitis
fce81856ed doc: Fix the documentation for route-map continue statement
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-02-07 22:57:56 +02:00
Donatas Abraitis
acd7b6922e
Merge pull request #15317 from louis-6wind/fix-affinity-map-odr
lib: fix affinity map duplicate
2024-02-07 22:42:36 +02:00
Donatas Abraitis
4d7975ee59 bgpd: Add neighbor X send-community extended rpki command
By default, iBGP and eBGP-OAD peers exchange RPKI extended community by default.

Add a command to disable sending RPKI extended community if needed.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-02-07 22:35:21 +02:00
Donatas Abraitis
f6463dab85 tests: Test if RPKI extended community can be disabled between peers
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-02-07 22:35:21 +02:00
Donatas Abraitis
39d6ba6e86 doc: Add neighbor X send-community extended rpki command
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-02-07 22:35:21 +02:00
Igor Ryzhov
2574f03a13 vtysh: remove resync workaround when exiting to config node
When exiting from a level below the config node, like `router rip`,
vtysh executes a resync by sending "end" and "conf term [file-lock]"
commands to all the daemons. As statet in the description comment, it's
done "in case one of the daemons is somewhere else". I don't think this
actually ever happens, but even if it is, it is a bug in a daemon that
needs to be fixed. This resync was okay before the introduction of
mgmtd, but now it unlocks and locks back the datastores during the
configuration reading process, which can lead to a failure which is
explained in the previous commit.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-07 18:37:29 +02:00
Igor Ryzhov
0db4d555e9 mgmtd, vtysh: fix possible conflict when reading the config
When FRR starts, after mgmtd is initialized, backend clients connect to
it and request their config. To supply the config, mgmtd creates a
configuration transaction. At the same time, `vtysh -b` tries to read
the startup config and configure mgmtd, which also creates a
configuration transaction. If these two actions happen at the exact same
time, there's a conflict between them, because only a single
configuration translaction is allowed. Because of that, vtysh fails and
the config is completely ignored.

When starting the config reading, vtysh locks candidate and running
datastores in mgmtd. This commit adds locking of running datastore when
initializing the backend client. It allows to retry locking on the vtysh
side and read the config only when the lock is aquired instead of
failing.

This change also prevents running datastore from being changed during
initialization of backend clients. This could lead to a desynchronized
state between mgmtd and backends.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-07 18:37:29 +02:00
Donald Sharp
729dd6f626 lib, ospfclient, tests, vtysh: Allow for a minimum fd poll size
There exists cases where just honoring the FD_LIMIT size
as given to us by the operating system makes no sense.
Let's just make a switch to allow for this for things
like vtysh and ospfclient which will never have 1k files
open at any given time.

Fixes: #15315
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-02-07 10:38:02 -05:00
Louis Scalbert
83e0d67854 lib: fix affinity map duplicate
Fix duplicate definition of frr_affinity_map_cli_info in libfrr.so.0 and
libmgmt_be_nb.so.0

> =================================================================
> ==3860488==ERROR: AddressSanitizer: odr-violation (0x7f12c98c4d20):
>   [1] size=296 'frr_affinity_map_cli_info' lib/affinitymap_cli.c:77:35
>   [2] size=296 'frr_affinity_map_cli_info' lib/affinitymap_cli.c:77:35
> These globals were registered at these points:
>   [1]:
>     #0 0x7f12c9a36f40 in __asan_register_globals ../../../../src/libsanitizer/asan/asan_globals.cpp:341
>     #1 0x7f12c9585b7d in _sub_I_00099_1 (/lib/libfrr.so.0+0x185b7d)
>     #2 0x7f12ca437fe1 in call_init elf/dl-init.c:72
>
>   [2]:
>     #0 0x7f12c9a36f40 in __asan_register_globals ../../../../src/libsanitizer/asan/asan_globals.cpp:341
>     #1 0x7f12c93824ed in _sub_I_00099_1 (/lib/libmgmt_be_nb.so.0+0x6f4ed)
>     #2 0x7f12ca437fe1 in call_init elf/dl-init.c:72
>
> ==3860488==HINT: if you don't care about these errors you may set ASAN_OPTIONS=detect_odr_violation=0
> SUMMARY: AddressSanitizer: odr-violation: global 'frr_affinity_map_cli_info' at lib/affinitymap_cli.c:77:35
> ==3860488==ABORTING

Fixes: dc6ff4c0de ("lib: convert affinity-map to mgmtd")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-02-07 14:54:08 +01:00
David Schweizer
1bd96365e4
tests: Reduce wait intervals in test_bgp_snmp_bgp4v2mib
Remove sleep time in test_bgp_snmp_bgp4v2mib before run_and_expect and
reduce wait intervals for faster test convergence.

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
Signed-off-by: David Schweizer <dschweizer@opensourcerouting.org>
2024-02-07 13:56:10 +01:00
David Schweizer
961667e34f
topotests: fix snmptrap log OID parsing
Replace OID string parsing of snmptrap log files based on odd/even line
numbers with regex string search to prevent test failures in cases where
log entries don't match assumed order.

Signed-off-by: David Schweizer <dschweizer@opensourcerouting.org>
2024-02-07 13:56:09 +01:00
Donald Sharp
7fe05d6185
Merge pull request #15314 from opensourcerouting/fix/remove_bgp_evpn_attr_get_df_pref
bgpd: A couple random EVPN findings
2024-02-07 07:44:07 -05:00
Donald Sharp
1bc2fa3584
Merge pull request #15305 from louis-6wind/label-dead-code
bgpd: remove dead label code in bgp_update
2024-02-06 14:50:56 -05:00
Donald Sharp
f28447e352
Merge pull request #15283 from okda-networks/doc-update
doc: sysrepo plugin doc update with test commands
2024-02-06 11:42:02 -05:00
Donald Sharp
a791deff91
Merge pull request #15311 from louis-6wind/fix-show-srv6-sid
bgpd: fix displaying srv6 sid
2024-02-06 11:40:14 -05:00
Donald Sharp
e369d2cca8
Merge pull request #15301 from opensourcerouting/fix/fqdn_capability_dynamic
bgpd: Send FQDN capability via dynamic capability if enabled
2024-02-06 11:36:03 -05:00
Mark Stapp
ac275c89c3
Merge pull request #15308 from donaldsharp/update_source_documentation
doc: Document `update-source <IFNAME>` command better
2024-02-06 08:24:17 -05:00
Louis Scalbert
0603626184 bgpd: remove dead label code in bgp_update
No need to init new_attr. It is not used until it is overridden.

> new_attr = *attr;

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-02-06 13:30:14 +01:00
Igor Ryzhov
763ce7bb37 tests: add topotest for static routes in VRF
Test how staticd handles VRF creation/deletion.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-06 14:15:37 +02:00
Donatas Abraitis
82d43634a4 zebra: Use uint16_t for DF preference
It's 16-bits everywhere, not sure why it was here as 32.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-02-06 14:03:36 +02:00
Donatas Abraitis
bd7bad9121 bgpd: Drop unused function bgp_evpn_attr_get_df_pref()
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-02-06 14:02:51 +02:00
Donatas Abraitis
969b2d420c
Merge pull request #15287 from donaldsharp/rcu_doc
doc: Add some documentation around a new pthread call
2024-02-06 12:57:32 +02:00
Donatas Abraitis
3204cc1540
Merge pull request #15309 from donaldsharp/reorg_route_entry
zebra: Reorg `struct route_entry` to have important bits first
2024-02-06 12:52:25 +02:00
Louis Scalbert
e2138a634d bgpd: fix displaying srv6 sid
98efa5bc6b ("bgpd: bgp_path_info_extra memory optimization") has removed
SID info from the extra structure.

Do not test for extra presence.

Fixes: 98efa5bc6b ("bgpd: bgp_path_info_extra memory optimization")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-02-06 11:21:21 +01:00
Donald Sharp
87b69cdd74
Merge pull request #15294 from okda-networks/sysrepo_set_sess_err
lib: set change errmsg in sysrepo session
2024-02-05 14:59:45 -05:00
Donald Sharp
c1e2086930 doc: Add some documentation around a new pthread call
Not necessarily the correct place for this but there
is no other place and it needs to be called out and I
would rather have some documentation in place.  Long
term I would like to add a bunch of frr_pthread documentation
but at this point in time it's not there.  We can
re-arrange when that happens.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-02-05 14:51:55 -05:00
Donald Sharp
56e62d88c5 zebra: Reorg struct route_entry to have important bits first
The `struct route_entry` had items that were almost never used at
the front of the data structure resulting in items that would be
loaded first into memory that were never used.  Let's reorg a
tiny bit and put all the frequently used items in the first cache
line.  I'm sure people will notice .000000001 speedup

new layout:

sharpd@eva /w/h/s/frr1 (reorg_route_entry)> /home/sharpd/pahole/build/pahole --reorganize --show_reorg_steps -C route_entry zebra/.libs/zebra
struct route_entry {
	struct re_list_item        next;                 /*     0     8 */
	struct nhg_hash_entry *    nhe;                  /*     8     8 */
	uint32_t                   nhe_id;               /*    16     4 */
	uint32_t                   nhe_installed_id;     /*    20     4 */
	int                        type;                 /*    24     4 */
	vrf_id_t                   vrf_id;               /*    28     4 */
	uint32_t                   table;                /*    32     4 */
	uint32_t                   metric;               /*    36     4 */
	uint32_t                   mtu;                  /*    40     4 */
	uint32_t                   nexthop_mtu;          /*    44     4 */
	uint32_t                   flags;                /*    48     4 */
	uint32_t                   status;               /*    52     4 */
	uint32_t                   dplane_sequence;      /*    56     4 */
	uint16_t                   instance;             /*    60     2 */
	uint8_t                    distance;             /*    62     1 */

	/* XXX 1 byte hole, try to pack */

	/* --- cacheline 1 boundary (64 bytes) --- */
	route_tag_t                tag;                  /*    64     4 */

	/* XXX 4 bytes hole, try to pack */

	time_t                     uptime;               /*    72     8 */
	struct re_opaque *         opaque;               /*    80     8 */
	struct nexthop_group       fib_ng;               /*    88    32 */
	struct nexthop_group       fib_backup_ng;        /*   120    32 */

	/* size: 152, cachelines: 3, members: 20 */
	/* sum members: 147, holes: 2, sum holes: 5 */
	/* last cacheline: 24 bytes */
};

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-02-05 14:17:55 -05:00
Donald Sharp
5842a70a19 doc: Document update-source <IFNAME> command better
There was a question in regards to how the update-source
choose the ip address for the source when using the `update-source`
command in BGP.  Upon looking at the code, I was a but surprised,
so I decided to document this behavior.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-02-05 13:33:25 -05:00
Donald Sharp
afb034b0bb vtysh: Remove deprecated shell_access code
This code has been deprecated for over a year and frankly
needs to be removed from the system.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-02-05 08:49:18 -05:00
Donald Sharp
cac925f005
Merge pull request #15291 from idryzhov/mgmtd-yang-embed
lib, mgmtd: fix missing embedded modules
2024-02-05 07:34:38 -05:00
Donald Sharp
71ea80bc47
Merge pull request #15300 from idryzhov/mgmtd-cli-callbacks
lib, mgmtd: don't register NB config callbacks in mgmtd
2024-02-05 07:33:51 -05:00
Donald Sharp
354d823763
Merge pull request #15289 from idryzhov/coverity-fixes
Coverity fixes
2024-02-05 07:32:58 -05:00
Donald Sharp
c4da71387b
Merge pull request #15293 from idryzhov/mgmt-read-config
mgmtd: disable lib code for config reading
2024-02-05 07:32:03 -05:00
Donald Sharp
015c11646d
Merge pull request #15297 from idryzhov/mgmtd--n
mgmtd: fix missing -n flag and help
2024-02-05 07:31:11 -05:00
Donatas Abraitis
ef2fad92d7
Merge pull request #15295 from idryzhov/filter-autocompletion
fixes for access-list/prefix-list autocompletion
2024-02-05 12:43:43 +02:00
Donatas Abraitis
11a6f06ebd
Merge pull request #15296 from idryzhov/doc-no
doc: remove [no] from commands
2024-02-05 12:43:08 +02:00
Donatas Abraitis
c8acc6709c bgpd: Send dynamic capability when on/off FQDN capability
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-02-05 12:23:53 +02:00
Donatas Abraitis
04e2401d20 bgpd: Do not reset the session if turning on/off FQDN capability
Allow BGP dynamic capabilities handle this gracefully.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-02-05 10:43:50 +02:00
Donatas Abraitis
3e99dcc626 bgpd: Send FQDN capability via dynamic capability if enabled
Since we have a knob to disable sending FQDN capability, it MUST be checked
before sending it using dynamic capabilities.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-02-05 08:22:46 +02:00
Igor Ryzhov
4bde9511c3 staticd: coverity fixes
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-04 22:28:33 +02:00
Igor Ryzhov
19631dcab5 zebra: coverity fixes
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-04 22:28:33 +02:00
Igor Ryzhov
3c05d53bf8 staticd: fix nht memory leak
When a static route with a gateway nexthop is created, the nexthop is
sent to zebra for NHT, and added to a local hash. When the nexthop's VRF
is deleted from kernel, nexthop still stays in the hash. This is a
memory leak, because it is never deleted from there. Even if the VRF is
recreated in kernel, it is assigned with a new `vrf_id` so the old hash
entry is not reused, and a new one is created. To fix the issue, remove
all nexthops from the hash when the corresponding VRF is deleted, do not
add nexthops to the hash if their corresponding VRF doesn't exist in
kernel and don't add the same nexthop to the hash multiple times.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-04 22:28:10 +02:00
Igor Ryzhov
6090b2b939 staticd: add a separate function for uninstalling nexthops
Will be used in the following commit.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-04 22:28:10 +02:00
Igor Ryzhov
0d9127bca1 staticd: don't send routes from disabled vrfs to zebra
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-04 22:28:10 +02:00
Igor Ryzhov
6da3e78ce5 staticd: fix processing nht updates
When processing an NHT update, we should go though all `static_vrf`
structures instead of regualar `vrf`, because some of `static_vrf` may
not have corresponding `vrf` and will miss the update.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-04 22:28:10 +02:00
Igor Ryzhov
633f019118 mgmtd: embed frr-zebra-route-map module
All used modules should be embedded to ensure work on all operating
systems.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-04 22:27:28 +02:00
Igor Ryzhov
066bb6dc2d lib: add ietf-yang-metadata to the list of built-in modules
We don't need to manually load built-in modules. This fixes the
following warning in mgmtd:
```
YANG model "ietf-yang-metadata@*" "*@*"not embedded, trying external file
```

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-04 22:27:28 +02:00
Igor Ryzhov
3c40cead5a mgmtd: disable lib code for config reading
mgmtd reads config files on its own, it doesn't need libfrr to do that.
The code is already skipped, because mgmtd uses `di->read_in` thread for
config reading and libfrr doesn't reschedule the thread, so this commit
just removes the dead code.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2024-02-04 22:27:11 +02:00