]> git.puffer.fish Git - matthieu/frr.git/log
matthieu/frr.git
11 months agobgpd: Fix crash when deleting the SRv6 locator
Carmine Scarpitta [Fri, 3 May 2024 21:35:05 +0000 (23:35 +0200)]
bgpd: Fix crash when deleting the SRv6 locator

When BGP receives a `SRV6_LOCATOR_DEL` from zebra, it invokes
`bgp_zebra_process_srv6_locator_delete` to process the message.

`bgp_zebra_process_srv6_locator_delete` obtains a pointer to the default
BGP instance and then dereferences this pointer.

If the default BGP instance is not ready / not configured yet, this
pointer this pointer is `NULL` and dereferencing it causes BGP to crash.

This commit fix the issue by adding a a check to verify if the pointer
is `NULL` and returning early if it is.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
(cherry picked from commit ae3241b96d7be08d627f142030a41031492ffaf5)

11 months agoMerge pull request #15906 from FRRouting/mergify/bp/stable/10.0/pr-15840
Donatas Abraitis [Sun, 5 May 2024 06:15:44 +0000 (09:15 +0300)]
Merge pull request #15906 from FRRouting/mergify/bp/stable/10.0/pr-15840

ospf6d: fix interface type vs. connected routes updates (backport #15840)

11 months agoospf6d: accept CLI `no` for point-to-multipoint
David Lamparter [Thu, 25 Apr 2024 10:20:27 +0000 (12:20 +0200)]
ospf6d: accept CLI `no` for point-to-multipoint

`point-to-multipoint` was missing on the removal variant of this CLI
command.

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

11 months agoospf6d: force recalculate on interface_up
David Lamparter [Thu, 25 Apr 2024 10:18:08 +0000 (12:18 +0200)]
ospf6d: force recalculate on interface_up

interface_up also handles changes to the interface type, i.e. broadcast
to ptp to ptmp.  Connected routes for these are different and must be
readvertised, which is done in ospf6_interface_recalculate_cost() - but
only if the cost changed.  Use the force variant here.

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

11 months agoospf6d: fix loopback/ptp/ptmp conn. route checks
David Lamparter [Thu, 25 Apr 2024 10:16:35 +0000 (12:16 +0200)]
ospf6d: fix loopback/ptp/ptmp conn. route checks

The code emitting connected routes was checking against the interface
state (which can also be lo/ptp/ptmp) rather than the interface type.
This was causing wrong IA prefixes for connected routes getting put up
out if the interface was down intermittently.

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

11 months agoospf6d: fix DEFUN formatting wrecked by clang
David Lamparter [Thu, 25 Apr 2024 09:45:19 +0000 (11:45 +0200)]
ospf6d: fix DEFUN formatting wrecked by clang

clang-format doesn't understand `DEFUN` and formats it rather ugly.
Standard approach was to skip these in clang-format, which hasn't
happened here sadly.

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

11 months agoMerge pull request #15916 from FRRouting/mergify/bp/stable/10.0/pr-15837
Donald Sharp [Sat, 4 May 2024 13:41:42 +0000 (09:41 -0400)]
Merge pull request #15916 from FRRouting/mergify/bp/stable/10.0/pr-15837

fix use of deprecated c-ares api (backport #15837)

11 months agolib: replace deprecated ares_gethostbyname
Andrew Cooks [Thu, 25 Apr 2024 07:18:39 +0000 (17:18 +1000)]
lib: replace deprecated ares_gethostbyname

c-ares has deprecated ares_gethostbyname() in version 1.28.0
Replace it with ares_getaddrinfo().

This fixes a build error on Fedora 40.

Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
(cherry picked from commit 89a2e4d8257a91d115fa29e02261c33312da5cba)

11 months agolib: replace deprecated ares_process()
Andrew Cooks [Wed, 24 Apr 2024 05:01:28 +0000 (15:01 +1000)]
lib: replace deprecated ares_process()

ares_process(...) has been deprecated.
Replace it with ares_process_fd(...)

Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
(cherry picked from commit 4540fa0a3e702f577d378b3fa1f5f26591a0a5ad)

11 months agoMerge pull request #15886 from FRRouting/mergify/bp/stable/10.0/pr-15851
Donatas Abraitis [Wed, 1 May 2024 09:12:28 +0000 (12:12 +0300)]
Merge pull request #15886 from FRRouting/mergify/bp/stable/10.0/pr-15851

tools: Handle seq num for BGP as-path in frr-reload.py (backport #15851)

11 months agotools: Handle seq num for BGP as-path in frr-reload.py
Chirag Shah [Fri, 26 Apr 2024 01:52:31 +0000 (18:52 -0700)]
tools: Handle seq num for BGP as-path in frr-reload.py

If frr.conf has bgp as-path access-list clause without sequence number
then upon performing frr-rleoad, the running config clause with sequence
number will always be deleted and the new ones without sequence will
be re-added.
This could lead to blackholing until the config gets reapplied.

Testing:

frr.conf:
bgp as-path access-list important_internet_bgp_as_numbers permit _16509_

Running config:
bgp as-path access-list important_internet_bgp_as_numbers seq 5 permit
_16509_
!

Before fix
Upon frr-reload it deletes and readd line as without seq

2024-04-26 03:16:45,772  INFO: Executed "no bgp as-path access-list
important_internet_bgp_as_numbers seq 5 permit _16509_"

'bgp as-path access-list important_internet_bgp_as_numbers permit
_16509_\n'

After fix:
no form is not executed and no delta determine between frr.conf
and running-config.

Signed-off-by: Chirag Shah <chirag@nvidia.com>
(cherry picked from commit 439c6f70b5bf7c8d92719458a37c9cce70b241c9)

12 months agoMerge pull request #15856 from FRRouting/mergify/bp/stable/10.0/pr-15848
Donatas Abraitis [Sat, 27 Apr 2024 18:15:29 +0000 (21:15 +0300)]
Merge pull request #15856 from FRRouting/mergify/bp/stable/10.0/pr-15848

pimd: fix crash unconfiguring rp keepalive timer (backport #15848)

12 months agopimd: fix crash unconfiguring rp keepalive timer
Vijayalaxmi Basavaraj [Mon, 22 Apr 2024 17:55:23 +0000 (10:55 -0700)]
pimd: fix crash unconfiguring rp keepalive timer

pimd crashs while unconfigure of rp ka timer as we are trying to access
a yand dnode(suppress timer) which does not exist at the moment.

User just configured rp keepalive timer and not suppress timer,
the yang dnode would not be present. Instead of directly accessing
yang_dnode_get_unit16, first check the yang node exist using
the xpath.

Ticket: #3874971

Testing:

Before:
------
tor-11(config)# no ip pim rp keep-alive-timer 3000
vtysh: error reading from pimd: Success (0)Warning: closing connection to pimd because of an I/O error!

Broadcast message from root@tor-11 (somewhere) (Mon Apr 22 17:29:12 2024):

cumulus-core: Running cl-support for core files "pimd.25467.1713806952.core"

After:
-----
tor-11(config)# no ip pim rp keep-alive-timer 3000
tor-11(config)#

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Signed-off-by: Vijayalaxmi Basavaraj <vbasavaraj@nvidia.com>
(cherry picked from commit 0c4b7c1f1f359c1d7647fea34f62378af8b640a5)

12 months agoMerge pull request #15830 from FRRouting/mergify/bp/stable/10.0/pr-15819
Donatas Abraitis [Thu, 25 Apr 2024 05:01:04 +0000 (08:01 +0300)]
Merge pull request #15830 from FRRouting/mergify/bp/stable/10.0/pr-15819

bgpd, ospfd: fix non increasing SNMP OID (backport #15819)

12 months agoMerge pull request #15832 from FRRouting/mergify/bp/stable/10.0/pr-15766
Donatas Abraitis [Thu, 25 Apr 2024 05:00:46 +0000 (08:00 +0300)]
Merge pull request #15832 from FRRouting/mergify/bp/stable/10.0/pr-15766

bgpd: fix show run of network route-distinguisher (backport #15766)

12 months agoMerge pull request #15828 from opensourcerouting/fix/backport_inherit_flags
Donald Sharp [Wed, 24 Apr 2024 14:15:43 +0000 (10:15 -0400)]
Merge pull request #15828 from opensourcerouting/fix/backport_inherit_flags

bgpd: Inherit some peer flags from the peer-group

12 months agobgpd: fix show run of network route-distinguisher
Louis Scalbert [Tue, 16 Apr 2024 14:41:51 +0000 (16:41 +0200)]
bgpd: fix show run of network route-distinguisher

Route-distinguisher (RD) is not printed properly in show run:

>  address-family ipv6 vpn
>   network ff01::/64 rd (null) label 7
>   network ff01::/64 rd (null) label 8

ad151f66aa ("bgpd: Refactor bgp_static_set/bgp_static_set_safi") merged
bgp_static_set_safi into bgp_static_set but inadvertently omitted the
handling of prd_pretty.

Copy the pretty RD string if available.

> address-family ipv6 vpn
>  network ff01::/64 rd 75:5 label 7
>  network ff01::/64 rd 85:5 label 8

Fixes: ad151f66aa ("bgpd: Refactor bgp_static_set/bgp_static_set_safi")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
(cherry picked from commit 3d3a138f5a177a2ef5996c17c76c4f7778f9c3aa)

12 months agoRevert "bgpd: fix pointer arithmetic in bgp snmp module"
Louis Scalbert [Tue, 23 Apr 2024 09:39:29 +0000 (11:39 +0200)]
Revert "bgpd: fix pointer arithmetic in bgp snmp module"

This reverts commit d9bd9ebbf1c3ab902133e7f47c4b8c073e2df3d4.

The previous code was correct even if the coverity scanner was
complaining.

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

12 months agoRevert "ospfd: fix some dicey pointer arith in snmp module"
Louis Scalbert [Tue, 23 Apr 2024 09:36:14 +0000 (11:36 +0200)]
Revert "ospfd: fix some dicey pointer arith in snmp module"

This reverts commit 438ef98701e9922e81a451f87ad053268a1a557e.

The previous code was correct even if the coverity scanner was
complaining.

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

12 months agobgpd: Inherit `capability software-version` flag from the peer-group
Donatas Abraitis [Sun, 21 Apr 2024 11:18:39 +0000 (14:18 +0300)]
bgpd: Inherit `capability software-version` flag from the peer-group

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
12 months agobgpd: Inherit `enforce-first-as` flag from the peer-group
Donatas Abraitis [Sun, 21 Apr 2024 11:16:49 +0000 (14:16 +0300)]
bgpd: Inherit `enforce-first-as` flag from the peer-group

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
12 months agoMerge pull request #15820 from FRRouting/mergify/bp/stable/10.0/pr-15815
Donald Sharp [Tue, 23 Apr 2024 16:53:22 +0000 (12:53 -0400)]
Merge pull request #15820 from FRRouting/mergify/bp/stable/10.0/pr-15815

lib, zebra: Check for not being a blackhole route (backport #15815)

12 months agolib, zebra: Check for not being a blackhole route
Donald Sharp [Fri, 19 Apr 2024 16:13:32 +0000 (12:13 -0400)]
lib, zebra: Check for not being a blackhole route

In zebra_interface_nhg_reinstall zebra is checking that the
nhg is a singleton and not a blackhole nhg.  This was originally
done with checking that the nexthop is a NEXTHOP_TYPE_IFINDEX,
NEXTHOP_TYPE_IPV4_IFINDEX and NEXTHOP_TYPE_IPV6_IFINDEX.  This
was excluding NEXTHOP_TYPE_IPV4 and NEXTHOP_TYPE_IPV6.  These
were both possible to be received and maintained from the upper
level protocol for when a route is being recursively resolved.
If we have gotten to this point in zebra_interface_nhg_reinstall
the nexthop group has already been installed at least once
and we *know* that it is actually a valid nexthop.  What the
test is really trying to do is ensure that we are not reinstalling
a blackhole nexthop group( Which is not possible to even be
here by the way, but safety first! ).  So let's change
to test for that instead.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 29c1ff446e581fc403d155fd1d00b7c944cba56a)

12 months agoMerge pull request #15804 from FRRouting/mergify/bp/stable/10.0/pr-15798
Igor Ryzhov [Sun, 21 Apr 2024 10:04:16 +0000 (13:04 +0300)]
Merge pull request #15804 from FRRouting/mergify/bp/stable/10.0/pr-15798

vtysh: Fix `show route-map` command when calling via `do` (backport #15798)

12 months agovtysh: Fix `show route-map` command when calling via `do`
Donatas Abraitis [Fri, 19 Apr 2024 16:17:11 +0000 (19:17 +0300)]
vtysh: Fix `show route-map` command when calling via `do`

Before:

```
ton(config)# do sh route-map
% [ZEBRA] Unknown command: show route-map
% [BGP] Unknown command: show route-map
% [ISIS] Unknown command: show route-map
```

Fixes: 570fdc55fd65899cd4376193e833594af6bca093 ("lib,vtysh: fix show route map JSON output")
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 9b8f18a66cd53c506255c19829e5aada822e4ac8)

12 months agoMerge pull request #15785 from FRRouting/mergify/bp/stable/10.0/pr-15770
Donatas Abraitis [Thu, 18 Apr 2024 19:11:47 +0000 (22:11 +0300)]
Merge pull request #15785 from FRRouting/mergify/bp/stable/10.0/pr-15770

lib, zebra: fix exit commands (backport #15770)

12 months agoMerge pull request #15760 from FRRouting/mergify/bp/stable/10.0/pr-15726
Donatas Abraitis [Thu, 18 Apr 2024 08:51:03 +0000 (11:51 +0300)]
Merge pull request #15760 from FRRouting/mergify/bp/stable/10.0/pr-15726

bgpd: Fix display when using `missing-as-worst` (backport #15726)

12 months agolib, zebra: fix exit commands
Igor Ryzhov [Tue, 16 Apr 2024 19:10:45 +0000 (22:10 +0300)]
lib, zebra: fix exit commands

If a command is not marked as `YANG`-converted, the current command
batching buffer is flushed before executing the command. We shouldn't
flush the buffer when executing an `exit` command. It should only be
flushed if the next command is not `YANG`-converted, which is checked by
the command itself, not the previous `exit`.

Fixes #15706.

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

12 months agoMerge pull request #15763 from FRRouting/mergify/bp/stable/10.0/pr-15733
Jafar Al-Gharaibeh [Thu, 18 Apr 2024 06:33:55 +0000 (01:33 -0500)]
Merge pull request #15763 from FRRouting/mergify/bp/stable/10.0/pr-15733

bgpd: Drop newline in JSON output for `show bgp afi safi json detail` (backport #15733)

12 months agoMerge pull request #15779 from FRRouting/mergify/bp/stable/10.0/pr-15758
Igor Ryzhov [Wed, 17 Apr 2024 21:35:06 +0000 (00:35 +0300)]
Merge pull request #15779 from FRRouting/mergify/bp/stable/10.0/pr-15758

debian, redhat, snapcraft: Libyang min version is 2.1.128 (backport #15758)

12 months agodebian, redhat, snapcraft: Libyang min version is 2.1.128
Martin Winter [Tue, 16 Apr 2024 11:40:52 +0000 (13:40 +0200)]
debian, redhat, snapcraft: Libyang min version is 2.1.128

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
(cherry picked from commit 81d63e476a133b00deff0a6c72d8cdb0b8ccdadb)

12 months agoMerge pull request #15773 from FRRouting/mergify/bp/stable/10.0/pr-15709
Donald Sharp [Wed, 17 Apr 2024 13:17:55 +0000 (09:17 -0400)]
Merge pull request #15773 from FRRouting/mergify/bp/stable/10.0/pr-15709

tools: frr-reload strip interface vrf ctx line (backport #15709)

12 months agoMerge pull request #15764 from FRRouting/mergify/bp/stable/10.0/pr-15755
Donald Sharp [Wed, 17 Apr 2024 13:17:37 +0000 (09:17 -0400)]
Merge pull request #15764 from FRRouting/mergify/bp/stable/10.0/pr-15755

vtysh: Check if bgpd is enabled before installing vtysh commands for RPKI (backport #15755)

12 months agotools: frr-reload strip interface vrf ctx line
Chirag Shah [Tue, 9 Apr 2024 00:14:48 +0000 (17:14 -0700)]
tools: frr-reload strip interface vrf ctx line

if frr.conf file contains 'interface x vrf <name> config
it causes protocol (like ospf) neighbor session flap,
as it deletes interface base config line ('interface x') from
running config and readds with 'interface x vrf <name>'
line from frr.conf.
This deletion and readdition of lines leads to neighborship
flaps.

This issue is by product of (PR-10411 | https://github.com/FRRouting/frr/pull/10411)
(commit id: 788a036fdb)
where running config for interface config no loger displays associated
vrf line.

Ticket: #3858146
Testing:

frr.conf
interface swp1.2 vrf vrf1012
ip ospf network point-to-point

running-config:
interface swp1.2
 ip ospf network point-to-point
 exit

Before fix:
frr-reload logs:

2024-04-09 00:28:31,096  INFO: Executed "interface swp1.2  no ip ospf
network point-to-point exit"

 'interface swp1.2 vrf vrf1012\n ip ospf network
 point-to-point\nexit\n',

After fix:
frr-reload strips vrf line, thus no config change between
frr.conf and running config.

Signed-off-by: Chirag Shah <chirag@nvidia.com>
(cherry picked from commit c1356f0e85e7b8480295d38b843a729d4a491d41)

12 months agovtysh: Check if bgpd is enabled before installing vtysh commands for RPKI
Donatas Abraitis [Tue, 16 Apr 2024 08:56:39 +0000 (11:56 +0300)]
vtysh: Check if bgpd is enabled before installing vtysh commands for RPKI

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

12 months agobgpd: Drop newline in JSON output for `show bgp afi safi json detail`
Donatas Abraitis [Sat, 13 Apr 2024 19:17:01 +0000 (22:17 +0300)]
bgpd: Drop newline in JSON output for `show bgp afi safi json detail`

Before:

```
{
 "vrfId": 0,
 "vrfName": "default",
 "tableVersion": 2,
 "routerId": "1.1.1.1",
 "defaultLocPrf": 100,
 "localAS": 65001,
 "routes": { "192.168.1.0/24": {
"prefix": "192.168.1.0/24",
"version": "1",

"paths": [{"aspath":{"string":"Local","segments":[],"length":0},"origin":"IGP","metric":0,"weight":32768,"valid":true,"version":1,"sourced":true,"local":true,"bestpath":{"overall":true,"selectionReason":"First path received"},"lastUpdate":{"epoch":1713035588,"string":"Sat Apr 13 22:13:08 2024\n"},"nexthops":[{"ip":"0.0.0.0","hostname":"donatas.net","afi":"ipv4","metric":0,"accessible":true,"used":true}],"peer":{"peerId":"0.0.0.0","routerId":"1.1.1.1"}}]
} ,"192.168.11.0/24": {
"prefix": "192.168.11.0/24",
"version": "2",

"paths": [{"aspath":{"string":"Local","segments":[],"length":0},"origin":"IGP","metric":0,"weight":32768,"valid":true,"version":2,"sourced":true,"local":true,"bestpath":{"overall":true,"selectionReason":"First path received"},"lastUpdate":{"epoch":1713035588,"string":"Sat Apr 13 22:13:08 2024\n"},"nexthops":[{"ip":"0.0.0.0","hostname":"donatas.net","afi":"ipv4","metric":0,"accessible":true,"used":true}],"peer":{"peerId":"0.0.0.0","routerId":"1.1.1.1"}}]
}  }  }
```

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

12 months agobgpd: Fix display when using `missing-as-worst`
Donald Sharp [Thu, 11 Apr 2024 14:46:46 +0000 (10:46 -0400)]
bgpd: Fix display when using `missing-as-worst`

The usage of the `bgp bestpath med missing-as-worst` command
was being accepted and applied during bestpath, but during output
of the routes affected by this it would not give any indication
that this was happening or what med value was being used.

Fixes: #15718
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit bc9885b22e79ac14fd931517582d0d6d80f68c85)

12 months agoMerge pull request #15751 from FRRouting/mergify/bp/stable/10.0/pr-15749
Donatas Abraitis [Tue, 16 Apr 2024 09:01:02 +0000 (12:01 +0300)]
Merge pull request #15751 from FRRouting/mergify/bp/stable/10.0/pr-15749

zebra: fix encoded DNSSL length (backport #15749)

12 months agozebra: fix encoded DNSSL length
Igor Ryzhov [Mon, 15 Apr 2024 20:31:26 +0000 (23:31 +0300)]
zebra: fix encoded DNSSL length

The encoded DNSSL length is not set so the value is missing from RA
packet.

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

12 months agoFRR Release 10.0 docker/10.0 docker/10.0.0 frr-10.0
Jafar Al-Gharaibeh [Mon, 8 Apr 2024 16:43:17 +0000 (11:43 -0500)]
FRR Release 10.0

Major highlights:
-   Introduce local host routes
-   Require libyang 2.1.128
-   Add suport to configure a log file per daemon
-   BGP BMP Loc-RIB (RFC9069) support
-   eBGP-OAD (One Administrative Domain) support
-   BGP RPKI VRF support
-   BGP SNMP traps for BGP4-MIBV2
-   Management (mgmtd) daemon "replace" operation support
-   BGP dynamic capabilities for addpath, fqdn, orf capabilities
-   SRv6 encapsulation source address feature
-   OSPFv3 Point-To-Multipoint mode
-   bgpd
    * Add clear bgp capabilities command to resend some dynamic capabilities link
    * bgpd: Add debug bgp updates detail command link
    * Add debug bgp updates <in|out> <X.Y.Z.W> prefix-list <NAME> command link
    * Add neighbor capability fqdn command link
    * Add redistribute table-direct support link
    * Fix match ip address ... + match evpn ... commands for EVPN
    * Remove aggregated (summary-only) suppressed routes from EVPN
-   mgmtd
    * Implement full XPATH 1.0 predicate functionality
    * Output staticd configuration from mgmtd
-   ospfd
    * Fix crash in OSPF TE parsing
-   ospf6d
    * Advertise local addresses with la bit
    * Set loopback interface cost to 0
    * Let the user override interface cost for a loopback
-   pathd
    * Add dynamic candidate path metric [computed] keyword link
    * Add no msd command in the pcc context
    * Add no pcep command
-   vtysh
    * Send interface commands to mgmtd
-   watchfrr
    * Extend the ignore option to the daemon being killed
-   zebrad
    * Add mpls label dynamic-block command link
    * Add JSON support to show debugging label-table link
    * Add zebra to mgmtd oper-state
    * Allow longer prefix matches for the next hops
    * Push all configured IP addresses when the interface comes up
    * Remove static ARP entries on interface-down events
    * Support to listen teamd netlink message as bond type
    * Fix crash when macvlan link-interface is in another netns

Breaking Changes:
-   Enable enforce-first-as by default for BGP
-   noprefixroute flag for interface prefixes with NetworkManager
-   Deprecate confd

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
12 months agodebian,redhat: update for 10.0 release
Jafar Al-Gharaibeh [Mon, 8 Apr 2024 16:44:04 +0000 (11:44 -0500)]
debian,redhat: update for 10.0 release

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
12 months agoMerge pull request #15689 from FRRouting/mergify/bp/dev/10.0/pr-15640
Donatas Abraitis [Sun, 7 Apr 2024 15:37:03 +0000 (18:37 +0300)]
Merge pull request #15689 from FRRouting/mergify/bp/dev/10.0/pr-15640

bgpd: Fix errors handling for MP/GR capabilities as dynamic capability (backport #15640)

12 months agoMerge pull request #15683 from opensourcerouting/fix/revert_0325116a27258e1df773a046e...
Donald Sharp [Fri, 5 Apr 2024 23:28:17 +0000 (19:28 -0400)]
Merge pull request #15683 from opensourcerouting/fix/revert_0325116a27258e1df773a046e8668a029bead60c_10.0

Revert [10.0] bgpd: fix 6vpe nexthop

12 months agobgpd: Fix errors handling for MP/GR capabilities as dynamic capability
Donatas Abraitis [Sat, 30 Mar 2024 13:35:18 +0000 (15:35 +0200)]
bgpd: Fix errors handling for MP/GR capabilities as dynamic capability

When receiving a MP/GR capability as dynamic capability, but malformed, do not
forget to advance the pointer to avoid hitting infinity loop.

After:
```
Mar 29 11:15:28 donatas-laptop bgpd[353550]: [GS0AQ-HKY0X] 127.0.0.1 rcv CAPABILITY
Mar 29 11:15:28 donatas-laptop bgpd[353550]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 5, length 0
Mar 29 11:15:28 donatas-laptop bgpd[353550]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 0, length 0
Mar 29 11:15:28 donatas-laptop bgpd[353550]: [HFHDS-QT71N][EC 33554494] 127.0.0.1(donatas-pc): unrecognized capability code: 0 - ignored
Mar 29 11:15:28 donatas-laptop bgpd[353550]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 0, code: 0, length 0
Mar 29 11:15:28 donatas-laptop bgpd[353550]: [HFHDS-QT71N][EC 33554494] 127.0.0.1(donatas-pc): unrecognized capability code: 0 - ignored
Mar 29 11:15:28 donatas-laptop bgpd[353550]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 0, code: 0, length 0
Mar 29 11:15:28 donatas-laptop bgpd[353550]: [HFHDS-QT71N][EC 33554494] 127.0.0.1(donatas-pc): unrecognized capability code: 0 - ignored
Mar 29 11:15:28 donatas-laptop bgpd[353550]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 0, code: 0, length 1
Mar 29 11:15:28 donatas-laptop bgpd[353550]: [HFHDS-QT71N][EC 33554494] 127.0.0.1(donatas-pc): unrecognized capability code: 0 - ignored
Mar 29 11:15:28 donatas-laptop bgpd[353550]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:15:28 donatas-laptop bgpd[353550]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
```

Before:
```
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [Z1DRQ-N6Z5F] 127.0.0.1(donatas-pc): Dynamic Capability MultiProtocol Extensions afi/safi invalid (bad-value/unicast)
Mar 29 11:14:54 donatas-laptop bgpd[347675]: [JTVED-VGTQQ] 127.0.0.1(donatas-pc): CAPABILITY has action: 1, code: 1, length 10
```

Reported-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 30a332dad86fafd2b0b6c61d23de59ed969a219b)

12 months agoMerge pull request #15662 from FRRouting/mergify/bp/dev/10.0/pr-15634
Donatas Abraitis [Thu, 4 Apr 2024 21:18:44 +0000 (00:18 +0300)]
Merge pull request #15662 from FRRouting/mergify/bp/dev/10.0/pr-15634

Suppress fib funny business (backport #15634)

12 months agoRevert "topotests: add an ebgp 6vpe test"
Donatas Abraitis [Thu, 4 Apr 2024 17:07:55 +0000 (20:07 +0300)]
Revert "topotests: add an ebgp 6vpe test"

This reverts commit 4d7df91752d7414d9719a361a2fd4cc30943dc96.

12 months agoRevert "bgpd: fix 6vpe nexthop"
Donatas Abraitis [Thu, 4 Apr 2024 17:07:53 +0000 (20:07 +0300)]
Revert "bgpd: fix 6vpe nexthop"

This reverts commit 0325116a27258e1df773a046e8668a029bead60c.

12 months agobgpd: Arrange peer notification to after zebra announce
Donald Sharp [Thu, 28 Mar 2024 16:27:38 +0000 (12:27 -0400)]
bgpd: Arrange peer notification to after zebra announce

Currently BGP attempts to send route change information
to it's peers *before* the route is installed into zebra.
This creates a bug in suppress-fib-pending in the following
scenario:

a) bgp suppress-fib-pending and bgp has a route with
2 way ecmp.
b) bgp receives a route withdraw from peer 1.  BGP
will send the route to zebra and mark the route as
FIB_INSTALL_PENDING.
c) bgp receives a route withdraw from peer 2.  BGP
will see the route has the FIB_INSTALL_PENDING and
not send the withdrawal of the route to the peer.
bgp will then send the route deletion to zebra and
clean up the bgp_path_info's.

At this point BGP is stuck where it has not sent
a route withdrawal to downstream peers.

Let's modify the code in bgp_process_main_one to
send the route notification to zebra first before
attempting to announce the route.  The route withdrawal
will remove the FIB_INSTALL_PENDING flag from the dest
and this will allow group_announce_route to believe
it can send the route withdrawal.

For the master branch this is ok because the recent
backpressure commits are in place and nothing is going
to change from an ordering perspective in that regards.
Ostensibly this fix is also for operators of Sonic and
will be backported to the 8.5 branch as well.  This will
change the order of the send to peers to be after the
zebra installation but sonic users are using suppress-fib-pending
anyways so updates won't go out until rib ack has been
received anyways.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 329d5a5cbba23ec740b6ee3e223be5b13a631eb8)

12 months agobgpd: Note when receiving but not understanding a route notification
Donald Sharp [Thu, 28 Mar 2024 16:25:05 +0000 (12:25 -0400)]
bgpd: Note when receiving but not understanding a route notification

When BGP has been asked to wait for FIB installation, on route
removal a return call is likely to not have the dest since BGP
will have cleaned up the node, entirely.  Let's just note that
the prefix cannot be found if debugs are turned on and move on.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 7c603146529dc90f2d948e1943750efb1911c8ba)

12 months agoMerge pull request #15656 from FRRouting/mergify/bp/dev/10.0/pr-15628
Donatas Abraitis [Tue, 2 Apr 2024 19:29:11 +0000 (22:29 +0300)]
Merge pull request #15656 from FRRouting/mergify/bp/dev/10.0/pr-15628

bgpd: Fix error handling when receiving BGP Prefix SID attribute (backport #15628)

12 months agobgpd: Prevent from one more CVE triggering this place
Donatas Abraitis [Wed, 27 Mar 2024 17:08:38 +0000 (19:08 +0200)]
bgpd: Prevent from one more CVE triggering this place

If we receive an attribute that is handled by bgp_attr_malformed(), use
treat-as-withdraw behavior for unknown (or missing to add - if new) attributes.

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

12 months agobgpd: Fix error handling when receiving BGP Prefix SID attribute
Donatas Abraitis [Wed, 27 Mar 2024 16:42:56 +0000 (18:42 +0200)]
bgpd: Fix error handling when receiving BGP Prefix SID attribute

Without this patch, we always set the BGP Prefix SID attribute flag without
checking if it's malformed or not. RFC8669 says that this attribute MUST be discarded.

Also, this fixes the bgpd crash when a malformed Prefix SID attribute is received,
with malformed transitive flags and/or TLVs.

Reported-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit ba6a8f1a31e1a88df2de69ea46068e8bd9b97138)

12 months agoMerge pull request #15650 from FRRouting/mergify/bp/dev/10.0/pr-15647
Mark Stapp [Tue, 2 Apr 2024 12:41:02 +0000 (08:41 -0400)]
Merge pull request #15650 from FRRouting/mergify/bp/dev/10.0/pr-15647

zebra: don't deref vxlan-vni array (backport #15647)

12 months agozebra: don't deref vxlan-vni array
Mark Stapp [Mon, 1 Apr 2024 17:00:04 +0000 (13:00 -0400)]
zebra: don't deref vxlan-vni array

Null-check the vxlan-vni array info coming into zebra from
the dataplane.

Signed-off-by: Mark Stapp <mjs@cisco.com>
(cherry picked from commit 75ef259b1dd9273478414ea0684243f535ec8f33)

12 months agoMerge pull request #15641 from FRRouting/mergify/bp/dev/10.0/pr-15635
Jafar Al-Gharaibeh [Mon, 1 Apr 2024 04:42:48 +0000 (23:42 -0500)]
Merge pull request #15641 from FRRouting/mergify/bp/dev/10.0/pr-15635

bgpd: fix srv6 memory leak detection (backport #15635)

12 months agoMerge pull request #15644 from FRRouting/mergify/bp/dev/10.0/pr-15632
Jafar Al-Gharaibeh [Mon, 1 Apr 2024 04:42:09 +0000 (23:42 -0500)]
Merge pull request #15644 from FRRouting/mergify/bp/dev/10.0/pr-15632

vtysh, zebra: fix malformed json output for multiple vrfs in command 'show ip route vrf all json' (backport #15632)

12 months agovtysh, zebra: Fix malformed json output for multiple vrfs in command 'show ip route...
Piotr Suchy [Thu, 28 Mar 2024 11:55:35 +0000 (12:55 +0100)]
vtysh, zebra: Fix malformed json output for multiple vrfs in command 'show ip route vrf all json'

Command 'show ip route vrf <vrf_name> json' returns a valid json object,
however if instead of <vrf_name> we specify 'all', we get an invalid json
object, like:

{//vrf1 routes}{//vrf2 routes}{vrf3 routes}

After the fix:

{"vrf1":{//vrf1 routes},"vrf2:{//vrf2 routes},"vrf3":{//vrf3 routes}}

Which is a valid json object, that can be parsed effectively using built-in
modules. The rest of the commands remains unaffected and behave the same.

Signed-off-by: Piotr Suchy <psuchy@akamai.com>
(cherry picked from commit 0e2fc3d67f1d358896a764373f41cb59c095eda9)

13 months agobgpd: fix srv6 memory leak detection
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
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
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
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
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
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.
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
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
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
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
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`
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
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"
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
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)