]> git.puffer.fish Git - mirror/frr.git/log
mirror/frr.git
14 months agobgpd: fix displaying srv6 sid 15311/head
Louis Scalbert [Mon, 5 Feb 2024 15:34:27 +0000 (16:34 +0100)]
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>
14 months agoMerge pull request #15294 from okda-networks/sysrepo_set_sess_err
Donald Sharp [Mon, 5 Feb 2024 19:59:45 +0000 (14:59 -0500)]
Merge pull request #15294 from okda-networks/sysrepo_set_sess_err

lib: set change errmsg in sysrepo session

14 months agoMerge pull request #15291 from idryzhov/mgmtd-yang-embed
Donald Sharp [Mon, 5 Feb 2024 12:34:38 +0000 (07:34 -0500)]
Merge pull request #15291 from idryzhov/mgmtd-yang-embed

lib, mgmtd: fix missing embedded modules

14 months agoMerge pull request #15300 from idryzhov/mgmtd-cli-callbacks
Donald Sharp [Mon, 5 Feb 2024 12:33:51 +0000 (07:33 -0500)]
Merge pull request #15300 from idryzhov/mgmtd-cli-callbacks

lib, mgmtd: don't register NB config callbacks in mgmtd

14 months agoMerge pull request #15289 from idryzhov/coverity-fixes
Donald Sharp [Mon, 5 Feb 2024 12:32:58 +0000 (07:32 -0500)]
Merge pull request #15289 from idryzhov/coverity-fixes

Coverity fixes

14 months agoMerge pull request #15293 from idryzhov/mgmt-read-config
Donald Sharp [Mon, 5 Feb 2024 12:32:03 +0000 (07:32 -0500)]
Merge pull request #15293 from idryzhov/mgmt-read-config

mgmtd: disable lib code for config reading

14 months agoMerge pull request #15297 from idryzhov/mgmtd--n
Donald Sharp [Mon, 5 Feb 2024 12:31:11 +0000 (07:31 -0500)]
Merge pull request #15297 from idryzhov/mgmtd--n

mgmtd: fix missing -n flag and help

14 months agoMerge pull request #15295 from idryzhov/filter-autocompletion
Donatas Abraitis [Mon, 5 Feb 2024 10:43:43 +0000 (12:43 +0200)]
Merge pull request #15295 from idryzhov/filter-autocompletion

fixes for access-list/prefix-list autocompletion

14 months agoMerge pull request #15296 from idryzhov/doc-no
Donatas Abraitis [Mon, 5 Feb 2024 10:43:08 +0000 (12:43 +0200)]
Merge pull request #15296 from idryzhov/doc-no

doc: remove [no] from commands

14 months agostaticd: coverity fixes 15289/head
Igor Ryzhov [Sat, 3 Feb 2024 16:44:59 +0000 (18:44 +0200)]
staticd: coverity fixes

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
14 months agozebra: coverity fixes
Igor Ryzhov [Sat, 3 Feb 2024 16:44:48 +0000 (18:44 +0200)]
zebra: coverity fixes

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
14 months agomgmtd: embed frr-zebra-route-map module 15291/head
Igor Ryzhov [Sat, 3 Feb 2024 20:29:40 +0000 (22:29 +0200)]
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>
14 months agolib: add ietf-yang-metadata to the list of built-in modules
Igor Ryzhov [Sat, 3 Feb 2024 20:27:49 +0000 (22:27 +0200)]
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>
14 months agomgmtd: disable lib code for config reading 15293/head
Igor Ryzhov [Sat, 3 Feb 2024 20:43:58 +0000 (22:43 +0200)]
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>
14 months ago*: use af-specific autocompletion for prefix-lists when possible 15295/head
Igor Ryzhov [Sat, 3 Feb 2024 21:57:56 +0000 (23:57 +0200)]
*: use af-specific autocompletion for prefix-lists when possible

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
14 months agolib: fix autocompletion for prefix-lists
Igor Ryzhov [Sat, 3 Feb 2024 21:57:44 +0000 (23:57 +0200)]
lib: fix autocompletion for prefix-lists

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
14 months agolib: fix autocompletion for access-lists
Igor Ryzhov [Sat, 3 Feb 2024 21:56:15 +0000 (23:56 +0200)]
lib: fix autocompletion for access-lists

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
14 months agodoc: remove [no] from commands 15296/head
Igor Ryzhov [Sat, 3 Feb 2024 23:16:52 +0000 (01:16 +0200)]
doc: remove [no] from commands

The rule is to document only positive versions of commands.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
14 months agolib, mgmtd: don't register NB config callbacks in mgmtd 15297/head
Igor Ryzhov [Sun, 4 Feb 2024 19:52:47 +0000 (21:52 +0200)]
lib, mgmtd: don't register NB config callbacks in mgmtd

mgmtd is supposed to only register CLI callbacks. If configuration
callbacks are registered, they are getting called on startup when mgmtd
reads config files, and they can use infrastructure that is not
initialized on mgmtd, or allocate some memory that is never freed.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
14 months agomgmtd: fix missing -n flag and help
Igor Ryzhov [Sun, 4 Feb 2024 00:46:48 +0000 (02:46 +0200)]
mgmtd: fix missing -n flag and help

Only --vrfwnetns works right now, because -n was missing from short ops.
Also add the missing help.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
14 months agolib, mgmtd: don't register NB config callbacks in mgmtd 15300/head
Igor Ryzhov [Sun, 4 Feb 2024 19:52:47 +0000 (21:52 +0200)]
lib, mgmtd: don't register NB config callbacks in mgmtd

mgmtd is supposed to only register CLI callbacks. If configuration
callbacks are registered, they are getting called on startup when mgmtd
reads config files, and they can use infrastructure that is not
initialized on mgmtd, or allocate some memory that is never freed.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
14 months agoMerge pull request #15298 from donaldsharp/rcu_bites_the_bitey_thing
Igor Ryzhov [Sun, 4 Feb 2024 20:08:14 +0000 (22:08 +0200)]
Merge pull request #15298 from donaldsharp/rcu_bites_the_bitey_thing

Rcu bites the bitey thing

14 months agobgpd: Prevent rpki from hooking multiple times into rcu code 15298/head
Donald Sharp [Sun, 4 Feb 2024 03:35:31 +0000 (22:35 -0500)]
bgpd: Prevent rpki from hooking multiple times into rcu code

As far as I can tell, the rpki code creates a pthread that
is used to handle the i/o associated with talking to the
remote rpki server.  The problem that we are having is that
the rpki code in FRR wants to behave like FRR code and use
the zlog_XXX functions.  These functions all depend on
the RCU code.  Which is a bit picky( and rightly so!!! )
about being started up properly and shut down properly.

This commit is fixing the problem of shutdown.  From
playing with the rpki code, I was able to experimentally
determine that the rpki_create_socket callback function
can be called multiple times per pthread.  Additionally
I was able to clearly see multiple *different* pthreads
actually be created.  This leaves the possiblity
that each time it is called it might be hooking into the
RCU code.  Which makes the rcu code unhappy on shutdown.

Let's address the issue by checking to see if this pthread
has already hooked into the RCU code or not.  If so
then don't do this again.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
14 months agolib: Actually create the rcu and save it before using it
Donald Sharp [Sun, 4 Feb 2024 02:34:02 +0000 (21:34 -0500)]
lib: Actually create the rcu and save it before using it

In a non-controlled startup, the rcu data structures were
not being created until after logging could happen.  This
is bad.  Move it so that the rcu data structures are
created first, before logging( HA! ) can happen.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
14 months agolib: set change errmsg in sysrepo session 15294/head
ali-aqrabawi [Sat, 3 Feb 2024 20:57:13 +0000 (23:57 +0300)]
lib: set change errmsg in sysrepo session

this will enable sysrepo based cli users to know what went wrong
when config change fails

Signed-off-by: ali-aqrabawi <aaqrabaw@okdanetworks.com>
14 months agoMerge pull request #15265 from louis-6wind/fix-rpki-logs
Donald Sharp [Sat, 3 Feb 2024 13:40:27 +0000 (08:40 -0500)]
Merge pull request #15265 from louis-6wind/fix-rpki-logs

bgpd,lib: fix logging from rpki_create_socket()

14 months agoMerge pull request #15192 from fdumontet6WIND/capa_nego
Donatas Abraitis [Sat, 3 Feb 2024 10:19:53 +0000 (12:19 +0200)]
Merge pull request #15192 from fdumontet6WIND/capa_nego

bgpd: add [no]neighbor capability fqdn

14 months agoMerge pull request #10151 from pguibert6WIND/ensure_routing_protocols_good_bw
Donald Sharp [Fri, 2 Feb 2024 17:51:35 +0000 (12:51 -0500)]
Merge pull request #10151 from pguibert6WIND/ensure_routing_protocols_good_bw

zebra: avoid having speed set to UINT32_MAX

14 months agoMerge pull request #15216 from donaldsharp/zebra_opaque_mem_leak
Jafar Al-Gharaibeh [Fri, 2 Feb 2024 16:54:20 +0000 (10:54 -0600)]
Merge pull request #15216 from donaldsharp/zebra_opaque_mem_leak

zebra: Fix opaque memory leak in rare situation

14 months agoMerge pull request #15279 from idryzhov/staticd-fixes
Donald Sharp [Fri, 2 Feb 2024 16:51:03 +0000 (11:51 -0500)]
Merge pull request #15279 from idryzhov/staticd-fixes

several fixes for staticd configuration

14 months agoMerge pull request #15278 from idryzhov/fix-no-vrf
Donatas Abraitis [Fri, 2 Feb 2024 13:23:49 +0000 (15:23 +0200)]
Merge pull request #15278 from idryzhov/fix-no-vrf

lib: fix "no vrf" command

14 months agoMerge pull request #15282 from donaldsharp/poll_info
Donatas Abraitis [Fri, 2 Feb 2024 11:09:49 +0000 (13:09 +0200)]
Merge pull request #15282 from donaldsharp/poll_info

lib: Warn operator when fd limit is set too large

14 months agodoc: add neighbor PEER capability fqdn command 15192/head
Francois Dumontet [Mon, 22 Jan 2024 13:29:48 +0000 (14:29 +0100)]
doc: add neighbor PEER capability fqdn command

improve bgp doc

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
14 months agotests: improve topotest bgp_dont_capability_negotiate
Francois Dumontet [Mon, 22 Jan 2024 13:19:32 +0000 (14:19 +0100)]
tests: improve topotest bgp_dont_capability_negotiate

add some steps for testing of add [no]neighbor capability fqdn
command support.

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
14 months agobgpd: add [no]neighbor capability fqdn command
Francois Dumontet [Mon, 22 Jan 2024 10:53:36 +0000 (11:53 +0100)]
bgpd: add [no]neighbor capability fqdn command

cisco routers are not dealing fairly whith unsupported capabilities.
When a cisco router receive an unsupported capabilities it reset the
negociation without notifying the unmatching capability as described in
RFC2842.
Cisco suggest the use of
neighbor x.x.x.x capability fqdn
to avoid the use of fqdn in open message.

this new command is to remove the use of fqdn capability in the
open message with the peer "x.x.x.x".

Link: https://www.cisco.com/c/en/us/support/docs/ip/border-gateway-protocol-bgp/116189-problemsolution-technology-00.pdf
Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
14 months agobgpd: fix logging from rpki_create_socket() 15265/head
Louis Scalbert [Fri, 2 Feb 2024 09:35:10 +0000 (10:35 +0100)]
bgpd: fix logging from rpki_create_socket()

Fix the following crash when logging from rpki_create_socket():

> #0  raise (sig=<optimized out>) at ../sysdeps/unix/sysv/linux/raise.c:50
> #1  0x00007f6e21723798 in core_handler (signo=6, siginfo=0x7f6e1e502ef0, context=0x7f6e1e502dc0) at lib/sigevent.c:248
> #2  <signal handler called>
> #3  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
> #4  0x00007f6e2144e537 in __GI_abort () at abort.c:79
> #5  0x00007f6e2176348e in _zlog_assert_failed (xref=0x7f6e2180c920 <_xref.16>, extra=0x0) at lib/zlog.c:670
> #6  0x00007f6e216b1eda in rcu_read_lock () at lib/frrcu.c:294
> #7  0x00007f6e21762da8 in vzlog_notls (xref=0x0, prio=2, fmt=0x7f6e217afe50 "%s:%d: %s(): assertion (%s) failed", ap=0x7f6e1e504248) at lib/zlog.c:425
> #8  0x00007f6e217632fb in vzlogx (xref=0x0, prio=2, fmt=0x7f6e217afe50 "%s:%d: %s(): assertion (%s) failed", ap=0x7f6e1e504248) at lib/zlog.c:627
> #9  0x00007f6e217621f5 in zlog (prio=2, fmt=0x7f6e217afe50 "%s:%d: %s(): assertion (%s) failed") at lib/zlog.h:73
> #10 0x00007f6e21763596 in _zlog_assert_failed (xref=0x7f6e2180c920 <_xref.16>, extra=0x0) at lib/zlog.c:687
> #11 0x00007f6e216b1eda in rcu_read_lock () at lib/frrcu.c:294
> #12 0x00007f6e21762da8 in vzlog_notls (xref=0x7f6e21a50040 <_xref.68>, prio=4, fmt=0x7f6e21a4999f "getaddrinfo: debug", ap=0x7f6e1e504878) at lib/zlog.c:425
> #13 0x00007f6e217632fb in vzlogx (xref=0x7f6e21a50040 <_xref.68>, prio=4, fmt=0x7f6e21a4999f "getaddrinfo: debug", ap=0x7f6e1e504878) at lib/zlog.c:627
> #14 0x00007f6e21a3f774 in zlog_ref (xref=0x7f6e21a50040 <_xref.68>, fmt=0x7f6e21a4999f "getaddrinfo: debug") at ./lib/zlog.h:84
> #15 0x00007f6e21a451b2 in rpki_create_socket (_cache=0x55729149cc30) at bgpd/bgp_rpki.c:1337
> #16 0x00007f6e2120e7b7 in tr_tcp_open (tr_socket=0x5572914d1520) at rtrlib/rtrlib/transport/tcp/tcp_transport.c:111
> #17 0x00007f6e2120e212 in tr_open (socket=0x5572914b5e00) at rtrlib/rtrlib/transport/transport.c:16
> #18 0x00007f6e2120faa2 in rtr_fsm_start (rtr_socket=0x557290e17180) at rtrlib/rtrlib/rtr/rtr.c:130
> #19 0x00007f6e218b7ea7 in start_thread (arg=<optimized out>) at pthread_create.c:477
> #20 0x00007f6e21527a2f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

rpki_create_socket() is a hook function called from the rtrlib library.
The issue arises because rtrlib initiates its own separate pthread in which
it runs the hook, which does not establish an FRR RCU context. Consequently,
this leads to failures in the logging mechanism that relies on RCU.

Initialize a new FRR pthread context from the rtrlib pthread with a
valid RCU context to allow logging from the rpki_create_socket() and
dependent functions.

Link: https://github.com/FRRouting/frr/issues/15260
Fixes: a951752d4a ("bgpd: create cache server socket in vrf")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
14 months agolib: add ability to log from external pthread
Louis Scalbert [Fri, 2 Feb 2024 09:25:05 +0000 (10:25 +0100)]
lib: add ability to log from external pthread

External libraries can re-enter the FRR code through a hook function. A
crash occurs when logging from this hook function if the library has
initiated a new pthread, as the FRR RCU context is not initialized for
this thread.

Add frr_pthread_non_controlled_startup() function to initialize a valid
RCU context within a FRR pthread context, originating from an external
pthread.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
14 months agolib: Warn operator when fd limit is set too large 15282/head
Donald Sharp [Fri, 2 Feb 2024 02:18:50 +0000 (21:18 -0500)]
lib: Warn operator when fd limit is set too large

It's unlikely that an operator will ever set a fd
limit of over 100k.  Let's warn the operator that
things are in a bit of a wonky state.

Fixes: #15280
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
14 months agoMerge pull request #15275 from opensourcerouting/fix/one_more_memory_optimization_att...
Donald Sharp [Fri, 2 Feb 2024 01:46:09 +0000 (20:46 -0500)]
Merge pull request #15275 from opensourcerouting/fix/one_more_memory_optimization_attr_struct

bgpd: One more attr struct memory optimization

14 months agolib: fix "no vrf" command 15278/head
Igor Ryzhov [Thu, 1 Feb 2024 22:18:30 +0000 (00:18 +0200)]
lib: fix "no vrf" command

Remove operational data check from CLI command. It never works in mgmtd
and it is not needed in backend daemons because it's done in
`lib_vrf_destroy` callback.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
14 months agostaticd: fix NB dependency hack 15279/head
Igor Ryzhov [Thu, 1 Feb 2024 22:57:59 +0000 (00:57 +0200)]
staticd: fix NB dependency hack

Currently, staticd configuration is tightly coupled with VRF existence.
Because of that, it has to use a hack in NB infrastructure to create a
VRF configuration when at least one static route is configured for this
VRF. This hack is incompatible with mgmtd, because mgmtd doesn't execute
configuration callbacks. Because of that, the configuration may become
out of sync between mgmtd and staticd. There are two main cases:

1. Create static route in a VRF. The VRF data node will be created
   automatically in staticd by the NB hack, but not in mgmtd.
2. Delete VRF which has some static routes configured. The static route
   configuration will be deleted from staticd by the NB hack, but not
   from mgmtd.

To fix the problem, decouple configuration of static routes from VRF
configuration. Now it is possible to configure static routes even if the
VRF doesn't exist yet. Once the VRF is created, staticd applies all the
preconfigured routes.

This change also fixes the problem with static routes being preserved in
the system when staticd "control-plane-protocol" container is deleted
but the VRF is still configured.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
14 months agostaticd: fix nexthops without interface
Igor Ryzhov [Wed, 31 Jan 2024 12:10:09 +0000 (14:10 +0200)]
staticd: fix nexthops without interface

When interface is not set in "ip route" command, CLI passes "(null)" as
an interface name instead of an empty string. The actual code in turn
uses "nh->ifname[0] != 0" to check if the interface name was set. Fix
the problem by changing the "(null)" string into an empty string when
populating the nexthop structure.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
14 months agoRevert "staticd: Accept full blackhole typed keywords for ip_route_cmd"
Igor Ryzhov [Tue, 30 Jan 2024 20:51:46 +0000 (22:51 +0200)]
Revert "staticd: Accept full blackhole typed keywords for ip_route_cmd"

This reverts commit 76b2bc97e73874d882d5cf021972cfca84656cef.

This change is wrong for several reasons:
- it is backwards incompatible - previously it was always possible to
  create blackhole/reject routes using shortened versions of the words
  and it suddenly became impossible if there's an interface in the
  system with the same name
- it uses operational data for validation which is prohibited
- it doesn't really solve the problem with inability to create routes
  using interface names like `bla` or `rej`

14 months agoMerge pull request #15276 from mjstapp/port_registry
Donald Sharp [Thu, 1 Feb 2024 21:07:11 +0000 (16:07 -0500)]
Merge pull request #15276 from mjstapp/port_registry

*: create a single registry of daemons' default port values

14 months agoMerge pull request #15272 from LabNConsulting/chopps/mgmtd-notif-test
Donald Sharp [Thu, 1 Feb 2024 19:56:07 +0000 (14:56 -0500)]
Merge pull request #15272 from LabNConsulting/chopps/mgmtd-notif-test

tests: add mgmtd backend notification test

14 months agoMerge pull request #15264 from opensourcerouting/fix/memory_optimization
Donald Sharp [Thu, 1 Feb 2024 19:55:18 +0000 (14:55 -0500)]
Merge pull request #15264 from opensourcerouting/fix/memory_optimization

bgpd: Optimize memory for rd_ip struct

14 months agoMerge pull request #15270 from LabNConsulting/chopps/fix-rpm-pkg
Donald Sharp [Thu, 1 Feb 2024 19:51:58 +0000 (14:51 -0500)]
Merge pull request #15270 from LabNConsulting/chopps/fix-rpm-pkg

redhat: add option to include mgmtd_testc test client

14 months agoMerge pull request #15266 from donaldsharp/packable
Russ White [Thu, 1 Feb 2024 19:23:58 +0000 (14:23 -0500)]
Merge pull request #15266 from donaldsharp/packable

2 memory optimizations

14 months ago*: create a single registry of daemons' default port values 15276/head
Mark Stapp [Thu, 1 Feb 2024 16:40:02 +0000 (11:40 -0500)]
*: create a single registry of daemons' default port values

Create a single registry of default port values that daemons
are using. Most of these are vty ports, but there are some
others for features like ospfapi and zebra FPM.

Signed-off-by: Mark Stapp <mjs@labn.net>
14 months agobgpd: One more attr struct memory optimization 15275/head
Donatas Abraitis [Thu, 1 Feb 2024 15:28:42 +0000 (17:28 +0200)]
bgpd: One more attr struct memory optimization

```
struct attr {
struct aspath *            aspath;               /*     0     8 */
struct community *         community;            /*     8     8 */
long unsigned int          refcnt;               /*    16     8 */
_uint64_t                  flag;                 /*    24     8 */
struct in_addr             nexthop;              /*    32     4 */
uint32_t                   med;                  /*    36     4 */
uint32_t                   local_pref;           /*    40     4 */
ifindex_t                  nh_ifindex;           /*    44     4 */
uint8_t                    nh_flags;             /*    48     1 */
uint8_t                    origin;               /*    49     1 */
uint8_t                    es_flags;             /*    50     1 */
uint8_t                    router_flag;          /*    51     1 */
uint8_t                    distance;             /*    52     1 */
uint8_t                    df_alg;               /*    53     1 */
uint16_t                   df_pref;              /*    54     2 */
enum pta_type              pmsi_tnl_type;        /*    56     4 */
uint32_t                   rmap_change_flags;    /*    60     4 */
/* --- cacheline 1 boundary (64 bytes) --- */
struct in6_addr            mp_nexthop_global;    /*    64    16 */
struct in6_addr            mp_nexthop_local;     /*    80    16 */
ifindex_t                  nh_lla_ifindex;       /*    96     4 */
mpls_label_t               label;                /*   100     4 */
struct ecommunity *        ecommunity;           /*   104     8 */
struct ecommunity *        ipv6_ecommunity;      /*   112     8 */
struct lcommunity *        lcommunity;           /*   120     8 */
/* --- cacheline 2 boundary (128 bytes) --- */
struct cluster_list *      cluster1;             /*   128     8 */
struct transit *           transit;              /*   136     8 */
struct in_addr             mp_nexthop_global_in; /*   144     4 */
struct in_addr             aggregator_addr;      /*   148     4 */
struct in_addr             originator_id;        /*   152     4 */
uint32_t                   weight;               /*   156     4 */
as_t                       aggregator_as;        /*   160     4 */
uint8_t                    mp_nexthop_len;       /*   164     1 */
uint8_t                    mp_nexthop_prefer_global; /*   165     1 */
uint8_t                    sticky;               /*   166     1 */
uint8_t                    default_gw;           /*   167     1 */
route_tag_t                tag;                  /*   168     4 */
uint32_t                   label_index;          /*   172     4 */
struct bgp_attr_srv6_vpn * srv6_vpn;             /*   176     8 */
struct bgp_attr_srv6_l3vpn * srv6_l3vpn;         /*   184     8 */
/* --- cacheline 3 boundary (192 bytes) --- */
struct bgp_attr_encap_subtlv * encap_subtlvs;    /*   192     8 */
struct bgp_attr_encap_subtlv * vnc_subtlvs;      /*   200     8 */
struct bgp_route_evpn      evpn_overlay;         /*   208    36 */
uint32_t                   mm_seqnum;            /*   244     4 */
uint32_t                   mm_sync_seqnum;       /*   248     4 */
struct ethaddr             rmac;                 /*   252     6 */
/* --- cacheline 4 boundary (256 bytes) was 2 bytes ago --- */
uint16_t                   encap_tunneltype;     /*   258     2 */
uint32_t                   rmap_table_id;        /*   260     4 */
uint32_t                   link_bw;              /*   264     4 */
esi_t                      esi;                  /*   268    10 */

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

uint32_t                   srte_color;           /*   280     4 */
enum nexthop_types_t       nh_type;              /*   284     4 */
enum blackhole_type        bh_type;              /*   288     4 */
uint32_t                   otc;                  /*   292     4 */
_uint64_t                  aigp_metric;          /*   296     8 */

/* size: 304, cachelines: 5, members: 54 */
/* sum members: 302, holes: 1, sum holes: 2 */
/* last cacheline: 48 bytes */
};   /* saved 8 bytes! */
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
14 months agobgpd: Save memory when using bgp_path_info_extra and vnc 15266/head
Donald Sharp [Wed, 31 Jan 2024 18:37:25 +0000 (13:37 -0500)]
bgpd: Save memory when using bgp_path_info_extra and vnc

Structure size of bgp_path_info_extra when compiled
with vnc is 184 bytes.  Reduce this size to 72 bytes
when compiled w/ vnc but not necessarily turned
on vnc.

With 2 full bgp feeds this saves aproximately 100mb
when compiling with vnc and not using vnc.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
14 months agolib: Reduce size of hash_bucket by 8 bytes
Donald Sharp [Wed, 31 Jan 2024 16:33:36 +0000 (11:33 -0500)]
lib: Reduce size of hash_bucket by 8 bytes

pahole reports that the hash_bucket has 2 4 byte holes
in the data structure.  Let's reorganize this a bit
and save 8 bytes per hash_bucket instance.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
14 months agotests: add mgmtd backend notification test 15272/head
Christian Hopps [Thu, 1 Feb 2024 09:36:32 +0000 (04:36 -0500)]
tests: add mgmtd backend notification test

Signed-off-by: Christian Hopps <chopps@labn.net>
14 months agoMerge pull request #15268 from LabNConsulting/chopps/quieter-code
Igor Ryzhov [Thu, 1 Feb 2024 08:54:30 +0000 (10:54 +0200)]
Merge pull request #15268 from LabNConsulting/chopps/quieter-code

lowercase and localize debug/err macros

14 months agoredhat: add option to include mgmtd_testc test client 15270/head
Christian Hopps [Thu, 1 Feb 2024 08:17:44 +0000 (03:17 -0500)]
redhat: add option to include mgmtd_testc test client

Signed-off-by: Christian Hopps <chopps@labn.net>
14 months agomgmtd: convert MGMTD_FE_CLIENT_DBG() to debug_fe_client() 15268/head
Christian Hopps [Thu, 1 Feb 2024 01:06:14 +0000 (20:06 -0500)]
mgmtd: convert MGMTD_FE_CLIENT_DBG() to debug_fe_client()

Signed-off-by: Christian Hopps <chopps@labn.net>
14 months agomgmtd: convert MGMTD_BE_CLIENT_DBG() to debug_be_client()
Christian Hopps [Thu, 1 Feb 2024 01:01:41 +0000 (20:01 -0500)]
mgmtd: convert MGMTD_BE_CLIENT_DBG() to debug_be_client()

Signed-off-by: Christian Hopps <chopps@labn.net>
14 months agomgmtd: convert MGMT_FE_ADAPTER_DBG() to __dbg()
Christian Hopps [Thu, 1 Feb 2024 00:52:26 +0000 (19:52 -0500)]
mgmtd: convert MGMT_FE_ADAPTER_DBG() to __dbg()

Signed-off-by: Christian Hopps <chopps@labn.net>
14 months agomgmtd: convert MGMT_BE_ADAPTER_DBG() to __dbg()
Christian Hopps [Thu, 1 Feb 2024 00:50:23 +0000 (19:50 -0500)]
mgmtd: convert MGMT_BE_ADAPTER_DBG() to __dbg()

Signed-off-by: Christian Hopps <chopps@labn.net>
14 months agomgmtd: convert MGMT_DS_DBG() to __dbg()
Christian Hopps [Wed, 31 Jan 2024 00:53:38 +0000 (19:53 -0500)]
mgmtd: convert MGMT_DS_DBG() to __dbg()

Signed-off-by: Christian Hopps <chopps@labn.net>
14 months agomgmtd: convert MGMT_TXN_DBG() to __dbg()
Christian Hopps [Wed, 31 Jan 2024 00:50:52 +0000 (19:50 -0500)]
mgmtd: convert MGMT_TXN_DBG() to __dbg()

Signed-off-by: Christian Hopps <chopps@labn.net>
14 months agoMerge pull request #15258 from louis-6wind/fix-adj-in-attr
Donatas Abraitis [Wed, 31 Jan 2024 13:06:40 +0000 (15:06 +0200)]
Merge pull request #15258 from louis-6wind/fix-adj-in-attr

bgpd: fix attr comparaison bgp_adj_in_set

14 months agoMerge pull request #15251 from qlyoung/fix-doc-nbcli-numlist
Igor Ryzhov [Wed, 31 Jan 2024 13:06:25 +0000 (15:06 +0200)]
Merge pull request #15251 from qlyoung/fix-doc-nbcli-numlist

doc: fix misformatted list in nbapi docs

14 months agoMerge pull request #15246 from idryzhov/mgmt-get-data-improvements
Christian Hopps [Wed, 31 Jan 2024 11:04:04 +0000 (06:04 -0500)]
Merge pull request #15246 from idryzhov/mgmt-get-data-improvements

mgmt get-data improvements

14 months agobgpd: Optimize memory for rd_ip struct 15264/head
Donatas Abraitis [Wed, 31 Jan 2024 09:29:30 +0000 (11:29 +0200)]
bgpd: Optimize memory for rd_ip struct

```
struct rd_ip {
uint16_t                   type;                 /*     0     2 */
uint16_t                   val;                  /*     2     2 */
struct in_addr             ip;                   /*     4     4 */

/* size: 8, cachelines: 1, members: 3 */
/* last cacheline: 8 bytes */
};   /* saved 4 bytes! */
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
14 months agotests: add tests for mgmt get-data with-defaults parameter 15246/head
Igor Ryzhov [Mon, 29 Jan 2024 22:34:21 +0000 (00:34 +0200)]
tests: add tests for mgmt get-data with-defaults parameter

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
14 months agomgmtd: add our own format definitions for frontend messages
Igor Ryzhov [Sun, 28 Jan 2024 23:05:14 +0000 (01:05 +0200)]
mgmtd: add our own format definitions for frontend messages

It allows people not familiar with libyang and FRR internals to use
mgmtd FE API by looking only at `mgmt_msg_native.h` header. We still use
the same values to avoid a lot of mapping code, and ensure that any
change doesn't slip unnoticed by using static asserts.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
14 months agomgmtd: fix printing an empty data tree
Igor Ryzhov [Sun, 28 Jan 2024 00:35:14 +0000 (02:35 +0200)]
mgmtd: fix printing an empty data tree

We don't need to create an actual tree to print an empty tree, libyang
handles NULL just fine. The actual problem is that `yang_dnode_new`
creates a tree by validating it, and the validation creates all implicit
default nodes. Therefore, when called with "with-default" flags, instead
of getting an empty tree, we get a tree with all top-level default set.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
14 months agomgmtd: add ability to choose datastore to get data from
Igor Ryzhov [Fri, 26 Jan 2024 01:08:55 +0000 (03:08 +0200)]
mgmtd: add ability to choose datastore to get data from

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
14 months agomgmtd: add support for with-defaults parameter to get-data
Igor Ryzhov [Mon, 29 Jan 2024 20:50:26 +0000 (22:50 +0200)]
mgmtd: add support for with-defaults parameter to get-data

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
14 months agoyang: add more ietf models
Igor Ryzhov [Thu, 25 Jan 2024 21:51:13 +0000 (23:51 +0200)]
yang: add more ietf models

These models are needed to use LYD_PRINT_WD_ALL_TAG flag of libyang.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
14 months agoMerge pull request #15254 from LabNConsulting/chopps/notifications
Igor Ryzhov [Wed, 31 Jan 2024 00:18:20 +0000 (02:18 +0200)]
Merge pull request #15254 from LabNConsulting/chopps/notifications

Add YANG notifications

14 months agoMerge pull request #14764 from mjstapp/nb_gen_tool
Igor Ryzhov [Tue, 30 Jan 2024 21:02:18 +0000 (23:02 +0200)]
Merge pull request #14764 from mjstapp/nb_gen_tool

tools, vtysh: add the cli write callback, unhide an NB show command

14 months agobuild: build: make mgmtd test client build conditional 15254/head
Igor Ryzhov [Tue, 30 Jan 2024 19:53:31 +0000 (14:53 -0500)]
build: build: make mgmtd test client build conditional

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
14 months agomgmtd: backend subscriptions to notifications
Christian Hopps [Tue, 30 Jan 2024 06:27:35 +0000 (01:27 -0500)]
mgmtd: backend subscriptions to notifications

Signed-off-by: Christian Hopps <chopps@labn.net>
14 months agoMerge pull request #15257 from opensourcerouting/fix/reinstall_aggregate_route_if_rmap
Russ White [Tue, 30 Jan 2024 20:08:08 +0000 (15:08 -0500)]
Merge pull request #15257 from opensourcerouting/fix/reinstall_aggregate_route_if_rmap

bgpd: Reinstall aggregated routes if using route-maps and it was changed

14 months agotests: add YANG notification test
Christian Hopps [Tue, 30 Jan 2024 08:06:11 +0000 (03:06 -0500)]
tests: add YANG notification test

Signed-off-by: Christian Hopps <chopps@labn.net>
14 months agodoc: update [no] recommendation 15251/head
Quentin Young [Mon, 29 Jan 2024 20:30:19 +0000 (15:30 -0500)]
doc: update [no] recommendation

Signed-off-by: Quentin Young <qlyoung@qlyoung.net>
14 months agoMerge pull request #15163 from opensourcerouting/fix/pam_account
Jafar Al-Gharaibeh [Tue, 30 Jan 2024 16:24:57 +0000 (10:24 -0600)]
Merge pull request #15163 from opensourcerouting/fix/pam_account

packaging: Require account validation with pam_unix.so if PAM enabled

14 months agoMerge pull request #15250 from opensourcerouting/fix/memory_optimizations
Donald Sharp [Tue, 30 Jan 2024 15:56:35 +0000 (10:56 -0500)]
Merge pull request #15250 from opensourcerouting/fix/memory_optimizations

bgpd: Some memory optimizations

14 months agoMerge pull request #15252 from mjstapp/fix_bitfield_init
Donald Sharp [Tue, 30 Jan 2024 15:54:23 +0000 (10:54 -0500)]
Merge pull request #15252 from mjstapp/fix_bitfield_init

lib: init new bitfield word after realloc

14 months agobgpd: fix attr comparaison bgp_adj_in_set 15258/head
Louis Scalbert [Tue, 30 Jan 2024 14:18:43 +0000 (15:18 +0100)]
bgpd: fix attr comparaison bgp_adj_in_set

In bgp_adj_in_set(), attr has not yet been interned. adj->attr is always
different from attr. adj->attr is always uninterned and interned even if
attr and adj->attr are identical.

Fix the comparison.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
14 months agotests: Check if attributes are reapplied for aggregate routes with route-maps 15257/head
Donatas Abraitis [Tue, 30 Jan 2024 13:54:04 +0000 (15:54 +0200)]
tests: Check if attributes are reapplied for aggregate routes with route-maps

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
14 months agobgpd: Reinstall aggregated routes if using route-maps and it was changed
Donatas Abraitis [Tue, 30 Jan 2024 13:44:38 +0000 (15:44 +0200)]
bgpd: Reinstall aggregated routes if using route-maps and it was changed

Without this change when we change the route-map, we never reinstall the route
if the route-map has changed.

We checked only some attributes like aspath, communities, large-communities,
extended-communities, but ignoring the rest of attributes.

With this change, let's check if the route-map has changed.

bgp_route_map_process_update() is triggered on route-map change, and we set
`changed` to true, which treats aggregated route as not the same as it was before.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
14 months agodoc: add doc for show configuration running 14764/head
Mark Stapp [Tue, 21 Nov 2023 20:35:10 +0000 (15:35 -0500)]
doc: add doc for show configuration running

Add a doc entry for the newly-unhidden 'show configuration
running ...' command.

Signed-off-by: Mark Stapp <mjs@labn.net>
14 months agovtysh: un-hide the show configuration nb cli
Mark Stapp [Thu, 9 Nov 2023 15:27:42 +0000 (10:27 -0500)]
vtysh: un-hide the show configuration nb cli

The "show configuration running" cli is pretty useful when
doing NB work; unhide it so it's easier to use.

Signed-off-by: Mark Stapp <mjs@labn.net>
14 months agotools: add config-write callbacks to nb templates
Mark Stapp [Thu, 9 Nov 2023 15:26:06 +0000 (10:26 -0500)]
tools: add config-write callbacks to nb templates

Add the cli_show (config write) callback when emitting the
create or modify callback in the northbound template. Split
the config-handling and config-output callbacks into two
structs/arrays; this seems to be helpful when doing mgmtd
conversion.

Signed-off-by: Mark Stapp <mjs@labn.net>
14 months agolib: mgmtd: add YANG notification support
Christian Hopps [Tue, 30 Jan 2024 08:05:18 +0000 (03:05 -0500)]
lib: mgmtd: add YANG notification support

Signed-off-by: Christian Hopps <chopps@labn.net>
14 months agoMerge pull request #15238 from louis-6wind/bgp-leak-network
Donatas Abraitis [Tue, 30 Jan 2024 06:21:05 +0000 (08:21 +0200)]
Merge pull request #15238 from louis-6wind/bgp-leak-network

bgpd: fix VRF leaking with 'network import-check'

14 months agobgpd: Optimize memory usage for bgp_damp_config struct 15250/head
Donatas Abraitis [Mon, 29 Jan 2024 14:21:21 +0000 (16:21 +0200)]
bgpd: Optimize memory usage for bgp_damp_config struct

```
struct bgp_damp_config {
        unsigned int               suppress_value;       /*     0     4 */
        unsigned int               reuse_limit;          /*     4     4 */
        time_t                     max_suppress_time;    /*     8     8 */
        time_t                     half_life;            /*    16     8 */
        unsigned int               reuse_list_size;      /*    24     4 */
        unsigned int               reuse_index_size;     /*    28     4 */
        unsigned int               ceiling;              /*    32     4 */
        unsigned int               decay_rate_per_tick;  /*    36     4 */
        unsigned int               decay_array_size;     /*    40     4 */
        unsigned int               reuse_scale_factor;   /*    44     4 */
        double                     scale_factor;         /*    48     8 */
        double *                   decay_array;          /*    56     8 */
        /* --- cacheline 1 boundary (64 bytes) --- */
        int *                      reuse_index;          /*    64     8 */
        struct bgp_damp_info * *   reuse_list;           /*    72     8 */
        int                        reuse_offset;         /*    80     4 */
        safi_t                     safi;                 /*    84     4 */
        struct bgp_damp_info *     no_reuse_list;        /*    88     8 */
        struct event *             t_reuse;              /*    96     8 */
        afi_t                      afi;                  /*   104     4 */

        /* size: 112, cachelines: 2, members: 19 */
        /* padding: 4 */
        /* last cacheline: 48 bytes */
};   /* saved 8 bytes! */
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
14 months agobgpd: Optimize memory usage for bgp_aggregate struct
Donatas Abraitis [Mon, 29 Jan 2024 14:18:54 +0000 (16:18 +0200)]
bgpd: Optimize memory usage for bgp_aggregate struct

```
struct bgp_aggregate {
        uint8_t                    summary_only;         /*     0     1 */
        uint8_t                    as_set;               /*     1     1 */
        uint8_t                    origin;               /*     2     1 */
        _Bool                      med_mismatched;       /*     3     1 */
        _Bool                      med_initialized;      /*     4     1 */
        _Bool                      match_med;            /*     5     1 */

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

        struct {
                char *             name;                 /*     8     8 */
                struct route_map * map;                  /*    16     8 */
        } rmap;                                          /*     8    16 */
        long unsigned int          count;                /*    24     8 */
        long unsigned int          incomplete_origin_count; /*    32     8 */
        long unsigned int          egp_origin_count;     /*    40     8 */
        struct hash *              community_hash;       /*    48     8 */
        struct hash *              ecommunity_hash;      /*    56     8 */
        /* --- cacheline 1 boundary (64 bytes) --- */
        struct hash *              lcommunity_hash;      /*    64     8 */
        struct hash *              aspath_hash;          /*    72     8 */
        struct community *         community;            /*    80     8 */
        struct ecommunity *        ecommunity;           /*    88     8 */
        struct lcommunity *        lcommunity;           /*    96     8 */
        struct aspath *            aspath;               /*   104     8 */
        safi_t                     safi;                 /*   112     4 */
        uint32_t                   med_matched_value;    /*   116     4 */
        char *                     suppress_map_name;    /*   120     8 */
        /* --- cacheline 2 boundary (128 bytes) --- */
        struct route_map *         suppress_map;         /*   128     8 */

        /* size: 136, cachelines: 3, members: 22 */
        /* sum members: 134, holes: 1, sum holes: 2 */
        /* last cacheline: 8 bytes */
};
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
14 months agobgpd: Optimize memory usage for bgp_static struct
Donatas Abraitis [Mon, 29 Jan 2024 14:00:07 +0000 (16:00 +0200)]
bgpd: Optimize memory usage for bgp_static struct

```
struct bgp_static {
        int                        backdoor;             /*     0     4 */
        uint32_t                   label_index;          /*     4     4 */
        uint8_t                    valid;                /*     8     1 */

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

        uint16_t                   encap_tunneltype;     /*    10     2 */
        uint32_t                   igpmetric;            /*    12     4 */
        struct in_addr             igpnexthop;           /*    16     4 */
        uint32_t                   atomic;               /*    20     4 */
        struct {
                char *             name;                 /*    24     8 */
                struct route_map * map;                  /*    32     8 */
        } rmap;                                          /*    24    16 */
        struct prefix_rd           prd __attribute__((__aligned__(8))); /*    40    16 */
        char *                     prd_pretty;           /*    56     8 */
        /* --- cacheline 1 boundary (64 bytes) --- */
        mpls_label_t               label;                /*    64     4 */

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

        esi_t *                    eth_s_id;             /*    72     8 */
        struct ethaddr *           router_mac;           /*    80     8 */
        struct prefix              gatewayIp __attribute__((__aligned__(8))); /*    88    56 */

        /* size: 144, cachelines: 3, members: 14 */
        /* sum members: 139, holes: 2, sum holes: 5 */
        /* forced alignments: 2 */
        /* last cacheline: 16 bytes */
} __attribute__((__aligned__(8)));   /* saved 8 bytes! */
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
14 months agobgpd: Optimize memory usage for attr struct
Donatas Abraitis [Mon, 29 Jan 2024 13:56:07 +0000 (15:56 +0200)]
bgpd: Optimize memory usage for attr struct

```
struct attr {
struct aspath *            aspath;               /*     0     8 */
struct community *         community;            /*     8     8 */
long unsigned int          refcnt;               /*    16     8 */
_uint64_t                  flag;                 /*    24     8 */
struct in_addr             nexthop;              /*    32     4 */
uint32_t                   med;                  /*    36     4 */
uint32_t                   local_pref;           /*    40     4 */
ifindex_t                  nh_ifindex;           /*    44     4 */
uint8_t                    origin;               /*    48     1 */
uint8_t                    es_flags;             /*    49     1 */
uint8_t                    router_flag;          /*    50     1 */
uint8_t                    default_gw;           /*    51     1 */
enum pta_type              pmsi_tnl_type;        /*    52     4 */
uint32_t                   rmap_change_flags;    /*    56     4 */
struct in6_addr            mp_nexthop_global;    /*    60    16 */
/* --- cacheline 1 boundary (64 bytes) was 12 bytes ago --- */
struct in6_addr            mp_nexthop_local;     /*    76    16 */
ifindex_t                  nh_lla_ifindex;       /*    92     4 */
struct ecommunity *        ecommunity;           /*    96     8 */
struct ecommunity *        ipv6_ecommunity;      /*   104     8 */
struct lcommunity *        lcommunity;           /*   112     8 */
struct cluster_list *      cluster1;             /*   120     8 */
/* --- cacheline 2 boundary (128 bytes) --- */
struct transit *           transit;              /*   128     8 */
struct in_addr             mp_nexthop_global_in; /*   136     4 */
struct in_addr             aggregator_addr;      /*   140     4 */
struct in_addr             originator_id;        /*   144     4 */
uint32_t                   weight;               /*   148     4 */
as_t                       aggregator_as;        /*   152     4 */
uint8_t                    mp_nexthop_len;       /*   156     1 */
uint8_t                    mp_nexthop_prefer_global; /*   157     1 */
uint8_t                    sticky;               /*   158     1 */
uint8_t                    distance;             /*   159     1 */
uint16_t                   encap_tunneltype;     /*   160     2 */
uint8_t                    df_alg;               /*   162     1 */

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

route_tag_t                tag;                  /*   164     4 */
uint32_t                   label_index;          /*   168     4 */
mpls_label_t               label;                /*   172     4 */
struct bgp_attr_srv6_vpn * srv6_vpn;             /*   176     8 */
struct bgp_attr_srv6_l3vpn * srv6_l3vpn;         /*   184     8 */
/* --- cacheline 3 boundary (192 bytes) --- */
struct bgp_attr_encap_subtlv * encap_subtlvs;    /*   192     8 */
struct bgp_attr_encap_subtlv * vnc_subtlvs;      /*   200     8 */
struct bgp_route_evpn      evpn_overlay;         /*   208    36 */
uint32_t                   mm_seqnum;            /*   244     4 */
uint32_t                   mm_sync_seqnum;       /*   248     4 */
struct ethaddr             rmac;                 /*   252     6 */
/* --- cacheline 4 boundary (256 bytes) was 2 bytes ago --- */
uint16_t                   df_pref;              /*   258     2 */
uint32_t                   rmap_table_id;        /*   260     4 */
uint32_t                   link_bw;              /*   264     4 */
esi_t                      esi;                  /*   268    10 */

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

uint32_t                   srte_color;           /*   280     4 */
uint32_t                   otc;                  /*   284     4 */
enum nexthop_types_t       nh_type;              /*   288     4 */
enum blackhole_type        bh_type;              /*   292     4 */
_uint64_t                  aigp_metric;          /*   296     8 */

/* size: 304, cachelines: 5, members: 53 */
/* sum members: 301, holes: 2, sum holes: 3 */
/* last cacheline: 48 bytes */
};   /* saved 16 bytes! */
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
15 months agoMerge pull request #15248 from LabNConsulting/chopps/fix-comp-warning
Igor Ryzhov [Mon, 29 Jan 2024 18:52:00 +0000 (20:52 +0200)]
Merge pull request #15248 from LabNConsulting/chopps/fix-comp-warning

zebra: fix compiler warning about truncation.

15 months agolib: init new bitfield word after realloc 15252/head
Mark Stapp [Mon, 29 Jan 2024 17:56:28 +0000 (12:56 -0500)]
lib: init new bitfield word after realloc

Realloc doesn't init - ensure a newly-allocated word is inited.

Signed-off-by: Mark Stapp <mjs@labn.net>
15 months agodoc: fix misformatted list in nbapi docs
Quentin Young [Mon, 29 Jan 2024 17:28:32 +0000 (09:28 -0800)]
doc: fix misformatted list in nbapi docs

Signed-off-by: Quentin Young <qlyoung@qlyoung.net>
15 months agolib,ospf6d: fix reference bandwidth description 10151/head
Philippe Guibert [Wed, 29 Apr 2020 08:05:19 +0000 (10:05 +0200)]
lib,ospf6d: fix reference bandwidth description

Fix reference bandwidth description. It is Kbps, not Mbps.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
15 months agodoc, yang, zebra: allow bandwidth up to 1 terabit/sec
Philippe Guibert [Wed, 22 Apr 2020 11:33:20 +0000 (13:33 +0200)]
doc, yang, zebra: allow bandwidth up to 1 terabit/sec

Allow bandwidth up to 1000000 Mb/s (ie. 1 Tb/s) and document it.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
15 months agozebra: fix speed set to UINT32_MAX
Philippe Guibert [Wed, 15 Apr 2020 13:16:11 +0000 (15:16 +0200)]
zebra: fix speed set to UINT32_MAX

get_iflink_speed() returns UINT32_MAX when the speeds is unknown.
Routing daemons (at least ospfd) interprets it as the high value.

Return errors in get_iflink_speed() to avoid the confusion.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
15 months agobgpd: Optimize memory usage for bgp_nlri struct
Donatas Abraitis [Mon, 29 Jan 2024 13:37:23 +0000 (15:37 +0200)]
bgpd: Optimize memory usage for bgp_nlri struct

```
struct bgp_nlri {
uint16_t                   afi;                  /*     0     2 */
uint8_t                    safi;                 /*     2     1 */

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

bgp_size_t                 length;               /*     4     2 */

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

uint8_t *                  nlri;                 /*     8     8 */

/* size: 16, cachelines: 1, members: 4 */
/* sum members: 13, holes: 2, sum holes: 3 */
/* last cacheline: 16 bytes */
};   /* saved 8 bytes! */
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>