]> git.puffer.fish Git - mirror/frr.git/log
mirror/frr.git
12 months agobgpd: fix srv6 memory leak detection 15641/head
Philippe Guibert [Fri, 29 Mar 2024 07:35:34 +0000 (08:35 +0100)]
bgpd: fix srv6 memory leak detection

The asan memory leak has been detected:
> Direct leak of 16 byte(s) in 1 object(s) allocated from:
>     #0 0x7f9066dadd28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
>     #1 0x7f9066779b5d in qcalloc lib/memory.c:105
>     #2 0x556d6ca527c2 in vpn_leak_zebra_vrf_sid_update_per_af bgpd/bgp_mplsvpn.c:389
>     #3 0x556d6ca530e1 in vpn_leak_zebra_vrf_sid_update bgpd/bgp_mplsvpn.c:451
>     #4 0x556d6ca64b3b in vpn_leak_postchange bgpd/bgp_mplsvpn.h:311
>     #5 0x556d6ca64b3b in vpn_leak_postchange_all bgpd/bgp_mplsvpn.c:3751
>     #6 0x556d6cb9f116 in bgp_zebra_process_srv6_locator_chunk bgpd/bgp_zebra.c:3337
>     #7 0x7f906685a6b6 in zclient_read lib/zclient.c:4490
>     #8 0x7f9066826a32 in event_call lib/event.c:2011
>     #9 0x7f906675c444 in frr_run lib/libfrr.c:1217
>     #10 0x556d6c980d52 in main bgpd/bgp_main.c:545
>     #11 0x7f9065784c86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Fix this by freeing the previous memory chunk.

Fixes: b72c9e14756f ("bgpd: cli for SRv6 SID alloc to redirect to vrf (step4)")
Fixes: 527588aa78b2 ("bgpd: add support for per-VRF SRv6 SID")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
(cherry picked from commit eea8a8ae248ed726449878c7a74705d779469fda)

13 months agoMerge pull request #15606 from FRRouting/mergify/bp/dev/10.0/pr-15602
Igor Ryzhov [Mon, 25 Mar 2024 12:37:06 +0000 (14:37 +0200)]
Merge pull request #15606 from FRRouting/mergify/bp/dev/10.0/pr-15602

mgmtd: fix a couple of log messages (backport #15602)

13 months agoMerge pull request #15601 from FRRouting/mergify/bp/dev/10.0/pr-15010
Donatas Abraitis [Mon, 25 Mar 2024 06:23:32 +0000 (08:23 +0200)]
Merge pull request #15601 from FRRouting/mergify/bp/dev/10.0/pr-15010

zebra: Fix crash on macvlan link down/up (backport #15010)

13 months agomgmtd: fix a couple of log messages 15606/head
Igor Ryzhov [Fri, 22 Mar 2024 14:35:52 +0000 (16:35 +0200)]
mgmtd: fix a couple of log messages

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 988d4444d44814fa3325795154911f420319ac76)

13 months agoMerge pull request #15596 from FRRouting/mergify/bp/dev/10.0/pr-15587
Igor Ryzhov [Fri, 22 Mar 2024 13:37:55 +0000 (15:37 +0200)]
Merge pull request #15596 from FRRouting/mergify/bp/dev/10.0/pr-15587

grpc: fix grpc for various failures (backport #15587)

13 months agozebra: Fix crash on macvlan link down/up 15601/head
Tomi Salminen [Wed, 13 Dec 2023 09:37:21 +0000 (11:37 +0200)]
zebra: Fix crash on macvlan link down/up

Whenever a link up change was detected on a macvlan device where
the linked device wasn't visible in the namespace zebra was
running in, the linked zebra interface was NULL. This was already
handled in the event of a link down, but was ommitted from the
upside. Added the same null check to the up-side.

Signed-off-by: Tomi Salminen <tlsalmin@gmail.com>
(cherry picked from commit bdf6a9ba810b58146371e8a0000397d2ae9ea956)

13 months agogrpc: fix grpc for various failures 15596/head
Christian Hopps [Wed, 20 Mar 2024 19:20:18 +0000 (19:20 +0000)]
grpc: fix grpc for various failures

lib: don't define a `fallthrough` in c++ to avoid conflict with protobuf c++

check: add link libs required by some versions of grpc++ or it's dependent
linked libs

tests: don't fail the test due to known at exit memleaks
Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit 043a4183c2f10e6117695dec7a0373c1b0a63808)

13 months agoMerge pull request #15576 from FRRouting/mergify/bp/dev/10.0/pr-15558
Russ White [Tue, 19 Mar 2024 18:43:55 +0000 (14:43 -0400)]
Merge pull request #15576 from FRRouting/mergify/bp/dev/10.0/pr-15558

bgpd: Update default-originate route-map actual map structure (backport #15558)

13 months agobgpd: Update default-originate route-map actual map structure 15576/head
Donatas Abraitis [Fri, 15 Mar 2024 11:49:06 +0000 (13:49 +0200)]
bgpd: Update default-originate route-map actual map structure

If using with `bgp listen range ... peer-group x`, default_rmap[afi][safi] is not
updated, and after the hard-reset in other side, this is flushed and never updated
again without restarting the sender BGP daemon.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 4f1e2dcd7a6616c74042657ddcec693de4f10586)

13 months agoMerge pull request #15521 from opensourcerouting/fix/backport_1818186432569d2bc3e4113...
Russ White [Tue, 19 Mar 2024 14:10:59 +0000 (10:10 -0400)]
Merge pull request #15521 from opensourcerouting/fix/backport_1818186432569d2bc3e4113945ff958c3ac4796b_10.0

bgpd: [10.0] Unset advertised capabilities if capability is disabled

13 months agoMerge pull request #15569 from FRRouting/mergify/bp/dev/10.0/pr-15424
Mark Stapp [Mon, 18 Mar 2024 17:06:18 +0000 (13:06 -0400)]
Merge pull request #15569 from FRRouting/mergify/bp/dev/10.0/pr-15424

zebra: fix route deletion during zebra shutdown (backport #15424)

13 months agozebra: fix route deletion during zebra shutdown 15569/head
Alexander Skorichenko [Wed, 28 Feb 2024 19:34:06 +0000 (20:34 +0100)]
zebra: fix route deletion during zebra shutdown

Split zebra's vrf_terminate() into disable() and delete() stages.
The former enqueues all events for the dplane thread.
Memory freeing is performed in the second stage.

Signed-off-by: Alexander Skorichenko <askorichenko@netgate.com>
(cherry picked from commit 444ce317b2af491b5cdc321286772627a5d4c8ea)

13 months agoMerge pull request #15547 from FRRouting/mergify/bp/dev/10.0/pr-15466
Donatas Abraitis [Fri, 15 Mar 2024 05:29:06 +0000 (07:29 +0200)]
Merge pull request #15547 from FRRouting/mergify/bp/dev/10.0/pr-15466

Bgp filter fun (backport #15466)

13 months agoMerge pull request #15544 from FRRouting/mergify/bp/dev/10.0/pr-15532
Donatas Abraitis [Thu, 14 Mar 2024 10:40:49 +0000 (12:40 +0200)]
Merge pull request #15544 from FRRouting/mergify/bp/dev/10.0/pr-15532

bgpd: Check the route and the nexthop appropriately when validating NH (backport #15532)

13 months agobgpd: Ensure community data is freed in some cases. 15547/head
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>
(cherry picked from commit addff17a555240a4ccb5d0c5733a780256837651)

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>
(cherry picked from commit 6814401c47b948a50c6db93d60ac793a8cdce45f)

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>
(cherry picked from commit e613e12f12b9274520ff2a8650496bdeb97e011c)

13 months agobgpd: Check the route and the nexthop appropriately when validating NH 15544/head
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>
(cherry picked from commit 778357e9efd8deaa4612587959c9ef94b50ef288)

13 months agoMerge pull request #15528 from FRRouting/mergify/bp/dev/10.0/pr-15457
Donatas Abraitis [Wed, 13 Mar 2024 07:36:58 +0000 (09:36 +0200)]
Merge pull request #15528 from FRRouting/mergify/bp/dev/10.0/pr-15457

docker: Fix build for Alpine Linux after the recent changes since 9.1 (backport #15457)

13 months agolib: Drop include/linux/mroute[6].h 15528/head
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>
(cherry picked from commit a201559a4ad9146ca978bfb21afd50de1b4434b1)

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>
(cherry picked from commit b0b0d7ab08960ed7b43b4d1dabeaf377fad40942)

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>
(cherry picked from commit 3f7cc3b7f5e7624ef72c455e8ab6c68884d1f9f4)

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>
(cherry picked from commit fd93b7d89a119e84773201a41bfe4a2357ba7640)

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>
(cherry picked from commit e9ff59401c8b2242a159b1a78d8e2ca980da3272)

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>
(cherry picked from commit f03b0bfaa4225182064d7749808b49760a618d29)

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>
(cherry picked from commit 3ca01bf1e9bd5fe2181d8ad7ceac1efa8ccec1f8)

13 months agoMerge pull request #15529 from FRRouting/mergify/bp/dev/10.0/pr-15509
Igor Ryzhov [Tue, 12 Mar 2024 19:44:05 +0000 (21:44 +0200)]
Merge pull request #15529 from FRRouting/mergify/bp/dev/10.0/pr-15509

pimd: Cleanup inclusion of headers (backport #15509)

13 months agopimd: Cleanup inclusion of headers 15529/head
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>
(cherry picked from commit a5389154a1363ea778e0cafddc34f1964631278c)

13 months agoMerge pull request #15519 from FRRouting/mergify/bp/dev/10.0/pr-15513
Donatas Abraitis [Tue, 12 Mar 2024 11:13:52 +0000 (12:13 +0100)]
Merge pull request #15519 from FRRouting/mergify/bp/dev/10.0/pr-15513

bgpd: Fix `no` form for `neighbor X capability software-version` (backport #15513)

13 months agobgpd: Allow dynamically disable graceful-restart/long-lived graceful-restart 15521/head
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>
(cherry picked from commit 78757362f23f947527fe60327cf813b187fe0bdb)

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>
(cherry picked from commit 77102e853ec1856f8dccaa61a74ce2f78452d5a5)

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>
(cherry picked from commit fd613d1b0cd80e6e9c3edd5ff4d0440abf7b19b1)

13 months agobgpd: Fix `no` form for `neighbor X capability software-version` 15519/head
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>
(cherry picked from commit 2038fad33e61f3ba2e276a3773017ef61cdb92e3)

13 months agoMerge pull request #15512 from FRRouting/mergify/bp/dev/10.0/pr-15510
Donatas Abraitis [Sat, 9 Mar 2024 19:54:00 +0000 (20:54 +0100)]
Merge pull request #15512 from FRRouting/mergify/bp/dev/10.0/pr-15510

fix rip/ripng yang rpcs (backport #15510)

13 months agoripngd: fix "clear ipv6 ripng" command 15512/head
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>
(cherry picked from commit c544b9e8e72c3b77cca9d3d0ceaeae427b761f2c)

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>
(cherry picked from commit 1ba97510e2683e6178973be98f1004a45462621e)

13 months agoMerge pull request #15508 from FRRouting/mergify/bp/dev/10.0/pr-15497
Igor Ryzhov [Fri, 8 Mar 2024 22:07:11 +0000 (00:07 +0200)]
Merge pull request #15508 from FRRouting/mergify/bp/dev/10.0/pr-15497

a couple of fixes for "show running-config" (backport #15497)

13 months agoripngd: fix missing "exit" for "router ripng" 15508/head
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>
(cherry picked from commit 1db1fbf7a65ff6b6b7c33d365d22020dbf8f8000)

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>
(cherry picked from commit aaa6c7088e393e8fc1d96a1108f2f85b038db8f9)

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>
(cherry picked from commit 18da7369490af6bfb88431ad3f2c3a2934865f17)

13 months agoMerge pull request #15503 from FRRouting/mergify/bp/dev/10.0/pr-15498
Igor Ryzhov [Thu, 7 Mar 2024 16:08:01 +0000 (18:08 +0200)]
Merge pull request #15503 from FRRouting/mergify/bp/dev/10.0/pr-15498

mgmtd: change error message (backport #15498)

13 months agomgmtd: change error message 15503/head
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>
(cherry picked from commit bbaf34b117a69a22aeef2c3730756766f34a6d37)

13 months agoMerge pull request #15495 from FRRouting/mergify/bp/dev/10.0/pr-15487
Donatas Abraitis [Wed, 6 Mar 2024 11:22:28 +0000 (13:22 +0200)]
Merge pull request #15495 from FRRouting/mergify/bp/dev/10.0/pr-15487

lib: fix apply_finish callback in northbound (backport #15487)

13 months agoMerge pull request #15491 from FRRouting/mergify/bp/dev/10.0/pr-15222
Donatas Abraitis [Wed, 6 Mar 2024 11:22:11 +0000 (13:22 +0200)]
Merge pull request #15491 from FRRouting/mergify/bp/dev/10.0/pr-15222

bgpd:aggr summary-only remove suppressed from evpn (backport #15222)

13 months agolib: fix apply_finish callback in northbound 15495/head
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>
(cherry picked from commit 8287fbe453d150a5e129ed204d89a4dce9b6982f)

13 months agotests:add topotest for EVPN aggregate prefix route 15491/head
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>
(cherry picked from commit f345460b7eb2a14b09eda74ad2d1e8992a895a24)

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>
(cherry picked from commit 5cb7712b3edb88ff43fce464d67a1548f183d410)

13 months agoMerge pull request #15484 from FRRouting/mergify/bp/dev/10.0/pr-15479
Donatas Abraitis [Tue, 5 Mar 2024 15:37:55 +0000 (17:37 +0200)]
Merge pull request #15484 from FRRouting/mergify/bp/dev/10.0/pr-15479

doc: Fix one spelling `dissallowed` to `disallowed` (backport #15479)

13 months agodoc: Fix one spelling `dissallowed` to `disallowed` 15484/head
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>
(cherry picked from commit e993ba1812d36ef4b80407739e572edac881a85e)

13 months agoMerge pull request #15478 from FRRouting/mergify/bp/dev/10.0/pr-15470
Igor Ryzhov [Tue, 5 Mar 2024 09:23:37 +0000 (11:23 +0200)]
Merge pull request #15478 from FRRouting/mergify/bp/dev/10.0/pr-15470

lib: fix __darr_in_vsprintf (backport #15470)

13 months agolib: fix infinite loop in __darr_in_vsprintf 15478/head
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>
(cherry picked from commit cb6032d6b3d9fc1198f61ac343ec22b456a8896e)

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>
(cherry picked from commit ee0c1cc1e4b87bde73f1eba3212ab93b1c379c6c)

13 months agoMerge pull request #15463 from FRRouting/mergify/bp/dev/10.0/pr-15461
Donatas Abraitis [Sat, 2 Mar 2024 06:13:23 +0000 (08:13 +0200)]
Merge pull request #15463 from FRRouting/mergify/bp/dev/10.0/pr-15461

fix warning if ripngd disabled (backport #15461)

13 months agomgmtd: fix warning if ripngd disabled 15463/head
Vincent JARDIN [Fri, 1 Mar 2024 16:27:53 +0000 (17:27 +0100)]
mgmtd: fix warning if ripngd disabled

./configure [...] --disable-ripngd

could lead to:

mgmtd/mgmt_vty.c:614:5: warning: "HAVE_RIPNGD" is not defined, evaluates to 0 [-Wundef]
  614 | #if HAVE_RIPNGD
      |     ^~~~~~~~~~~

Signed-off-by: Vincent Jardin <vjardin@free.fr>
(cherry picked from commit 717b3350bb9b559df0b9a3d9e2bdc3cb41e816e1)

14 months agoMerge pull request #15451 from FRRouting/mergify/bp/dev/10.0/pr-15447 frr-10.0-rc
Donatas Abraitis [Wed, 28 Feb 2024 17:33:25 +0000 (19:33 +0200)]
Merge pull request #15451 from FRRouting/mergify/bp/dev/10.0/pr-15447

bmp: fix vty_out for monitor afi loc-rib (backport #15447)

14 months agoMerge pull request #15452 from FRRouting/mergify/bp/dev/10.0/pr-15368
Donatas Abraitis [Wed, 28 Feb 2024 17:32:45 +0000 (19:32 +0200)]
Merge pull request #15452 from FRRouting/mergify/bp/dev/10.0/pr-15368

bgpd: fix 6vpe nexthop (backport #15368)

14 months agobgpd: fix 6vpe nexthop 15452/head
Louis Scalbert [Thu, 15 Feb 2024 12:28:02 +0000 (13:28 +0100)]
bgpd: fix 6vpe nexthop

6vPE enables the announcement of IPv6 VPN prefixes through an IPv4 BGP
session. In this scenario, the next hop addresses for these prefixes are
represented in an IPv4-mapped IPv6 format, noted as ::ffff:[IPv4]. This
format indicates to the peer that it should route these IPv6 addresses
using information from the IPv4 nexthop. For example:

> Path Attribute - MP_REACH_NLRI
> [...]
>     Address family identifier (AFI): IPv6 (2)
>     Subsequent address family identifier (SAFI): Labeled VPN Unicast (128)
>     Next hop:  RD=0:0 IPv6=::ffff:192.0.2.5 RD=0:0 Link-local=fe80::501d:42ff:feef:b021
>     Number of Subnetwork points of attachment (SNPA): 0

This rule is set out in RFC4798:

> The IPv4 address of the egress 6PE router MUST be encoded as an
> IPv4-mapped IPv6 address in the BGP Next Hop field.

However, in some situations, bgpd sends a standard nexthop IPv6 address
instead of an IPv4-mapped IPv6 address because the outgoing interface for
the BGP session has a valid IPv6 address. This is problematic because
the peer router may not be able to route the nexthop IPv6 address (ie.
if the outgoing interface has not IPv6).

Fix the issue by always sending a IPv4-mapped IPv6 address as nexthop
when the BGP session is on IPv4 and address family IPv6.

Link: https://datatracker.ietf.org/doc/html/rfc4798#section-2
Fixes: 92d6f76 ("lib,zebra,bgpd: Fix for nexthop as IPv4 mapped IPv6 address")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit 0325116a27258e1df773a046e8668a029bead60c)

14 months agotopotests: add an ebgp 6vpe test
Philippe Guibert [Mon, 13 Mar 2023 09:47:16 +0000 (10:47 +0100)]
topotests: add an ebgp 6vpe test

This test uses the connected ipv4 mapped ipv6 prefix
to resolve the received BGP routes.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: François Dumontet <francois.dumontet@6wind.com>
(cherry picked from commit 4d7df91752d7414d9719a361a2fd4cc30943dc96)

14 months agobmp: fix vty_out for monitor afi loc-rib 15451/head
Farid Mihoub [Thu, 8 Jun 2023 13:37:10 +0000 (15:37 +0200)]
bmp: fix vty_out for monitor afi loc-rib

"show run" displays BMP monitor AFI in upper case.

> bmp targets bmp1
>  bmp monitor IPv4 unicast loc-rib

Display it in lower case.

> bmp targets bmp1
>  bmp monitor ipv4 unicast loc-rib

Signed-off-by: Farid Mihoub <farid.mihoub@6wind.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit 3104d482e932c7a030d8a5e209ed33ec151953f7)

14 months agoMerge pull request #15442 from FRRouting/mergify/bp/dev/10.0/pr-15399
Russ White [Tue, 27 Feb 2024 19:16:35 +0000 (14:16 -0500)]
Merge pull request #15442 from FRRouting/mergify/bp/dev/10.0/pr-15399

zebra: fix crash when macvlan link-interface is in another netns (backport #15399)

14 months agoMerge pull request #15439 from FRRouting/mergify/bp/dev/10.0/pr-15431
Russ White [Tue, 27 Feb 2024 19:16:15 +0000 (14:16 -0500)]
Merge pull request #15439 from FRRouting/mergify/bp/dev/10.0/pr-15431

ospfd: Solved crash in OSPF TE parsing (backport #15431)

14 months agoMerge pull request #15437 from FRRouting/mergify/bp/dev/10.0/pr-15427
Russ White [Tue, 27 Feb 2024 18:39:07 +0000 (13:39 -0500)]
Merge pull request #15437 from FRRouting/mergify/bp/dev/10.0/pr-15427

lib: fix access/prefix-list entry update (backport #15427)

14 months agozebra: fix crash if macvlan link in another netns 15442/head
Louis Scalbert [Tue, 20 Feb 2024 16:49:01 +0000 (17:49 +0100)]
zebra: fix crash if macvlan link in another netns

A macvlan interface can have its underlying link-interface in another
namespace (aka. netns). However, by default, zebra does not know the
interface from the other namespaces. It results in a crash the pointer
to the link interface is NULL.

> 6  0x0000559d77a329d3 in zebra_vxlan_macvlan_up (ifp=0x559d798b8e00) at /root/frr/zebra/zebra_vxlan.c:4676
> 4676 link_zif = link_ifp->info;
> (gdb) list
> 4671 struct interface *link_ifp, *link_if;
> 4672
> 4673 zif = ifp->info;
> 4674 assert(zif);
> 4675 link_ifp = zif->link;
> 4676 link_zif = link_ifp->info;
> 4677 assert(link_zif);
> 4678
> (gdb) p zif->link
> $2 = (struct interface *) 0x0
> (gdb) p zif->link_ifindex
> $3 = 15

Fix the crash by returning when the macvlan link-interface is in another
namespace. No need to go further because any vxlan under the macvlan
interface would not be accessible by zebra.

Link: https://github.com/FRRouting/frr/issues/15370
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit 44e6e3868d7a1488447f2be446dbd7cb5a5559ce)

14 months agoMerge pull request #15412 from FRRouting/mergify/bp/dev/10.0/pr-15377
Russ White [Tue, 27 Feb 2024 15:44:27 +0000 (10:44 -0500)]
Merge pull request #15412 from FRRouting/mergify/bp/dev/10.0/pr-15377

lib: Do not convert EVPN prefixes into IPv4/IPv6 if not needed (backport #15377)

14 months agoospfd: Solved crash in OSPF TE parsing 15439/head
Olivier Dugeon [Mon, 26 Feb 2024 09:40:34 +0000 (10:40 +0100)]
ospfd: Solved crash in OSPF TE parsing

Iggy Frankovic discovered an ospfd crash when perfomring fuzzing of OSPF LSA
packets. The crash occurs in ospf_te_parse_te() function when attemping to
create corresponding egde from TE Link parameters. If there is no local
address, an edge is created but without any attributes. During parsing, the
function try to access to this attribute fields which has not been created
causing an ospfd crash.

The patch simply check if the te parser has found a valid local address. If not
found, we stop the parser which avoid the crash.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
(cherry picked from commit a73e66d07329d721f26f3f336f7735de420b0183)

14 months agolib: fix prefix-list entry update 15437/head
Igor Ryzhov [Sun, 25 Feb 2024 23:00:17 +0000 (01:00 +0200)]
lib: fix prefix-list entry update

When a prefix-list entry is updated, current NB code calls the
replacement code multiple times, once per each updated field. It means
that when multiple fields of an entry are changed in a single commit,
the replacement is done with an interim state of a prefix-list instead
of a final one. To fix the issue, we should call the replacement code
once, after all fields of an entry are updated.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 0bc2ab8598fa1418d3a45499e4f047622d21d6b4)

14 months agolib: fix access-list entry update
Igor Ryzhov [Sun, 25 Feb 2024 21:12:14 +0000 (23:12 +0200)]
lib: fix access-list entry update

When an access-list entry is updated, current NB code calls notification
hooks for each updated field. It means that when multiple fields of an
entry are changed in a single commit, the hooks are run with an interim
state of an access-list instead of a final one. To fix the issue, we
should call the hooks once, after all fields of an entry are updated.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit a9460ae713a43285a972070d925ce38eaa5e363a)

14 months agoMerge pull request #15435 from FRRouting/mergify/bp/dev/10.0/pr-15387
Donatas Abraitis [Tue, 27 Feb 2024 11:36:01 +0000 (13:36 +0200)]
Merge pull request #15435 from FRRouting/mergify/bp/dev/10.0/pr-15387

bgpd: fix no bgp as-path access-list issue  (backport #15387)

14 months agobgpd: fix no bgp as-path access-list issue 15435/head
Francois Dumontet [Fri, 16 Feb 2024 14:31:14 +0000 (15:31 +0100)]
bgpd: fix no bgp as-path access-list  issue

router bgp 65001
 no bgp ebgp-requires-policy
 neighbor 192.168.1.2 remote-as external
 neighbor 192.168.1.2 timers 3 10
 address-family ipv4 unicast
  neighbor 192.168.1.2 route-map r2 in
 exit-address-family
!
ip prefix-list p1 seq 5 permit 172.16.255.31/32
!
route-map r2 permit 10
 match ip address prefix-list p1
 set as-path exclude 65003
route-map r2 permit 20
 set as-path exclude all
!

we make the following commands

bgp as-path access-list FIRST permit ^65
bgp as-path access-list SECOND permit 2
 route-map r2 permit 6
  set as-path exclude as-path-access-list SECOND

and then

no bgp as-path access-list SECOND permit 2
clear bgp *

we have the following crash in bgp

               Stack trace of thread 536083:
                #0  0x00007f87f8aacfe1 raise (libpthread.so.0 + 0x12fe1)
                #1  0x00007f87f8cf6870 core_handler (libfrr.so.0 +
    0xf6870)
                #2  0x00007f87f8aad140 __restore_rt (libpthread.so.0 +
    0x13140)
                #3  0x00007f87f89a5122 __GI___regexec (libc.so.6 +
    0xdf122)
                #4  0x000055d7f198b4a7 aspath_filter_exclude_acl (bgpd +
    0x2054a7)
                #5  0x000055d7f1902187 route_set_aspath_exclude (bgpd +
    0x17c187)
                #6  0x00007f87f8ce54b0 route_map_apply_ext (libfrr.so.0
    + 0xe54b0)
                #7  0x000055d7f18da925 bgp_input_modifier (bgpd +
    0x154925)
                #8  0x000055d7f18e0647 bgp_update (bgpd + 0x15a647)
                #9  0x000055d7f18e4772 bgp_nlri_parse_ip (bgpd +
    0x15e772)
                #10 0x000055d7f18c38ae bgp_nlri_parse (bgpd + 0x13d8ae)
                #11 0x000055d7f18c6b7a bgp_update_receive (bgpd +
    0x140b7a)
                #12 0x000055d7f18c8ff3 bgp_process_packet (bgpd +
    0x142ff3)
                #13 0x00007f87f8d0dce0 thread_call (libfrr.so.0 +
    0x10dce0)
                #14 0x00007f87f8cacb28 frr_run (libfrr.so.0 + 0xacb28)
                #15 0x000055d7f18435da main (bgpd + 0xbd5da)
                #16 0x00007f87f88e9d0a __libc_start_main (libc.so.6 +
    0x23d0a)
                #17 0x000055d7f18415fa _start (bgpd + 0xbb5fa)

analysis

crash is due to the fact that there were always a pointer from
as-path exclude to deleted as-path access list.

fix
we add a backpointer mechanism to manage the dependency beetween
as-path access-list  and aspath exclude.

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
(cherry picked from commit 100ef15262316b34ec46220806dc816db729870f)

14 months agotests: extend tests for aspath exclude
Francois Dumontet [Wed, 14 Feb 2024 16:13:40 +0000 (17:13 +0100)]
tests: extend tests for aspath exclude

adding a tests about:
"no bgp as-path access-list" command.

the folloxing "clear bgp *" command leads to the
crash exhibited above.

a sleep had been added to capture the crash befor the end of scenario.

50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
[Current thread is 1 (Thread 0x7f5f05cbb9c0 (LWP 1371086))]
(gdb) bt
    context=0x7ffcf2c216c0) at lib/sigevent.c:248
    acl_list=0x55c976ec03c0) at bgpd/bgp_aspath.c:1688
    dummy=0x7ffcf2c22340, object=0x7ffcf2c21e70) at bgpd/bgp_routemap.c:2401
    match_object=0x7ffcf2c21e70, set_object=0x7ffcf2c21e70, pref=0x0)
    at lib/routemap.c:2687
    attr=0x7ffcf2c220b0, afi=AFI_IP, safi=SAFI_UNICAST, rmap_name=0x0, label=0x0,
    num_labels=0, dest=0x55c976ebeaf0) at bgpd/bgp_route.c:1807
    addpath_id=0, attr=0x7ffcf2c22450, afi=AFI_IP, safi=SAFI_UNICAST, type=10,
    sub_type=0, prd=0x0, label=0x0, num_labels=0, soft_reconfig=0, evpn=0x0)
    at bgpd/bgp_route.c:4424
    packet=0x7ffcf2c22410) at bgpd/bgp_route.c:6266
    packet=0x7ffcf2c22410, mp_withdraw=false) at bgpd/bgp_packet.c:341
    peer=0x55c976e89ed0, size=43) at bgpd/bgp_packet.c:2414
    at bgpd/bgp_packet.c:3899

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
(cherry picked from commit 324fa2101550b542946a34de09b394df8bf8ba9d)

14 months agoMerge pull request #15433 from FRRouting/mergify/bp/dev/10.0/pr-15430
Donatas Abraitis [Tue, 27 Feb 2024 07:48:15 +0000 (09:48 +0200)]
Merge pull request #15433 from FRRouting/mergify/bp/dev/10.0/pr-15430

lib: fix setting temporary log options for libyang (backport #15430)

14 months agolib: fix setting temporary log options for libyang 15433/head
Igor Ryzhov [Mon, 26 Feb 2024 09:30:57 +0000 (11:30 +0200)]
lib: fix setting temporary log options for libyang

By calling `ly_log_options` with `LY_LOSTORE`, the current code
effectively disables libyang logging and never enables it back. The call
is done to get the current logging options, but we don't really need
that. When looking for a schema node, we don't want neither to log nor
to store the error, so simply set the temporary options to 0.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 3cd6ddaec6fd41ac84ef23595ffc7e3d18334839)

14 months agoMerge pull request #15428 from FRRouting/mergify/bp/dev/10.0/pr-15426
Igor Ryzhov [Mon, 26 Feb 2024 11:52:38 +0000 (13:52 +0200)]
Merge pull request #15428 from FRRouting/mergify/bp/dev/10.0/pr-15426

bgpd, yang: fix missing mandatory/default statements on some leafs (backport #15426)

14 months agobgpd, yang: fix missing mandatory/default statements on some leafs 15428/head
Igor Ryzhov [Sun, 25 Feb 2024 19:50:41 +0000 (21:50 +0200)]
bgpd, yang: fix missing mandatory/default statements on some leafs

The code expects these leafs to always exist. If they are not set, the
daemon would crash. CLI always sets them, but we should properly mark
them as mandatory/default to prevent them from being missed when using
the API.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 83a3b0f10f994ee5adbbef0f6bd970b69eab4486)

14 months agoMerge pull request #15425 from FRRouting/mergify/bp/dev/10.0/pr-15423
Donatas Abraitis [Mon, 26 Feb 2024 06:06:57 +0000 (08:06 +0200)]
Merge pull request #15425 from FRRouting/mergify/bp/dev/10.0/pr-15423

lib: fix processing of choices in northbound (backport #15423)

14 months agotests: add test for required choice/np-container callbacks 15425/head
Christian Hopps [Sun, 25 Feb 2024 04:24:05 +0000 (23:24 -0500)]
tests: add test for required choice/np-container callbacks

Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit e5acf6797cbeb3c68946c3a7f65d4d8b433d85f5)

14 months agotests: add test for northbound ordering fix
Christian Hopps [Sun, 25 Feb 2024 02:39:30 +0000 (21:39 -0500)]
tests: add test for northbound ordering fix

Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit a37f5f9153b0652f0f551d2e36fbfea8dab8c020)

14 months agolib: fix nb callbacks for containers inside choice case
Igor Ryzhov [Fri, 23 Feb 2024 22:06:41 +0000 (00:06 +0200)]
lib: fix nb callbacks for containers inside choice case

Containers inside a choice's case must be treated as presence containers
as they can be explicitly created and deleted. They must have `create`
and `destroy` callbacks, otherwise the internal data they represent may
never be deleted.

The issue can be reproduced with the following steps:
- create an access-list with destination-network params
  ```
  # access-list test seq 1 permit ip any 10.10.10.0 0.0.0.255
  ```
- delete the `destination-network` container
  ```
  # mgmt delete-config /frr-filter:lib/access-list[name='test'][type='ipv4']/entry[sequence='1']/destination-network
  # mgmt commit apply
  MGMTD: No changes found to be committed!
  ```

As the `destination-network` container is non-presence, and all its
leafs are mandatory, mgmtd doesn't see any changes to be commited and
simply updates its YANG data tree without passing any updates to backend
daemons.

This commit fixes the issue by requiring `create` and `destroy`
callbacks for containers inside choice's cases.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 0b905f740459291bca12e552aea4975fb46e9d98)

14 months agolib: fix order of northbound operations
Igor Ryzhov [Fri, 23 Feb 2024 19:14:26 +0000 (21:14 +0200)]
lib: fix order of northbound operations

When ordering operations, destroys must always come before other
operations, to correctly cover the change of a "case" in a "choice".

The problem can be reproduced with the following commands:
```
access-list test seq 1 permit 10.0.0.0/8
access-list test seq 1 permit host 10.0.0.1
access-list test seq 1 permit 10.0.0.0/8
```

Before this commit, the order of changes would be the following:
- `access-list test seq 1 permit 10.0.0.0/8`
  - `modify` for `ipv4-prefix`
- `access-list test seq 1 permit host 10.0.0.1`
  - `destroy` for `ipv4-prefix`
  - `modify` for `host`
- `access-list test seq 1 permit 10.0.0.0/8`
  - `modify` for `ipv4-prefix`
  - `destroy` for `host`

As `destroy` for `host` is called last, it rewrites the fields that were
filled by `modify` callback of `ipv4-prefix`. This commit fixes this
problem by always calling `destroy` callbacks first.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 38b85e0c2bc555b8827dbd2cb6515b6febf548b4)

14 months agoMerge pull request #15422 from FRRouting/mergify/bp/dev/10.0/pr-15421
Igor Ryzhov [Sat, 24 Feb 2024 15:51:16 +0000 (17:51 +0200)]
Merge pull request #15422 from FRRouting/mergify/bp/dev/10.0/pr-15421

lib: fix processing of notifications on mgmt fe client (backport #15421)

14 months agolib: fix processing of notifications on mgmt fe client 15422/head
Igor Ryzhov [Fri, 23 Feb 2024 16:53:46 +0000 (18:53 +0200)]
lib: fix processing of notifications on mgmt fe client

Notifications are sent by mgmtd for each session of a client, so they
should be processed once per each session.

Also, add session_id parameter to an async_notification callback as all
other callbacks have this parameter.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 13359c5cc9b8fd84c62b30443e063d96e9a73034)

14 months agotests: Check if multiple route-map match clauses works for EVPN prefixes 15412/head
Donatas Abraitis [Thu, 15 Feb 2024 10:19:43 +0000 (12:19 +0200)]
tests: Check if multiple route-map match clauses works for EVPN prefixes

Test prefix-list matching and some other EVPN stuff.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 049a2c0c0a4d05c2ac3c22b519bfffbbaade2f34)

14 months agolib: Do not convert EVPN prefixes into IPv4/IPv6 if not needed
Donatas Abraitis [Thu, 15 Feb 2024 10:07:43 +0000 (12:07 +0200)]
lib: Do not convert EVPN prefixes into IPv4/IPv6 if not needed

Convert only when this is really needed, e.g. `match ip address prefix-list ...`.

Otherwise, we can't have mixed match clauses, like:

```
match ip address prefix-list p1
match evpn route-type prefix
```

This won't work, because the prefix is already converted, and we can't extract
route type, vni, etc. from the original EVPN prefix.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 439b739495e86912c8b9ec36b84e55311c549ba0)

14 months agoMerge pull request #15403 from FRRouting/mergify/bp/dev/10.0/pr-15401
Igor Ryzhov [Wed, 21 Feb 2024 13:28:28 +0000 (15:28 +0200)]
Merge pull request #15403 from FRRouting/mergify/bp/dev/10.0/pr-15401

Fix order of NB callbacks (and a crash) (backport #15401)

14 months agolib: fix order of northbound callbacks 15403/head
Igor Ryzhov [Tue, 20 Feb 2024 20:32:52 +0000 (22:32 +0200)]
lib: fix order of northbound callbacks

When ordering the NB callbacks according to their priorities, if the
operation is "destroy" we should reverse the order, to destroy the
dependants before the dependencies.

This fixes the crash, that can be reproduced with the following steps:
```
frr# conf term file-lock
frr(config)# affinity-map map bit-position 10
frr(config)# interface test
frr(config-if)# link-params
frr(config-link-params)# affinity map
frr(config-link-params)# exit
frr(config-if)# exit
frr(config)# mgmt commit apply
frr(config)# no affinity-map map
frr(config)# interface test
frr(config-if)# link-params
frr(config-link-params)# no affinity map
frr(config-link-params)# exit
frr(config-if)# exit
frr(config)# mgmt commit apply
```

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 01f371a677dc52ff888b14360f6ffd63b91f3845)

14 months agolib: add missing priority for affinity map callbacks
Igor Ryzhov [Tue, 20 Feb 2024 20:27:29 +0000 (22:27 +0200)]
lib: add missing priority for affinity map callbacks

Other objects depend on affinity-maps being created before them by using
leafref with require-instance true. Set the priority to ensure that.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 323caf1d7013c4787b30ee34b3c53dd4bf0a92aa)

14 months agoMerge pull request #15398 from FRRouting/mergify/bp/dev/10.0/pr-15381
Igor Ryzhov [Tue, 20 Feb 2024 21:28:08 +0000 (23:28 +0200)]
Merge pull request #15398 from FRRouting/mergify/bp/dev/10.0/pr-15381

lib: mgmtd: add xpath arg to YANG notification message (backport #15381)

14 months agolib: mgmtd: add xpath arg to notification message 15398/head
Christian Hopps [Wed, 14 Feb 2024 15:04:11 +0000 (10:04 -0500)]
lib: mgmtd: add xpath arg to notification message

Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit 4a93d171c2e3ec1ff6c4fc553d6acf42e035e0d4)

14 months agolib: always call new notification hooks too
Christian Hopps [Mon, 12 Feb 2024 18:03:32 +0000 (13:03 -0500)]
lib: always call new notification hooks too

- call the new notification hooks when backends call the old notification
posting API.

Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit 1d4ea437e4a4fced3fce6e441952fdea8d94af80)

14 months agoMerge pull request #15380 from FRRouting/mergify/bp/dev/10.0/pr-15371
Igor Ryzhov [Thu, 15 Feb 2024 22:10:18 +0000 (00:10 +0200)]
Merge pull request #15380 from FRRouting/mergify/bp/dev/10.0/pr-15371

Fixes for the northbound/mgmtd (backport #15371)

14 months agolib: actually create the tree for the conversion 15380/head
Christian Hopps [Wed, 14 Feb 2024 22:32:04 +0000 (17:32 -0500)]
lib: actually create the tree for the conversion

Before this fix would always return empty results b/c there was no
libyang tree to print to output format.

Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit dff28248c3c1dee0d1c9f9225dab66224c6aac54)

14 months agolib: fix memleak on success
Christian Hopps [Wed, 14 Feb 2024 22:31:12 +0000 (17:31 -0500)]
lib: fix memleak on success

Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit b8e07049a8ee684eaa8df48bef6e7bfbc853644d)

14 months agotools: Change the major version from 9 to 10
Donatas Abraitis [Tue, 13 Feb 2024 19:19:52 +0000 (21:19 +0200)]
tools: Change the major version from 9 to 10

It was decided to keep it 10, not 9 as planned initially.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
14 months agoMerge pull request #15234 from opensourcerouting/snmp-topotest-fixes base_10.0
Donald Sharp [Tue, 13 Feb 2024 15:59:30 +0000 (10:59 -0500)]
Merge pull request #15234 from opensourcerouting/snmp-topotest-fixes

topotests: fix snmptrap log OID parsing

14 months agoMerge pull request #15320 from donaldsharp/vtysh_limit_fds
Russ White [Tue, 13 Feb 2024 14:50:00 +0000 (09:50 -0500)]
Merge pull request #15320 from donaldsharp/vtysh_limit_fds

lib, ospfclient, vtysh: Allow for a minimum fd poll size

14 months agoMerge pull request #15284 from opensourcerouting/feature/bgpd_announce_rpki_state_knob
Russ White [Tue, 13 Feb 2024 14:35:10 +0000 (09:35 -0500)]
Merge pull request #15284 from opensourcerouting/feature/bgpd_announce_rpki_state_knob

bgpd: Add neighbor X send-community extended rpki command

14 months agoMerge pull request #15042 from Orange-OpenSource/ospf-te
Christian Hopps [Tue, 13 Feb 2024 10:37:29 +0000 (05:37 -0500)]
Merge pull request #15042 from Orange-OpenSource/ospf-te

ospfd: Add Opaque LSA decoder for json output

14 months agoMerge pull request #15361 from idryzhov/fix-be-interested
Christian Hopps [Tue, 13 Feb 2024 01:11:20 +0000 (20:11 -0500)]
Merge pull request #15361 from idryzhov/fix-be-interested

mgmtd: fix be_is_client_interested

14 months agoMerge pull request #15352 from louis-6wind/fix-leak-recursive
Donatas Abraitis [Mon, 12 Feb 2024 19:42:03 +0000 (21:42 +0200)]
Merge pull request #15352 from louis-6wind/fix-leak-recursive

bgpd: fix route recursion on leaked routes

14 months agomgmtd: fix be_is_client_interested 15361/head
Igor Ryzhov [Mon, 12 Feb 2024 18:34:33 +0000 (20:34 +0200)]
mgmtd: fix be_is_client_interested

Backend "subscribe" API allows daemons to dynamically register xpaths
they are interested in. Such xpaths are not stored in hardcoded
config/oper xpath arrays so this function fails to understand that a
backend daemon is interested in them. Fix by using dynamic xpath maps
instead which store both hardcoded and dynamic xpaths.

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