]> git.puffer.fish Git - mirror/frr.git/log
mirror/frr.git
14 months agoospfd: Decode TE TLVs for json output
Olivier Dugeon [Tue, 19 Dec 2023 14:57:49 +0000 (15:57 +0100)]
ospfd: Decode TE TLVs for json output

When dumping ospf database with json output, decode Traffic Engineering TLVs
and sub-TLVs.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
14 months agoospfd: Prepare Opaque LSA for json output
Olivier Dugeon [Tue, 19 Dec 2023 14:56:12 +0000 (15:56 +0100)]
ospfd: Prepare Opaque LSA for json output

Instead of output bulk of data with json output, prepare json context to decode
opaque TLVs and sub-TLVs.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
14 months agoMerge pull request #15355 from idryzhov/fix-mgmtd-notif
Christian Hopps [Mon, 12 Feb 2024 11:17:38 +0000 (06:17 -0500)]
Merge pull request #15355 from idryzhov/fix-mgmtd-notif

Fix and rework YANG notifications

14 months agoMerge pull request #15346 from opensourcerouting/fix/memory_optimizations
Donald Sharp [Mon, 12 Feb 2024 02:33:44 +0000 (21:33 -0500)]
Merge pull request #15346 from opensourcerouting/fix/memory_optimizations

Some more memory optimizations

14 months agoMerge pull request #15356 from idryzhov/configure-sysconfdir
Donald Sharp [Mon, 12 Feb 2024 02:33:00 +0000 (21:33 -0500)]
Merge pull request #15356 from idryzhov/configure-sysconfdir

build: fix configure output

14 months agoMerge pull request #15347 from askorichenko/test-bgp-ttl
Donatas Abraitis [Sun, 11 Feb 2024 20:12:32 +0000 (22:12 +0200)]
Merge pull request #15347 from askorichenko/test-bgp-ttl

bgpd: fix minttl copying during peer reset

14 months agobuild: fix configure output 15356/head
Igor Ryzhov [Sat, 10 Feb 2024 22:53:06 +0000 (00:53 +0200)]
build: fix configure output

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
14 months agolib, mgmtd: rework processing of yang notifications 15355/head
Igor Ryzhov [Sat, 10 Feb 2024 00:11:13 +0000 (02:11 +0200)]
lib, mgmtd: rework processing of yang notifications

Currently, YANG notification processing is done using a special type of
callbacks registered in backend clients. In this commit, we start using
regular northbound infrastructure instead, because it already has a
convenient way of registering xpath-specific callbacks without the need
for creating additional structures for each necessary notification. We
also now pass a notification data to the callback, instead of a plain
JSON. This allows to use regular YANG library functions for inspecting
notification fields, instead of manually parsing the JSON.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
14 months agoMerge pull request #15354 from cscarpitta/fix/fpm-pb-add-missing-include
Donald Sharp [Sun, 11 Feb 2024 01:52:47 +0000 (20:52 -0500)]
Merge pull request #15354 from cscarpitta/fix/fpm-pb-add-missing-include

qpb: Add missing `#include nexthop.h`

14 months agoqpb: Add missing `#include nexthop.h` 15354/head
Carmine Scarpitta [Fri, 9 Feb 2024 23:44:50 +0000 (00:44 +0100)]
qpb: Add missing `#include nexthop.h`

In `qpb.h` we have a bunch of functions that make use of
`union g_addr`. `union g_addr` is defined in `nexthop.h`, which
actually is NOT included in `qpb.h`.

Let's add the missing `#include nexthop.h`.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
14 months agoMerge pull request #15353 from vjardin/yang_converted
Igor Ryzhov [Fri, 9 Feb 2024 23:27:23 +0000 (01:27 +0200)]
Merge pull request #15353 from vjardin/yang_converted

mgmtd: ripng, libs fully converted

14 months agolib, mgmtd: fix processing of yang notifications
Igor Ryzhov [Fri, 9 Feb 2024 22:58:49 +0000 (00:58 +0200)]
lib, mgmtd: fix processing of yang notifications

Current code assumes that notification is always sent in stripped JSON
format and therefore notification xpath starts at the third symbol of
notification data. Assuming JSON is more or less fine, because this
representation is internal to FRR, but the assumption about the xpath is
wrong, because it won't work for not top-level notifications. YANG
allows to define notification as a child for some data node deep into
the tree and in this case notification data contains not only the
notification node itself, but also all its parents.

To fix the issue, parse the notification data and get its xpath from its
schema node.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
14 months agomgmtd: ripng, libs fully converted 15353/head
Vincent JARDIN [Fri, 9 Feb 2024 18:18:48 +0000 (19:18 +0100)]
mgmtd: ripng, libs fully converted

While checking the code, we can notice that they are already converted.

Suggested-by: Igor Ryzhov <iryzhov@nfware.com>
Signed-off-by: Vincent Jardin <vjardin@free.fr>
14 months agobgpd: fix minttl copying during peer reset 15347/head
Alexander Skorichenko [Fri, 9 Feb 2024 15:23:21 +0000 (16:23 +0100)]
bgpd: fix minttl copying during peer reset

Include gtsm_hops (minttl) field when copying peer structure,
so that a new connection could set a proper value.

Signed-off-by: Alexander Skorichenko <askorichenko@netgate.com>
14 months agobgpd: Optimize memory for peer_connection struct 15346/head
Donatas Abraitis [Fri, 9 Feb 2024 15:29:35 +0000 (17:29 +0200)]
bgpd: Optimize memory for peer_connection struct

```
struct peer_connection {
struct peer *              peer;                 /*     0     8 */
enum bgp_fsm_status        status;               /*     8     4 */
enum bgp_fsm_status        ostatus;              /*    12     4 */
int                        fd;                   /*    16     4 */
uint32_t                   thread_flags;         /*    20     4 */
pthread_mutex_t            io_mtx;               /*    24    40 */
/* --- cacheline 1 boundary (64 bytes) --- */
struct stream_fifo *       ibuf;                 /*    64     8 */
struct stream_fifo *       obuf;                 /*    72     8 */
struct ringbuf *           ibuf_work;            /*    80     8 */
struct event *             t_read;               /*    88     8 */
struct event *             t_write;              /*    96     8 */
struct event *             t_connect;            /*   104     8 */
struct event *             t_delayopen;          /*   112     8 */
struct event *             t_start;              /*   120     8 */
/* --- cacheline 2 boundary (128 bytes) --- */
struct event *             t_holdtime;           /*   128     8 */
struct event *             t_connect_check_r;    /*   136     8 */
struct event *             t_connect_check_w;    /*   144     8 */
struct event *             t_gr_restart;         /*   152     8 */
struct event *             t_gr_stale;           /*   160     8 */
struct event *             t_generate_updgrp_packets; /*   168     8 */
struct event *             t_pmax_restart;       /*   176     8 */
struct event *             t_routeadv;           /*   184     8 */
/* --- cacheline 3 boundary (192 bytes) --- */
struct event *             t_process_packet;     /*   192     8 */
struct event *             t_process_packet_error; /*   200     8 */
union sockunion            su;                   /*   208   128 */

/* size: 336, cachelines: 6, members: 25 */
/* last cacheline: 16 bytes */
};   /* saved 8 bytes! */
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
14 months agobgpd: Optimize memory for bgp_nexthop_cache struct
Donatas Abraitis [Fri, 9 Feb 2024 15:25:05 +0000 (17:25 +0200)]
bgpd: Optimize memory for bgp_nexthop_cache struct

```
struct bgp_nexthop_cache {
afi_t                      afi;                  /*     0     4 */
ifindex_t                  ifindex_ipv6_ll;      /*     4     4 */
struct bgp_nexthop_cache_item entry;             /*     8    32 */
uint32_t                   metric;               /*    40     4 */
uint8_t                    nexthop_num;          /*    44     1 */
_Bool                      is_evpn_gwip_nexthop; /*    45     1 */
uint16_t                   change_flags;         /*    46     2 */
struct nexthop *           nexthop;              /*    48     8 */
time_t                     last_update;          /*    56     8 */
/* --- cacheline 1 boundary (64 bytes) --- */
uint16_t                   flags;                /*    64     2 */

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

uint32_t                   srte_color;           /*    68     4 */
struct bgp_nexthop_cache_head * tree;            /*    72     8 */
struct prefix              prefix __attribute__((__aligned__(8))); /*    80    56 */
/* --- cacheline 2 boundary (128 bytes) was 8 bytes ago --- */
void *                     nht_info;             /*   136     8 */
struct path_list           paths;                /*   144     8 */
unsigned int               path_count;           /*   152     4 */

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

struct bgp *               bgp;                  /*   160     8 */

/* size: 168, cachelines: 3, members: 17 */
/* sum members: 162, holes: 2, sum holes: 6 */
/* forced alignments: 1 */
/* last cacheline: 40 bytes */
} __attribute__((__aligned__(8)));   /* saved 16 bytes! */
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
14 months agobgpd: Optimize memory for ecommunity struct
Donatas Abraitis [Fri, 9 Feb 2024 15:21:23 +0000 (17:21 +0200)]
bgpd: Optimize memory for ecommunity struct

```
struct ecommunity {
long unsigned int          refcnt;               /*     0     8 */
uint8_t                    unit_size;            /*     8     1 */
_Bool                      disable_ieee_floating; /*     9     1 */

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

uint32_t                   size;                 /*    12     4 */
uint8_t *                  val;                  /*    16     8 */
char *                     str;                  /*    24     8 */

/* size: 32, cachelines: 1, members: 6 */
/* sum members: 30, holes: 1, sum holes: 2 */
/* last cacheline: 32 bytes */
};   /* saved 8 bytes! */
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
14 months agobgpd: Optimize memory for bgp_adj_out struct
Donatas Abraitis [Fri, 9 Feb 2024 15:18:22 +0000 (17:18 +0200)]
bgpd: Optimize memory for bgp_adj_out struct

```
struct bgp_adj_out {
struct rb_entry            adj_entry;            /*     0    32 */

/* XXX last struct has 4 bytes of padding */

struct update_subgroup *   subgroup;             /*    32     8 */
struct {
struct bgp_adj_out * tqe_next;           /*    40     8 */
struct bgp_adj_out * * tqe_prev;         /*    48     8 */
} subgrp_adj_train;                              /*    40    16 */
struct bgp_dest *          dest;                 /*    56     8 */
/* --- cacheline 1 boundary (64 bytes) --- */
uint32_t                   addpath_tx_id;        /*    64     4 */
uint32_t                   attr_hash;            /*    68     4 */
struct attr *              attr;                 /*    72     8 */
struct bgp_advertise *     adv;                  /*    80     8 */

/* size: 88, cachelines: 2, members: 8 */
/* paddings: 1, sum paddings: 4 */
/* last cacheline: 24 bytes */
};   /* saved 8 bytes! */
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
14 months agoMerge pull request #15327 from routingrocks/pim_evpn_traffic_loss
Jafar Al-Gharaibeh [Fri, 9 Feb 2024 15:15:01 +0000 (09:15 -0600)]
Merge pull request #15327 from routingrocks/pim_evpn_traffic_loss

pimd: re-evaluated S,G OILs upon RP changes and empty SG upstream oils

14 months agoMerge pull request #15333 from c-po/issue-14910
Donatas Abraitis [Fri, 9 Feb 2024 10:34:58 +0000 (12:34 +0200)]
Merge pull request #15333 from c-po/issue-14910

ospfd: can not delete "segment-routing node-msd" when SR if off

14 months agoMerge pull request #15336 from c-po/issue-15335
Donatas Abraitis [Fri, 9 Feb 2024 10:33:59 +0000 (12:33 +0200)]
Merge pull request #15336 from c-po/issue-15335

ospfd: add support for "no router-info [<area|as>] command"

14 months agoospfd: add support for "no router-info [<area|as>] command" 15336/head
Christian Breunig [Thu, 8 Feb 2024 21:39:04 +0000 (22:39 +0100)]
ospfd: add support for "no router-info [<area|as>] command"

frr-reload.py will walk through all config contexts and prepend no to the CLI
command. This requires that the vtysh shell code accepts a full command.

To Reproduce

vtysh -c "conf t" -c "router ospf" -c "router-info area"
vtysh -c "conf t" -c "router ospf" -c "no router-info area"
% Unknown command: no router-info area
vtysh -c "conf t" -c "router ospf" -c "no router-info"

Signed-off-by: Christian Breunig <christian@breunig.cc>
14 months agoospfd: can not delete "segment-routing node-msd" when SR if off 15333/head
Christian Breunig [Thu, 8 Feb 2024 20:53:35 +0000 (21:53 +0100)]
ospfd: can not delete "segment-routing node-msd" when SR if off

This fixes the initial implementation of commit 7743f2f8c00 ("OSPFd: Update
Segment Routing PR following review") where it wsa not possible to remove
the "segment-routing node-msd" CLI nodes via vtysh once segment-routing got
disabled.

Closes #14910

Signed-off-by: Christian Breunig <christian@breunig.cc>
14 months agoMerge pull request #15285 from idryzhov/staticd-nexthop-refcounter
Donald Sharp [Thu, 8 Feb 2024 20:53:30 +0000 (15:53 -0500)]
Merge pull request #15285 from idryzhov/staticd-nexthop-refcounter

staticd: fix nexthop tracking memory leak and add a topotest for VRFs

14 months agopimd: re-evaluated S,G OILs upon RP changes and for empty SG upstream oils 15327/head
Rajesh Varatharaj [Thu, 8 Feb 2024 02:58:39 +0000 (18:58 -0800)]
pimd: re-evaluated S,G OILs upon RP changes and for empty SG upstream oils

Topology:

TOR11 (FHR) --- LEAF-11---SPINE1 (RP)MSDP SPINE-2(RP)MSDP --- LEAF-12 -- TOR12 (LHR)
        |         |                    | |       |
|         -----------------------------------------------------(ECMP)   |
|         |                                 |               |
 -----------------------------------------------------------------------(ECMP)
Issue:
In some triggers, S,G upstream is preserved even with the PP timer expiry, resulting
in S,G with NULL OILS. This could be because we create a dummy S,G upstream and
dummy channel_oif for *,G, where RPF is UNKNOWN. As a result, PIM+VXLAN traffic is never
forwarded downstream to LHR.

Fix:
when the S,G stream is running, Determine if a reevaluation of the outgoing interface
 list (OIL) is required. S,G upstream should then inherit the OIL from *,G.

Testing:
- Evpn pim tests - TestEvpnPimSingleVtepOneMdt.test_02_broadcast_traffic_spt_zero
- pim-smoke

Ticket: #
Signed-off-by: Rajesh Varatharaj <rvaratharaj@nvidia.com>
14 months agoMerge pull request #15255 from louis-6wind/bgp-leak-interface
Donald Sharp [Thu, 8 Feb 2024 16:18:58 +0000 (11:18 -0500)]
Merge pull request #15255 from louis-6wind/bgp-leak-interface

bgpd: fix interface of routes leaked from another VRF

14 months agoMerge pull request #15326 from pguibert6WIND/bgp_flowspec_ipv6_flush
Donald Sharp [Thu, 8 Feb 2024 15:36:00 +0000 (10:36 -0500)]
Merge pull request #15326 from pguibert6WIND/bgp_flowspec_ipv6_flush

bgpd: fix flushing ipv6 flowspec entries when peering stops

14 months agoMerge pull request #15325 from opensourcerouting/fix/show_getsockopt
Donald Sharp [Thu, 8 Feb 2024 15:33:34 +0000 (10:33 -0500)]
Merge pull request #15325 from opensourcerouting/fix/show_getsockopt

bgpd: Do not show TCP MSS if the socket is broken

14 months agoMerge pull request #15316 from LabNConsulting/working/lb/nhrp-nexthop-race-cond
Donald Sharp [Thu, 8 Feb 2024 15:31:46 +0000 (10:31 -0500)]
Merge pull request #15316 from LabNConsulting/working/lb/nhrp-nexthop-race-cond

nhrp: fix race condition in  null lladdr from zebra

14 months agoMerge pull request #15324 from opensourcerouting/fix/doc_route_map_continue
Donald Sharp [Thu, 8 Feb 2024 13:19:56 +0000 (08:19 -0500)]
Merge pull request #15324 from opensourcerouting/fix/doc_route_map_continue

doc: Fix the documentation for route-map continue statement

14 months agonhrp: fix race condition 15316/head
Lou Berger [Tue, 6 Feb 2024 23:14:07 +0000 (23:14 +0000)]
nhrp: fix race condition

where null lladdr recieved from zebra before nhrp next hop
is installed.

Signed-off-by: Lou Berger <lberger@labn.net>
14 months agobgpd: fix flushing ipv6 flowspec entries when peering stops 15326/head
Philippe Guibert [Wed, 7 Feb 2024 21:34:34 +0000 (22:34 +0100)]
bgpd: fix flushing ipv6 flowspec entries when peering stops

When a BGP flowspec peering stops, the BGP RIB entries for IPv6
flowspec entries are removed, but not the ZEBRA RIB IPv6 entries.

Actually, when calling bgp_zebra_withdraw() function call, only
the AFI_IP parameter is passed to the bgp_pbr_update_entry() function
in charge of the Flowspec add/delete in zebra. Fix this by passing
the AFI parameter to the bgp_zebra_withdraw() function.

Note that using topotest does not show up the problem as the
flowspec driver code is not present and was refused. Without that,
routes are not installed, and can not be uninstalled.

Fixes: 529efa234655 ("bgpd: allow flowspec entries to be announced to zebra")
Link: https://github.com/FRRouting/frr/pull/2025
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
14 months agoMerge pull request #15286 from idryzhov/fix-mgmt-startup
Christian Hopps [Wed, 7 Feb 2024 21:04:11 +0000 (16:04 -0500)]
Merge pull request #15286 from idryzhov/fix-mgmt-startup

Fix conflict in mgmtd on startup

14 months agobgpd: Do not show TCP MSS if the socket is broken 15325/head
Donatas Abraitis [Wed, 7 Feb 2024 21:03:37 +0000 (23:03 +0200)]
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>
14 months agodoc: Fix the documentation for route-map continue statement 15324/head
Donatas Abraitis [Wed, 7 Feb 2024 20:56:17 +0000 (22:56 +0200)]
doc: Fix the documentation for route-map continue statement

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
14 months agoMerge pull request #15317 from louis-6wind/fix-affinity-map-odr
Donatas Abraitis [Wed, 7 Feb 2024 20:42:36 +0000 (22:42 +0200)]
Merge pull request #15317 from louis-6wind/fix-affinity-map-odr

lib: fix affinity map duplicate

14 months agovtysh: remove resync workaround when exiting to config node 15286/head
Igor Ryzhov [Fri, 2 Feb 2024 23:15:46 +0000 (01:15 +0200)]
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>
14 months agomgmtd, vtysh: fix possible conflict when reading the config
Igor Ryzhov [Fri, 2 Feb 2024 22:42:58 +0000 (00:42 +0200)]
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>
14 months agolib: fix affinity map duplicate 15317/head
Louis Scalbert [Wed, 7 Feb 2024 12:16:26 +0000 (13:16 +0100)]
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>
14 months agoMerge pull request #15314 from opensourcerouting/fix/remove_bgp_evpn_attr_get_df_pref
Donald Sharp [Wed, 7 Feb 2024 12:44:07 +0000 (07:44 -0500)]
Merge pull request #15314 from opensourcerouting/fix/remove_bgp_evpn_attr_get_df_pref

bgpd: A couple random EVPN findings

14 months agoMerge pull request #15305 from louis-6wind/label-dead-code
Donald Sharp [Tue, 6 Feb 2024 19:50:56 +0000 (14:50 -0500)]
Merge pull request #15305 from louis-6wind/label-dead-code

bgpd: remove dead label code in bgp_update

14 months agoMerge pull request #15283 from okda-networks/doc-update
Donald Sharp [Tue, 6 Feb 2024 16:42:02 +0000 (11:42 -0500)]
Merge pull request #15283 from okda-networks/doc-update

doc: sysrepo plugin doc update with test commands

14 months agoMerge pull request #15311 from louis-6wind/fix-show-srv6-sid
Donald Sharp [Tue, 6 Feb 2024 16:40:14 +0000 (11:40 -0500)]
Merge pull request #15311 from louis-6wind/fix-show-srv6-sid

bgpd: fix displaying srv6 sid

14 months agoMerge pull request #15301 from opensourcerouting/fix/fqdn_capability_dynamic
Donald Sharp [Tue, 6 Feb 2024 16:36:03 +0000 (11:36 -0500)]
Merge pull request #15301 from opensourcerouting/fix/fqdn_capability_dynamic

bgpd: Send FQDN capability via dynamic capability if enabled

14 months agoMerge pull request #15308 from donaldsharp/update_source_documentation
Mark Stapp [Tue, 6 Feb 2024 13:24:17 +0000 (08:24 -0500)]
Merge pull request #15308 from donaldsharp/update_source_documentation

doc: Document `update-source <IFNAME>` command better

14 months agobgpd: remove dead label code in bgp_update 15305/head
Louis Scalbert [Mon, 5 Feb 2024 14:43:45 +0000 (15:43 +0100)]
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>
14 months agotests: add topotest for static routes in VRF 15285/head
Igor Ryzhov [Fri, 2 Feb 2024 17:37:38 +0000 (19:37 +0200)]
tests: add topotest for static routes in VRF

Test how staticd handles VRF creation/deletion.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
14 months agozebra: Use uint16_t for DF preference 15314/head
Donatas Abraitis [Tue, 6 Feb 2024 12:03:36 +0000 (14:03 +0200)]
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>
14 months agobgpd: Drop unused function bgp_evpn_attr_get_df_pref()
Donatas Abraitis [Tue, 6 Feb 2024 12:02:51 +0000 (14:02 +0200)]
bgpd: Drop unused function bgp_evpn_attr_get_df_pref()

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
14 months agoMerge pull request #15287 from donaldsharp/rcu_doc
Donatas Abraitis [Tue, 6 Feb 2024 10:57:32 +0000 (12:57 +0200)]
Merge pull request #15287 from donaldsharp/rcu_doc

doc: Add some documentation around a new pthread call

14 months agoMerge pull request #15309 from donaldsharp/reorg_route_entry
Donatas Abraitis [Tue, 6 Feb 2024 10:52:25 +0000 (12:52 +0200)]
Merge pull request #15309 from donaldsharp/reorg_route_entry

zebra: Reorg `struct route_entry` to have important bits first

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 agodoc: Add some documentation around a new pthread call 15287/head
Donald Sharp [Sat, 3 Feb 2024 13:52:38 +0000 (08:52 -0500)]
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>
14 months agozebra: Reorg `struct route_entry` to have important bits first 15309/head
Donald Sharp [Mon, 5 Feb 2024 19:15:29 +0000 (14:15 -0500)]
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>
14 months agodoc: Document `update-source <IFNAME>` command better 15308/head
Donald Sharp [Mon, 5 Feb 2024 16:55:07 +0000 (11:55 -0500)]
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>
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 agobgpd: Send dynamic capability when on/off FQDN capability 15301/head
Donatas Abraitis [Mon, 5 Feb 2024 08:55:22 +0000 (10:55 +0200)]
bgpd: Send dynamic capability when on/off FQDN capability

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
14 months agobgpd: Do not reset the session if turning on/off FQDN capability
Donatas Abraitis [Mon, 5 Feb 2024 08:40:24 +0000 (10:40 +0200)]
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>
14 months agobgpd: Send FQDN capability via dynamic capability if enabled
Donatas Abraitis [Mon, 5 Feb 2024 06:22:46 +0000 (08:22 +0200)]
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>
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 agostaticd: fix nht memory leak
Igor Ryzhov [Sat, 3 Feb 2024 19:41:37 +0000 (21:41 +0200)]
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>
14 months agostaticd: add a separate function for uninstalling nexthops
Igor Ryzhov [Sat, 3 Feb 2024 19:38:12 +0000 (21:38 +0200)]
staticd: add a separate function for uninstalling nexthops

Will be used in the following commit.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
14 months agostaticd: don't send routes from disabled vrfs to zebra
Igor Ryzhov [Sat, 3 Feb 2024 19:37:06 +0000 (21:37 +0200)]
staticd: don't send routes from disabled vrfs to zebra

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
14 months agostaticd: fix processing nht updates
Igor Ryzhov [Sat, 3 Feb 2024 19:34:18 +0000 (21:34 +0200)]
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>
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: sysrepo plugin doc update with tested commands 15283/head
Amjad Daraiseh [Fri, 2 Feb 2024 06:12:15 +0000 (01:12 -0500)]
doc: sysrepo plugin doc update with tested commands

Signed-off-by: Amjad Daraiseh <adaraiseh@okdanetworks.com>
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>