]> git.puffer.fish Git - matthieu/frr.git/log
matthieu/frr.git
13 months agotests: enable code coverage reporting with topotests
Christian Hopps [Sun, 17 Mar 2024 08:27:31 +0000 (04:27 -0400)]
tests: enable code coverage reporting with topotests

Signed-off-by: Christian Hopps <chopps@labn.net>
13 months agoMerge pull request #15545 from donaldsharp/bgp_attr_dump
Donatas Abraitis [Fri, 15 Mar 2024 07:43:45 +0000 (09:43 +0200)]
Merge pull request #15545 from donaldsharp/bgp_attr_dump

bgpd: Add some missing data to `show bgp attribute-info`

13 months agobgpd: Add some missing data to `show bgp attribute-info`
Donald Sharp [Wed, 13 Mar 2024 23:26:10 +0000 (19:26 -0400)]
bgpd: Add some missing data to `show bgp attribute-info`

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
13 months agoMerge pull request #15538 from idryzhov/fix-zebra-warning
Donatas Abraitis [Thu, 14 Mar 2024 08:38:24 +0000 (10:38 +0200)]
Merge pull request #15538 from idryzhov/fix-zebra-warning

zebra: fix compilation warnings

13 months agoMerge pull request #15466 from donaldsharp/bgp_filter_fun
Donatas Abraitis [Thu, 14 Mar 2024 08:25:14 +0000 (10:25 +0200)]
Merge pull request #15466 from donaldsharp/bgp_filter_fun

Bgp filter fun

13 months agoMerge pull request #15501 from donaldsharp/fpm_listener_send_response
Donatas Abraitis [Thu, 14 Mar 2024 07:05:32 +0000 (09:05 +0200)]
Merge pull request #15501 from donaldsharp/fpm_listener_send_response

Fpm listener send response

13 months agobgpd: Ensure community data is freed in some cases.
Donald Sharp [Sat, 2 Mar 2024 14:50:38 +0000 (09:50 -0500)]
bgpd: Ensure community data is freed in some cases.

Customer has this valgrind trace:

Direct leak of 2829120 byte(s) in 70728 object(s) allocated from:
  0 in community_new ../bgpd/bgp_community.c:39
  1 in community_uniq_sort ../bgpd/bgp_community.c:170
  2 in route_set_community ../bgpd/bgp_routemap.c:2342
  3 in route_map_apply_ext ../lib/routemap.c:2673
  4 in subgroup_announce_check ../bgpd/bgp_route.c:2367
  5 in subgroup_process_announce_selected ../bgpd/bgp_route.c:2914
  6 in group_announce_route_walkcb ../bgpd/bgp_updgrp_adv.c:199
  7 in hash_walk ../lib/hash.c:285
  8 in update_group_af_walk ../bgpd/bgp_updgrp.c:2061
  9 in group_announce_route ../bgpd/bgp_updgrp_adv.c:1059
 10 in bgp_process_main_one ../bgpd/bgp_route.c:3221
 11 in bgp_process_wq ../bgpd/bgp_route.c:3221
 12 in work_queue_run ../lib/workqueue.c:282

The above leak detected by valgrind was from a screenshot so I copied it
by hand.  Any mistakes in line numbers are purely from my transcription.
Additionally this is against a slightly modified 8.5.1 version of FRR.
Code inspection of 8.5.1 -vs- latest master shows the same problem
exists.  Code should be able to be followed from there to here.

What is happening:

There is a route-map being applied that modifes the outgoing community
to a peer.  This is saved in the attr copy created in
subgroup_process_announce_selected.  This community pointer is not
interned.  So the community->refcount is still 0.  Normally when
a prefix is announced, the attr and the prefix are placed on a
adjency out structure where the attribute is interned.  This will
cause the community to be saved in the community hash list as well.
In a non-normal operation when the decision to send is aborted after
the route-map application, the attribute is just dropped and the
pointer to the community is just dropped too, leading to situations
where the memory is leaked.  The usage of bgp suppress-fib would
would be a case where the community is caused to be leaked.
Additionally the previous commit where an unsuppress-map is used
to modify the outgoing attribute but since unsuppress-map was
not considered part of outgoing policy the attribute would be dropped as
well.  This pointer drop also extends to any dynamically allocated
memory saved by the attribute pointer that was not interned yet as well.

So let's modify the return case where the decision is made to
not send the prefix to the peer to always just flush the attribute
to ensure memory is not leaked.

Fixes: #15459
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
13 months agobgpd: Include unsuppress-map as a valid outgoing policy
Donald Sharp [Sat, 2 Mar 2024 14:42:30 +0000 (09:42 -0500)]
bgpd: Include unsuppress-map as a valid outgoing policy

If unsuppress-map is setup for outgoing peers, consider that
policy is being applied as for RFC 8212.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
13 months agobgpd: Ensure that the correct aspath is free'd
Donald Sharp [Wed, 13 Mar 2024 14:26:58 +0000 (10:26 -0400)]
bgpd: Ensure that the correct aspath is free'd

Currently in subgroup_default_originate the attr.aspath
is set in bgp_attr_default_set, which hashs the aspath
and creates a refcount for it.  If this is a withdraw
the subgroup_announce_check and bgp_adj_out_set_subgroup
is called which will intern the attribute.  This will
cause the the attr.aspath to be set to a new value
finally at the bottom of the function it intentionally
uninterns the aspath which is not the one that was
created for this function.  This reduces the other
aspath's refcount by 1 and if a clear bgp * is issued
fast enough the aspath for that will be removed
and the system will crash.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
13 months agoMerge pull request #15532 from opensourcerouting/fix/vrf_default_originate
Jafar Al-Gharaibeh [Wed, 13 Mar 2024 21:44:03 +0000 (16:44 -0500)]
Merge pull request #15532 from opensourcerouting/fix/vrf_default_originate

bgpd: Check the route and the nexthop appropriately when validating NH

13 months agoMerge pull request #15531 from donaldsharp/ospf6_list
Mark Stapp [Wed, 13 Mar 2024 12:39:26 +0000 (08:39 -0400)]
Merge pull request #15531 from donaldsharp/ospf6_list

eigrpd, mgmtd, ospf6d: frr_fini is last

13 months agoMerge pull request #15526 from sri-mohan1/srib-24-zebra-a
Donatas Abraitis [Wed, 13 Mar 2024 10:41:07 +0000 (12:41 +0200)]
Merge pull request #15526 from sri-mohan1/srib-24-zebra-a

zebra: changes for code maintainability

13 months agobgpd: Check the route and the nexthop appropriately when validating NH
Donatas Abraitis [Tue, 12 Mar 2024 17:48:26 +0000 (19:48 +0200)]
bgpd: Check the route and the nexthop appropriately when validating NH

A route and its nexthop might belong to different VRFs. Therefore, we need
both the bgp and bgp_nexthop pointers.

Fixes: 8d51fafdcbef3dcf06df796e4f9b83d2bbd5edc2 ("bgpd: Drop bgp_static_update_safi() function")
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
13 months agozebra: Add ability to pretend routes are offloaded
Donald Sharp [Thu, 7 Mar 2024 01:53:20 +0000 (20:53 -0500)]
zebra: Add ability to pretend routes are offloaded

In the fpm_listener add a -r option to allow for
routes to be notified back to zebra that the route
has been `offloaded` properly.

fpm_listener output:
New route 4.5.6.7/32, Prot: Static(196), Metric: 20, nhgid: 23
  Route Static(196) reflecting back
FPM message - Type: 1, Length 56
New route 169.254.0.0/16, Prot: Kernel(2), Metric: 20, nhgid: 2
FPM message - Type: 1, Length 56
New route 192.168.99.0/24, Prot: Kernel(2), Metric: 20, nhgid: 42
FPM message - Type: 1, Length 56
New route 192.168.99.1/32, Prot: Kernel(2), Metric: 20, nhgid: 42
FPM message - Type: 1, Length 56
New route 192.168.119.0/24, Prot: OSPF(188), Metric: 20, nhgid: 20
  Route OSPF(188) reflecting back

Zebra output:

2024-03-06 21:48:54.613 [DEBG] zebra: [TJXPZ-RC5XQ] default(0:254):4.5.6.7/32 Processing dplane notif ctx 0x7160b4008780
2024-03-06 21:48:54.613 [DEBG] zebra: [TJXPZ-RC5XQ] default(0:254):192.168.119.0/24 Processing dplane notif ctx 0x7160b4008780

eva# show ip route 4.5.6.7 json
{
  "4.5.6.7/32":[
    {
      "prefix":"4.5.6.7/32",
      "prefixLen":32,
      "protocol":"static",
      "vrfId":0,
      "vrfName":"default",
      "selected":true,
      "destSelected":true,
      "distance":1,
      "metric":0,
      "installed":true,
      "offloaded":true,
....

and

eva# show ip route 192.168.119.0 json
{
  "192.168.119.0/24":[
    {
      "prefix":"192.168.119.0/24",
      "prefixLen":24,
      "protocol":"ospf",
      "vrfId":0,
      "vrfName":"default",
      "selected":true,
      "destSelected":true,
      "distance":110,
      "metric":100,
      "installed":true,
      "offloaded":true,
...

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
13 months agozebra: fpm_listener start adding data about nexthops
Donald Sharp [Thu, 7 Mar 2024 02:02:27 +0000 (21:02 -0500)]
zebra: fpm_listener start adding data about nexthops

Start some very small bit of work into the fpm_listener
about RTM_NEWNEXTHOPS.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
13 months agozebra: Add some additional known protocols for fpm_listener
Donald Sharp [Thu, 7 Mar 2024 01:33:23 +0000 (20:33 -0500)]
zebra: Add some additional known protocols for fpm_listener

Just add a few more of the known protocols.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
13 months agoeigrpd, mgmtd, ospf6d: frr_fini is last
Donald Sharp [Tue, 12 Mar 2024 17:12:48 +0000 (13:12 -0400)]
eigrpd, mgmtd, ospf6d: frr_fini is last

I noticed that ospf6d always had a linked list memory leak.
Tracking it down shows that frr_fini() shuts down the memory
system and prints out memory not cleaned up.  eigrpd, mgmtd
and ospf6d all called cleanup functions after frr_fini leaving
memory leaked that was not really leaked.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
13 months agozebra: fix compilation warnings
Igor Ryzhov [Tue, 12 Mar 2024 23:35:51 +0000 (01:35 +0200)]
zebra: fix compilation warnings

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
13 months agoMerge pull request #15539 from donaldsharp/cleanup_leaky_sieve
Donatas Abraitis [Wed, 13 Mar 2024 07:07:57 +0000 (09:07 +0200)]
Merge pull request #15539 from donaldsharp/cleanup_leaky_sieve

zebra: Cleanup leaked memory on shutdown from GR code

13 months agozebra: Cleanup leaked memory on shutdown from GR code
Donald Sharp [Wed, 13 Mar 2024 01:15:29 +0000 (21:15 -0400)]
zebra: Cleanup leaked memory on shutdown from GR code

Recent commit: 6b2554b94a
Exposed, via Address Sanitation, that memory was being
leaked.  Unfortunately the CI system did not catch this.

Two pieces of memory were being lost: The zserv client
data structure as well as anything on the client->gr_info_queue.
Clean these up.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
13 months agoMerge pull request #15457 from opensourcerouting/fix/docker_builds_for_10.0
Russ White [Tue, 12 Mar 2024 13:52:39 +0000 (09:52 -0400)]
Merge pull request #15457 from opensourcerouting/fix/docker_builds_for_10.0

docker: Fix build for Alpine Linux after the recent changes since 9.1

13 months agozebra: changes for code maintainability
sri-mohan1 [Tue, 12 Mar 2024 05:36:35 +0000 (11:06 +0530)]
zebra: changes for code maintainability

these changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
13 months agoMerge pull request #15523 from donaldsharp/lib_mtype_cleanup
Donatas Abraitis [Tue, 12 Mar 2024 06:14:10 +0000 (07:14 +0100)]
Merge pull request #15523 from donaldsharp/lib_mtype_cleanup

Lib mtype cleanup

13 months agolib: Remove MTYPE_SYSREPO it is not used
Donald Sharp [Mon, 11 Mar 2024 20:52:51 +0000 (16:52 -0400)]
lib: Remove MTYPE_SYSREPO it is not used

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
13 months agolib: Remove unused MTYPE_MSG_NATIVE_MSG
Donald Sharp [Mon, 11 Mar 2024 20:52:21 +0000 (16:52 -0400)]
lib: Remove unused MTYPE_MSG_NATIVE_MSG

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
13 months agolib: Remove unused mtypes from affinitymap.c
Donald Sharp [Mon, 11 Mar 2024 20:07:14 +0000 (16:07 -0400)]
lib: Remove unused mtypes from affinitymap.c

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
13 months agozebra: Clean up leaked linklist data structure on shutdown
Donald Sharp [Mon, 11 Mar 2024 20:05:56 +0000 (16:05 -0400)]
zebra: Clean up leaked linklist data structure on shutdown

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
13 months agoMerge pull request #15411 from raja-rajasekar/rajasekarr/backpressure_bgp_zebra_zserv
Mark Stapp [Mon, 11 Mar 2024 20:04:13 +0000 (16:04 -0400)]
Merge pull request #15411 from raja-rajasekar/rajasekarr/backpressure_bgp_zebra_zserv

zebra: backpressure - Zebra push back on Buffer/Stream creation

13 months agoMerge pull request #15517 from idryzhov/fix-yang-notif-actions
Donald Sharp [Mon, 11 Mar 2024 19:47:17 +0000 (15:47 -0400)]
Merge pull request #15517 from idryzhov/fix-yang-notif-actions

lib: fix initialization of northbound nodes

13 months agolib: Remove unused memory types
Donald Sharp [Mon, 11 Mar 2024 17:04:09 +0000 (13:04 -0400)]
lib: Remove unused memory types

These are never used.  So let's remove them.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
13 months agoMerge pull request #15516 from opensourcerouting/freebsd-printf-sync-20240310
Donald Sharp [Mon, 11 Mar 2024 14:32:32 +0000 (10:32 -0400)]
Merge pull request #15516 from opensourcerouting/freebsd-printf-sync-20240310

lib/printf: pick up ISO C23 / N2680 from FreeBSD

13 months agoMerge pull request #15513 from opensourcerouting/fix/bgp_default_software_version
Donald Sharp [Mon, 11 Mar 2024 11:17:09 +0000 (07:17 -0400)]
Merge pull request #15513 from opensourcerouting/fix/bgp_default_software_version

bgpd: Fix `no` form for `neighbor X capability software-version`

13 months agoMerge pull request #15514 from opensourcerouting/fix/bgp_dynamic_capability_handle_unset
Donald Sharp [Mon, 11 Mar 2024 11:16:24 +0000 (07:16 -0400)]
Merge pull request #15514 from opensourcerouting/fix/bgp_dynamic_capability_handle_unset

bgpd: Unset advertised capabilities if capability is disabled

13 months agolib: fix initialization of northbound nodes
Igor Ryzhov [Sun, 10 Mar 2024 15:35:21 +0000 (17:35 +0200)]
lib: fix initialization of northbound nodes

When actions and notification are defined as descendants of other nodes,
they are not getting initialized, because the iterator skips them. Fix
the iterator to include them when traversing the schema.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
13 months agoMerge pull request #15515 from opensourcerouting/zlog-recirculate-ldpd
Donald Sharp [Sun, 10 Mar 2024 17:12:46 +0000 (13:12 -0400)]
Merge pull request #15515 from opensourcerouting/zlog-recirculate-ldpd

ldpd, lib: integrate lde/ldpe into standard logging infrastructure

13 months agotests: Check if capabilities can be disabled via dynamic capabilities
Donatas Abraitis [Sun, 10 Mar 2024 16:51:05 +0000 (18:51 +0200)]
tests: Check if capabilities can be disabled via dynamic capabilities

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
13 months agobgpd: Allow dynamically disable graceful-restart/long-lived graceful-restart
Donatas Abraitis [Sun, 10 Mar 2024 16:25:30 +0000 (18:25 +0200)]
bgpd: Allow dynamically disable graceful-restart/long-lived graceful-restart

If we enter `bgp graceful-restart-disable`, make sure we disable the capabilities.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
13 months agodoc: update re. ISO C23 printf changes
David Lamparter [Sun, 10 Mar 2024 12:40:19 +0000 (13:40 +0100)]
doc: update re. ISO C23 printf changes

The new `%w99d` fixed-width modifier still needs work in `frr-format`,
which unfortunately is not as trivial as `%b` was.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
13 months agolib/printf: update README
David Lamparter [Sun, 10 Mar 2024 12:21:37 +0000 (13:21 +0100)]
lib/printf: update README

Make a note that `%w[f](8|16|32|64)d` was picked up.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
13 months agotests: exercise `%w`/`%wf` printfrr modifiers
David Lamparter [Sun, 10 Mar 2024 12:30:46 +0000 (13:30 +0100)]
tests: exercise `%w`/`%wf` printfrr modifiers

Added by ISO C23 / N2680, implementation imported from FreeBSD.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
13 months agolib/printf: Implement N2680.
Dag-Erling Smørgrav [Thu, 7 Sep 2023 06:14:44 +0000 (06:14 +0000)]
lib/printf: Implement N2680.

This adds specific width length modifiers in the form of wN and wfN
(where N is 8, 16, 32, or 64) which allow printing intN_t and
int_fastN_t without resorting to casts or PRI macros.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D41725

FRR changes only include printf(), scanf/strtol are not locally
implemented in FRR.  Also added "(void) 0" to empty "else ..." to
avoid a compiler warning.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from FreeBSD commit bce0bef3c6abab92c7ac8cc23b7cc632a382721e)

13 months agoldpd: use zlog recirculation for subprocesses
David Lamparter [Thu, 25 Jan 2024 21:54:54 +0000 (22:54 +0100)]
ldpd: use zlog recirculation for subprocesses

This way, full functionality of `zlog_*` is available.

Having `fatal()` be wrappers around `assertf()` also means we get
backtraces, which is not the case for a plain `exit(1)`.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
13 months agolib: allow recirculating/relaying log messages
David Lamparter [Thu, 25 Jan 2024 21:11:44 +0000 (22:11 +0100)]
lib: allow recirculating/relaying log messages

This is primarily intended for ldpd with its split-process architecture.
The LDE/LDPE subprocesses currently lose the extended zlog
functionality.

The zlog_live target already encapsulates all necessary bits for vtysh.
Reuse it for a relay function to be used in the main ldpd process.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
13 months agobgpd: Unset advertised capabilities if capability is disabled
Donatas Abraitis [Sat, 9 Mar 2024 20:17:27 +0000 (22:17 +0200)]
bgpd: Unset advertised capabilities if capability is disabled

When using dynamic capabilities, do not forget to unset advertised capabilities.

Otherwise, it's kept as advertised.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
13 months agobgpd: Fix `no` form for `neighbor X capability software-version`
Donatas Abraitis [Sat, 9 Mar 2024 19:52:17 +0000 (21:52 +0200)]
bgpd: Fix `no` form for `neighbor X capability software-version`

If `bgp default software-version-capability` is enabled, allow unsetting this
for a single neighbor also.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
13 months agoMerge pull request #15510 from idryzhov/fix-rip-ripng-rpc
Donatas Abraitis [Sat, 9 Mar 2024 10:15:20 +0000 (11:15 +0100)]
Merge pull request #15510 from idryzhov/fix-rip-ripng-rpc

fix rip/ripng yang rpcs

13 months agolib: Drop include/linux/mroute[6].h
Donatas Abraitis [Sat, 9 Mar 2024 07:34:41 +0000 (09:34 +0200)]
lib: Drop include/linux/mroute[6].h

Not needed anymore since https://github.com/FRRouting/frr/pull/15509/commits/a5389154a1363ea778e0cafddc34f1964631278c.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
13 months agodocker: Fix post function for Alpine build (package)
Donatas Abraitis [Thu, 29 Feb 2024 12:43:57 +0000 (14:43 +0200)]
docker: Fix post function for Alpine build (package)

It was using a wrong sysdir.

```
--------------------
  72 |     # Own the config / PID files
  73 |     RUN mkdir -p /var/run/frr
  74 | >>> RUN chown -R frr:frr /etc/frr /var/run/frr
  75 |
  76 |     # Simple init manager for reaping processes and forwarding signals
--------------------
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
13 months agodocker: Do not use pip Python package manager
Donatas Abraitis [Thu, 29 Feb 2024 12:37:40 +0000 (14:37 +0200)]
docker: Do not use pip Python package manager

Alpine Linux gets this with 3.19:

This is already installed with `pytest` via apk package manager.

```
15 78.20 error: externally-managed-environment
15 78.20
15 78.20 Ã— This environment is externally managed
15 78.20 â•°â”€>
15 78.20     The system-wide python installation should be maintained using the system
15 78.20     package manager (apk) only.
15 78.20
15 78.20     If the package in question is not packaged already (and hence installable via
15 78.20     "apk add py3-somepackage"), please consider installing it inside a virtual
15 78.20     environment, e.g.:
15 78.20
15 78.20     python3 -m venv /path/to/venv
15 78.20     . /path/to/venv/bin/activate
15 78.20     pip install mypackage
15 78.20
15 78.20     To exit the virtual environment, run:
15 78.20
15 78.20     deactivate
15 78.20
15 78.20     The virtual environment is not deleted, and can be re-entered by re-sourcing
15 78.20     the activate file.
15 78.20
15 78.20     To automatically manage virtual environments, consider using pipx (from the
15 78.20     pipx package).
15 78.20
15 78.20 note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
13 months agodocker: Use Alpine Linux version 3.19
Donatas Abraitis [Thu, 29 Feb 2024 12:35:17 +0000 (14:35 +0200)]
docker: Use Alpine Linux version 3.19

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
13 months agovtysh: Include fnctl.h for vtysh_main
Donatas Abraitis [Thu, 29 Feb 2024 12:21:27 +0000 (14:21 +0200)]
vtysh: Include fnctl.h for vtysh_main

Fixing compilation for Alpine Linux:

```
25 91.59 vtysh/vtysh_main.c: In function 'vtysh_flock_config':
25 91.59 vtysh/vtysh_main.c:276:20: warning: implicit declaration of function 'open'; did you mean 'popen'? [-Wimplicit-function-declaration]
25 91.59   276 |         flock_fd = open(flock_file, O_RDONLY, 0644);
25 91.59       |                    ^~~~
25 91.59       |                    popen
25 91.60 vtysh/vtysh_main.c:276:37: error: 'O_RDONLY' undeclared (first use in this function)
25 91.60   276 |         flock_fd = open(flock_file, O_RDONLY, 0644);
25 91.60       |                                     ^~~~~~~~
25 91.60 vtysh/vtysh_main.c:276:37: note: each undeclared identifier is reported only once for each function it appears in
25 91.60   CC       zebra/if_netlink.o
25 91.61 vtysh/vtysh_main.c: In function 'main':
25 91.61 vtysh/vtysh_main.c:637:49: error: 'O_CREAT' undeclared (first use in this function)
25 91.61   637 |                         fp = open(history_file, O_CREAT | O_EXCL,
25 91.61       |                                                 ^~~~~~~
25 91.62 vtysh/vtysh_main.c:637:59: error: 'O_EXCL' undeclared (first use in this function)
25 91.62   637 |                         fp = open(history_file, O_CREAT | O_EXCL,
25 91.62       |                                                           ^~~~~~
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
13 months agolib: Fix unknown sig_atomic_t compile error
Donatas Abraitis [Thu, 29 Feb 2024 12:17:20 +0000 (14:17 +0200)]
lib: Fix unknown sig_atomic_t compile error

This is happening for Alpine Linux.

```
26 64.59 ./lib/sigevent.h:23:18: error: unknown type name 'sig_atomic_t'
26 64.59    23 |         volatile sig_atomic_t caught; /* private member   */
26 64.59       |                  ^~~~~~~~~~~~
26 64.60 In file included from ./lib/libfrr.h:12,
26 64.60                  from ./lib/vty.h:28,
26 64.60                  from ./lib/command.h:11,
26 64.60                  from ./lib/debug.h:11,
26 64.60                  from ./mgmtd/mgmt.h:12,
26 64.60                  from mgmtd/mgmt_history.c:14:
26 64.60 ./lib/sigevent.h:23:18: error: unknown type name 'sig_atomic_t'
26 64.60    23 |         volatile sig_atomic_t caught; /* private member   */
26 64.60       |                  ^~~~~~~~~~~~
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
13 months agodocker: Use libyang 2.1.128 for Alpine builds
Donatas Abraitis [Thu, 29 Feb 2024 12:08:50 +0000 (14:08 +0200)]
docker: Use libyang 2.1.128 for Alpine builds

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
13 months agoMerge pull request #15509 from donaldsharp/freebsd_cleanups
Donatas Abraitis [Sat, 9 Mar 2024 07:31:48 +0000 (08:31 +0100)]
Merge pull request #15509 from donaldsharp/freebsd_cleanups

pimd: Cleanup inclusion of headers

13 months agoripngd: fix "clear ipv6 ripng" command
Igor Ryzhov [Fri, 8 Mar 2024 22:01:01 +0000 (00:01 +0200)]
ripngd: fix "clear ipv6 ripng" command

mgmtd doesn't support YANG RPCs yet, so this command must go directly to
ripngd.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
13 months agoripd: fix "clear ip rip" command
Igor Ryzhov [Fri, 8 Mar 2024 22:00:12 +0000 (00:00 +0200)]
ripd: fix "clear ip rip" command

mgmtd doesn't support YANG RPCs yet, so this command must go directly to
ripd.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
13 months agopimd: Cleanup inclusion of headers
Donald Sharp [Fri, 8 Mar 2024 18:04:34 +0000 (18:04 +0000)]
pimd: Cleanup inclusion of headers

FRR needs to properly include the FreeBSD headers for
compilation on FreeBSD.  I have setup v6 as well
but I have not even tested it.  Since I know
that the form is the same I think this is ok
at the moment.  This is a step forward.

Because of this change *clearly* no-one is even
using pim on FreeBSD.  <look at the MRT_XXX values
to prove to yourself>.  In any event this is a step
in the direction of getting that working again.

Signed-off-by: Donald Sharp <sharpd@freebsd.network>
13 months agoMerge pull request #15469 from LabNConsulting/chopps/keychain-yang
Donald Sharp [Fri, 8 Mar 2024 13:15:02 +0000 (08:15 -0500)]
Merge pull request #15469 from LabNConsulting/chopps/keychain-yang

add ietf-key-chain YANG module support

13 months agoMerge pull request #15497 from idryzhov/show-run-fixes
Donald Sharp [Fri, 8 Mar 2024 13:11:14 +0000 (08:11 -0500)]
Merge pull request #15497 from idryzhov/show-run-fixes

a couple of fixes for "show running-config"

13 months agoMerge pull request #15506 from fdumontet6WIND/local_link
Donatas Abraitis [Fri, 8 Mar 2024 07:19:25 +0000 (08:19 +0100)]
Merge pull request #15506 from fdumontet6WIND/local_link

ospf6d: add localLinkLocalAddress field

13 months agozebra: backpressure - Zebra push back on Buffer/Stream creation
Rajasekar Raja [Mon, 12 Feb 2024 18:44:18 +0000 (10:44 -0800)]
zebra: backpressure - Zebra push back on Buffer/Stream creation

Currently, the way zebra works is it creates pthread per client (BGP is
of interest in this case) and this thread loops itself in zserv_read()
to check for any incoming data. If there is one, then it reads,
validates and adds it in the ibuf_fifo signalling the main thread to
process the message. The main thread when it gets a change, processes
the message, and invokes the function pointer registered in the header
command. (Ex: zserv_handlers).

Finally, if all of this was successful, this task reschedules itself and
loops in zserv_read() again

However, if there are already items on ibuf FIFO, that means zebra is
slow in processing. And with the current mechanism if Zebra main is
busy, the ibuf FIFO keeps growing holding up the memory.

Show memory zebra:(Example: 15k streams hoarding ~160 MB of data)
--- qmem libfrr ---
Stream             :       44 variable   3432352    15042 161243800

Fix:
Client IO Thread: (zserv_read)
 - Stop doing the read events when we know there are X number of items
   on the FIFO already.(X - zebra zapi-packets <1-10000> (Default-1000)

 - Determine the number of items on the zserv->ibuf_fifo. Subtract this
   from the work items and only pull the number of items off that would
   take us to X items on the ibuf_fifo again.

 - If the number of items in the ibuf_fifo has reached to the maximum
      * Either initially when zserv_read() is called (or)
      * when processing the remainders of the incoming buffer
   the client IO thread is woken by the the zebra main.

Main thread: (zserv_process_message)
If the client ibuf always schedules a wakeup to the client IO to read
more items from the socked buffer. This way we ensure
 - Client IO thread always tries to read the socket buffer and add more
   items to the ibuf_fifo (until max limit)
 - hidden config change (zebra zapi-packets <>) is taken into account

Ticket: #3390099

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
13 months agoospf6d: add localLinkLocalAddress field
Francois Dumontet [Thu, 7 Mar 2024 13:33:37 +0000 (14:33 +0100)]
ospf6d: add localLinkLocalAddress field

add localIfaceAdress field in show ipv6 ospf6 neighbor detail json
command.

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
13 months agoMerge pull request #15498 from idryzhov/mgmt-change-error
Donatas Abraitis [Thu, 7 Mar 2024 07:25:29 +0000 (08:25 +0100)]
Merge pull request #15498 from idryzhov/mgmt-change-error

mgmtd: change error message

13 months agomgmtd: change error message
Igor Ryzhov [Wed, 6 Mar 2024 21:57:30 +0000 (23:57 +0200)]
mgmtd: change error message

Make the wording clearer about what's going on.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
13 months agoripngd: fix missing "exit" for "router ripng"
Igor Ryzhov [Wed, 6 Mar 2024 19:43:44 +0000 (21:43 +0200)]
ripngd: fix missing "exit" for "router ripng"

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
13 months agoripd: fix missing "exit" for "router rip"
Igor Ryzhov [Wed, 6 Mar 2024 19:42:53 +0000 (21:42 +0200)]
ripd: fix missing "exit" for "router rip"

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
13 months agolib: fix order of interfaces in the config
Igor Ryzhov [Wed, 6 Mar 2024 19:41:35 +0000 (21:41 +0200)]
lib: fix order of interfaces in the config

Add missing cli_cmp callback. Without it, interfaces are not sorted and
printed in order they were created.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
13 months agoMerge pull request #15487 from idryzhov/nb-apply-finish
Donatas Abraitis [Wed, 6 Mar 2024 06:44:09 +0000 (08:44 +0200)]
Merge pull request #15487 from idryzhov/nb-apply-finish

lib: fix apply_finish callback in northbound

13 months agoMerge pull request #15486 from donaldsharp/make_prefix
Donatas Abraitis [Wed, 6 Mar 2024 06:43:40 +0000 (08:43 +0200)]
Merge pull request #15486 from donaldsharp/make_prefix

bgpd: pi->attr is deref'ed in all paths leading up to test

13 months agoMerge pull request #15489 from idryzhov/vty-mgmt-error
Donatas Abraitis [Wed, 6 Mar 2024 06:43:16 +0000 (08:43 +0200)]
Merge pull request #15489 from idryzhov/vty-mgmt-error

vty: change output of errors from mgmtd

13 months agoMerge pull request #15492 from donaldsharp/no_vrfs
Donatas Abraitis [Wed, 6 Mar 2024 06:42:37 +0000 (08:42 +0200)]
Merge pull request #15492 from donaldsharp/no_vrfs

tests: test invokes a script which does not exist

13 months agotests: test invokes a script which does not exist
Donald Sharp [Tue, 5 Mar 2024 20:55:07 +0000 (15:55 -0500)]
tests: test invokes a script which does not exist

Apparently test_bgp_peer_type_multipath_relax.py does
no really need to run a `setup_vrfs` script.  Looking
at the other configuration for this test there are
no vrf's in the frr configuration.  So let's remove it

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
13 months agoMerge pull request #15222 from chiragshah6/fdev2
Donatas Abraitis [Tue, 5 Mar 2024 20:36:30 +0000 (22:36 +0200)]
Merge pull request #15222 from chiragshah6/fdev2

bgpd:aggr summary-only remove suppressed from evpn

13 months agoMerge pull request #15397 from idryzhov/zebra-oper
Russ White [Tue, 5 Mar 2024 16:41:35 +0000 (11:41 -0500)]
Merge pull request #15397 from idryzhov/zebra-oper

zebra: oper data additions

13 months agovty: change output of errors from mgmtd
Igor Ryzhov [Fri, 1 Mar 2024 11:28:25 +0000 (13:28 +0200)]
vty: change output of errors from mgmtd

Make errors look the same way as in regular non-mgmtd vty. We don't need
to show information about some internal request names.

Before:
```
ERROR: SET_CONFIG request failed, Error: YANG error(s):
 Path: Data location "/frr-affinity-map:lib/affinity-maps/affinity-map[name='a']".
 Error: Unique data leaf(s) "value" not satisfied in "/frr-affinity-map:lib/affinity-maps/affinity-map[name='b']" and "/frr-affinity-map:lib/affinity-maps/affinity-map[name='a']".
```

After:
```
% Configuration failed.

YANG error(s):
 Path: Data location "/frr-affinity-map:lib/affinity-maps/affinity-map[name='b']".
 Error: Unique data leaf(s) "value" not satisfied in "/frr-affinity-map:lib/affinity-maps/affinity-map[name='a']" and "/frr-affinity-map:lib/affinity-maps/affinity-map[name='b']".
```

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
13 months agobgpd: pi->attr is deref'ed in all paths leading up to test
Donald Sharp [Tue, 5 Mar 2024 15:37:48 +0000 (10:37 -0500)]
bgpd: pi->attr is deref'ed in all paths leading up to test

In make_prefix, the code checks to see if the pi->attr
is non-NULL.  Since (A) we cannot have a path_info without
an attribute and (B) all paths leading up to the test
in make_prefix already have pi->attr deref'ed and the
code is not crashing we know this is safe to remove.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
13 months agotests:add topotest for EVPN aggregate prefix route
Chirag Shah [Tue, 5 Mar 2024 04:00:29 +0000 (20:00 -0800)]
tests:add topotest for EVPN aggregate prefix route

Toptotest covers to aggregate EVPN prefix routes.

Testing:

tests/topotests/bgp_evpn_vxlan_svd_topo1$ sudo -E python3 -m pytest -s -vv --cli-on-error
PASSED
test_bgp_evpn_vxlan_svd.py::test_pe_advertise_aggr_evpn_route
--------------------- live log call -------------------------------
2024-03-04 19:59:45,340 INFO: P1: checking if daemons are running
2024-03-04 19:59:45,444 INFO: PE1: checking if daemons are running
2024-03-04 19:59:45,578 INFO: PE2: checking if daemons are running
2024-03-04 19:59:45,680 INFO: host1: checking if daemons are running
2024-03-04 19:59:45,798 INFO: host2: checking if daemons are running
2024-03-04 19:59:45,896 INFO: topo: Checking BGP EVPN route contains non-aggregate prefixes
2024-03-04 19:59:45,992 INFO: topo: Configure BGP aggregate-address summary-only under ipv4-unicast
2024-03-04 19:59:46,120 INFO: topo: Checking BGP EVPN route contains aggregated prefix
PASSED

------- generated xml file: /tmp/topotests/topotests.xml -----
======= 10 passed, 1 skipped in 47.95s =====

Signed-off-by: Chirag Shah <chirag@nvidia.com>
13 months agobgpd:aggr summary-only remove suppressed from evpn
Chirag Shah [Wed, 24 Jan 2024 05:52:34 +0000 (21:52 -0800)]
bgpd:aggr summary-only remove suppressed from evpn

Ticket: #3534718 #3720960
Testing Done:

Config:
router bgp 65564 vrf sym_2
 bgp router-id 27.0.0.9
 !
 address-family ipv4 unicast
  redistribute static
 exit-address-family

vrf sym_2
 vni 8889
 ip route 63.2.1.0/24 blackhole
 ip route 63.2.1.2/32 blackhole
 ip route 63.2.1.3/32 blackhole
exit-vrf

tor-1:# vtysh -c "show bgp l2vpn evpn route" | grep -A3 63.2
*> [5]:[0]:[24]:[63.2.1.0] RD 27.0.0.9:19
                    27.0.0.9 (tor-1)
                                             0         32768 ?
                    ET:8 RT:28:8889 Rmac:44:38:39:ff:ff:29
--
*> [5]:[0]:[32]:[63.2.1.2] RD 27.0.0.9:19
                    27.0.0.9 (tor-1)
                                             0         32768 ?
                    ET:8 RT:28:8889 Rmac:44:38:39:ff:ff:29
*> [5]:[0]:[32]:[63.2.1.3] RD 27.0.0.9:19
                    27.0.0.9 (tor-1)
                                             0         32768 ?
                    ET:8 RT:28:8889 Rmac:44:38:39:ff:ff:29

tor-1(config)# router bgp 65564 vrf sym_2
tor-1(config-router)# address-family ipv4 unicast
tor-1(config-router-af)# aggregate-address 63.2.0.0/16 summary-only
tor-1(config-rou-f)# end

tor-1:# vtysh -c "show bgp l2vpn evpn route" | grep -A3 63.2.1
tor-1:# vtysh -c "show bgp l2vpn evpn route" | grep -A3 63.2
*> [5]:[0]:[16]:[63.2.0.0] RD 27.0.0.9:19
                    27.0.0.9 (tor-1)
                                             0         32768 ?
                    ET:8 RT:28:8889 Rmac:44:38:39:ff:ff:29

Signed-off-by: Chirag Shah <chirag@nvidia.com>
13 months agoMerge pull request #15479 from opensourcerouting/fix/spelling
Russ White [Tue, 5 Mar 2024 13:48:56 +0000 (08:48 -0500)]
Merge pull request #15479 from opensourcerouting/fix/spelling

doc: Fix one spelling `dissallowed` to `disallowed`

13 months agoMerge pull request #15460 from Max-Mustermann33/route-metric-update
Russ White [Tue, 5 Mar 2024 13:45:45 +0000 (08:45 -0500)]
Merge pull request #15460 from Max-Mustermann33/route-metric-update

ospfd: Send update for route with new metric

13 months agoMerge pull request #15450 from opensourcerouting/fix/coverity
Russ White [Tue, 5 Mar 2024 13:43:28 +0000 (08:43 -0500)]
Merge pull request #15450 from opensourcerouting/fix/coverity

bgpd: Check if attributes exists for the path before checking mp_nexthop_len

13 months agolib: fix apply_finish callback in northbound
Igor Ryzhov [Tue, 5 Mar 2024 13:30:37 +0000 (15:30 +0200)]
lib: fix apply_finish callback in northbound

When a node is top-level, we shouldn't stop the whole processing, we
should just skip this single node.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
13 months agoMerge pull request #15476 from donaldsharp/dplane_thread_issue_i_believe
Donatas Abraitis [Tue, 5 Mar 2024 12:53:41 +0000 (14:53 +0200)]
Merge pull request #15476 from donaldsharp/dplane_thread_issue_i_believe

zebra: fnc->obuf could be accessed without a lock

13 months agoMerge pull request #15369 from donaldsharp/fpm_stub_addition
Martin Winter [Tue, 5 Mar 2024 12:06:42 +0000 (13:06 +0100)]
Merge pull request #15369 from donaldsharp/fpm_stub_addition

Add ability to test dplane_fpm_nl.c file

13 months agodoc: Fix one spelling `dissallowed` to `disallowed`
Donatas Abraitis [Tue, 5 Mar 2024 06:57:39 +0000 (08:57 +0200)]
doc: Fix one spelling `dissallowed` to `disallowed`

Closes: https://github.com/FRRouting/frr/issues/15465
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
13 months agoMerge pull request #15470 from idryzhov/fix-darr-vsprintf
Christian Hopps [Tue, 5 Mar 2024 03:45:02 +0000 (22:45 -0500)]
Merge pull request #15470 from idryzhov/fix-darr-vsprintf

lib: fix __darr_in_vsprintf

13 months agotests: add test for keychain send-accept times
Christian Hopps [Tue, 5 Mar 2024 00:53:39 +0000 (19:53 -0500)]
tests: add test for keychain send-accept times

Also uses oper state `active` node to test.

Signed-off-by: Christian Hopps <chopps@labn.net>
13 months agolib: add keychain northbound support
Christian Hopps [Sat, 24 Feb 2024 10:48:40 +0000 (05:48 -0500)]
lib: add keychain northbound support

Signed-off-by: Christian Hopps <chopps@labn.net>
13 months agolib: fix infinite loop in __darr_in_vsprintf
Igor Ryzhov [Mon, 4 Mar 2024 18:41:41 +0000 (20:41 +0200)]
lib: fix infinite loop in __darr_in_vsprintf

`darr_avail` returns the available capacity excluding the already
existing terminating NULL byte. Take this into account when using
`darr_avail`. Otherwise, if the error length is a power of 2, the
capacity is never enough and the function stucks in an infinite loop.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
13 months agozebra: fnc->obuf could be accessed without a lock
Donald Sharp [Mon, 4 Mar 2024 23:07:42 +0000 (18:07 -0500)]
zebra: fnc->obuf could be accessed without a lock

Found by coverity.  Let's just lock the writeable
amount to see if it is possible.  It's ok because
we want to know if we have room *now*.  If another
pthread runs it will only remove data from fnc->obuf
and make more room.  So this is ok.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
13 months agodebian: Add a frr-test-tools debian package
Donald Sharp [Wed, 21 Feb 2024 17:50:13 +0000 (12:50 -0500)]
debian: Add a frr-test-tools debian package

This package will hold test tools that are built and useful for
developers of FRR but not useful for everyday usage of FRR.  This
is separted out because these are useful enough to have in their
own package.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
13 months agotests: Add a pytest marker for the fpm
Donald Sharp [Sat, 17 Feb 2024 22:16:29 +0000 (17:16 -0500)]
tests: Add a pytest marker for the fpm

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
13 months agotests: Add a very simple test for the dplane_fpm_nl module
Donald Sharp [Wed, 14 Feb 2024 17:45:16 +0000 (12:45 -0500)]
tests: Add a very simple test for the dplane_fpm_nl module

Ensure that the fpm module connects to the specified listener
and then ensure that 10k routes from sharpd are installed
into the system and then are removed.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
13 months agotests: Add ability to run a fpm listener
Donald Sharp [Wed, 14 Feb 2024 17:41:49 +0000 (12:41 -0500)]
tests: Add ability to run a fpm listener

Add the ability to run a fpm listener to the testing
system.  This is nothing more just allowing the test
system to bring it up.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
13 months agodoc: Add `show fpm status [json]` command to documentation
Donald Sharp [Wed, 14 Feb 2024 17:17:56 +0000 (12:17 -0500)]
doc: Add `show fpm status [json]` command to documentation

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
13 months agozebra: Add `show fpm status [json]` command
Donald Sharp [Wed, 14 Feb 2024 17:15:57 +0000 (12:15 -0500)]
zebra: Add `show fpm status [json]` command

Add a command to get the status of the dplane_fpm_nl
module.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
13 months agozebra: Add fpm_listener
Donald Sharp [Wed, 14 Feb 2024 21:07:45 +0000 (16:07 -0500)]
zebra: Add fpm_listener

Add a tiny fpm_listener program to allow FRR to test the
fpm.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
13 months agodoc, tools: Remove ARRAY_SIZE check
Donald Sharp [Thu, 15 Feb 2024 15:19:36 +0000 (10:19 -0500)]
doc, tools: Remove ARRAY_SIZE check

checkpatch.pl wants you to use ARRAY_SIZE in a kernel
header file.  We don't have access to this kernel header
file for normal compilation.  I'm just going to remove it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
13 months agoMerge pull request #15467 from donaldsharp/bgp_best_selection_cleanup
Donatas Abraitis [Mon, 4 Mar 2024 11:35:35 +0000 (13:35 +0200)]
Merge pull request #15467 from donaldsharp/bgp_best_selection_cleanup

Bgp best selection cleanup

13 months agolib: fix __darr_in_vsprintf
Igor Ryzhov [Mon, 5 Feb 2024 17:04:39 +0000 (19:04 +0200)]
lib: fix __darr_in_vsprintf

If the initial darr capacity is not enough for the output, the `ap` is
reused multiple times, which is wrong, because it may be altered by
`vsnprintf`. Make a copy of `ap` each time instead of reusing.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>