Commit Graph

38268 Commits

Author SHA1 Message Date
Donald Sharp
9f5536807e bgpd: Optimize evaluate paths for a peer going down
Currently when a directly connected peer is going down
BGP gets a call back for nexthop tracking in addition
the interface down events.  On the interface down
event BGP goes through and sets up a per peer Q that
holds all the bgp path info's associated with that peer
and then it goes and processes this in the future.  In
the meantime zebra is also at work and sends a nexthop
removal event to BGP as well.  This triggers a complete
walk of all path info's associated with the bnc( which
happens to be all the path info's already scheduled
for removal here shortly).  This evaluate paths
is not an inexpensive operation in addition the work
for handling this is already being done via the
peer down queue.  Let's optimize the bnc handling
of evaluate paths and check to see if the peer is
still up to actually do the work here.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-01-24 15:11:46 -05:00
Jafar Al-Gharaibeh
f471573651
Merge pull request #17912 from opensourcerouting/libyang_require
redhat: Specify minimum libyang version requirement
2025-01-24 13:05:18 -06:00
Philippe Guibert
2182bf7de9 isisd: fix duplicate rfc8919 defines
The application specific defines from rfc8919 were defined twice in the
isis tlv headers. Remove the second one.

Fixes: 5749ac83a8 ("isisd: add ASLA support")

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-24 13:58:38 +01:00
Donatas Abraitis
2982edcaa3
Merge pull request #17911 from askorichenko/test-fix-bgp-peer-solo
bgpd: Fix bgp peer solo option
2025-01-24 08:50:49 +02:00
Rafael Zalamena
5846339eae bgpd,lib: document the table id / instance usage
Document where relevant about the instance overload to table ID so users
know what to expect.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2025-01-23 15:13:01 -03:00
Rafael Zalamena
36b94dcc7b topotests: test direct-table on different VRFs
Test new zebra feature that allows table-direct to work on any VRF
with BGP.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2025-01-23 14:37:09 -03:00
Rafael Zalamena
7bcb2f5193 bgpd: allow table-direct on different VRFs
Allow table-direct to be configured in different VRFs.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2025-01-23 14:37:09 -03:00
Rafael Zalamena
28a9ca3405 lib,zebra: VRF table-direct support
Implement the necessary data structures and code changes to support sending
table-direct routes to protocols running in different VRFs.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2025-01-23 14:37:09 -03:00
Rafael Zalamena
dfdc12e164 lib: abstract instance redistribution management
Use the linked list `del` callback to free memory instead of manually calling.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2025-01-23 14:37:09 -03:00
Loïc SANG
25a87dcdd4 topotests: fix bgp_evpn_route_map_match test r2 config
In this topotests, R1 is configured with an l3vni, while R2 is
configured with an l2vni. Update R2 config to match R1 config.

Signed-off-by: Loïc SANG <loic.sang@6wind.com>
2025-01-23 17:10:27 +01:00
Acee Lindem
1c55cf27a2 ospfd: Prune duplicate next-hops when installing into zebra
Duplicate next-hops are maintained for OSPF inter-area and AS
external routes in the OSPF routing table as long as they
correspond to LSAs for different adverting routers. The
intra-area route computation will not result in duplicate
next-hops.

Signed-off-by: Acee Lindem <acee@lindem.com>
2025-01-23 15:13:53 +00:00
Acee Lindem
1d96c58375 tests: OSPF topotest for next-hop pruning
OSPF topotest to test OSPF next-hop pruning on installation
into zebra routing table. Also fix multicast_pim_dr_nondr_test
topotest which had a duplicate OSPF route in the results.

Signed-off-by: Acee Lindem <acee@lindem.com>

X
2025-01-23 15:12:30 +00:00
Martin Winter
276d30a0fe
redhat: Specify minimum libyang version requirement
Version requirement from a BuildRequire get dropped and don't get
reflected in Require's for the package. Specify it both ways for
Libyang as we require >= 2.1.128

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2025-01-23 14:49:13 +01:00
Alexander Skorichenko
7bda2b36a9 bgpd: Fix bgp peer solo option
Signed-off-by: Alexander Skorichenko <askorichenko@netgate.com>
2025-01-23 14:48:16 +01:00
Donatas Abraitis
44c6bbeadb
Merge pull request #17898 from Pdoijode/pdoijode/fix-ip-route-cmd
zebra: Return error if v6 prefix is passed to show ip route
2025-01-23 15:46:59 +02:00
Donatas Abraitis
f19b843e9e
Merge pull request #17652 from pguibert6WIND/topotest_bgp_evpn_rt5
bgpd, tests: bgp_evpn_rt5, add test with match evpn vni command
2025-01-23 13:12:35 +02:00
Donatas Abraitis
4a2612cd01
Merge pull request #17904 from louis-6wind/fix-bfd-pg-update-group
bgpd: fix bfd with update-source in peer-group
2025-01-23 10:09:55 +02:00
wumu.zsl
427cf6627d doc: add sbfd doc
Signed-off-by: wumu.zsl <wumu.zsl@alibaba-inc.com>
2025-01-23 06:24:33 +00:00
wumu.zsl
8653a47708 tests: add basic topotest cases for sbfd Initiator and Reflector
Signed-off-by: wumu.zsl <wumu.zsl@alibaba-inc.com>
2025-01-23 06:23:34 +00:00
wumu.zsl
e766b68a18 bfdd: Fix CI build issue on kernel with no IPV6_HDRINCL
Signed-off-by: wumu.zsl <wumu.zsl@alibaba-inc.com>
2025-01-23 03:25:02 +00:00
wumu.zsl
0ef6003167 bfdd: add bfdname info when notify bfd status to PTM
Signed-off-by: wumu.zsl <wumu.zsl@alibaba-inc.com>
2025-01-23 02:59:55 +00:00
wumu.zsl
3548b3004d bfdd: enable sbfd session
1) create socket to send sbfd packets
2) integrate sbfd logic with existing BFD

Signed-off-by: wumu.zsl <wumu.zsl@alibaba-inc.com>
2025-01-23 02:59:09 +00:00
wumu.zsl
c58cbb2c44 bfdd: add sbfd state machine functions
Signed-off-by: wumu.zsl <wumu.zsl@alibaba-inc.com>
2025-01-23 02:58:46 +00:00
wumu.zsl
e6a531d092 bfdd: implement functions for sending sbfd pkts with SRv6 header
Two types of sbfd packets are supported: initiator packet and echo packet

Signed-off-by: wumu.zsl <wumu.zsl@alibaba-inc.com>
2025-01-23 02:57:12 +00:00
wumu.zsl
5107e273d0 bfdd: create a hash table for local sbfd reflector info
Signed-off-by: wumu.zsl <wumu.zsl@alibaba-inc.com>
2025-01-23 02:32:03 +00:00
wumu.zsl
868c4d02e6 bfdd: adjust show commands for SBFD
Signed-off-by: wumu.zsl <wumu.zsl@alibaba-inc.com>
2025-01-23 02:31:36 +00:00
wumu.zsl
311f5d40e3 bfdd: add sbfd config commands to bfdd cli
Signed-off-by: wumu.zsl <wumu.zsl@alibaba-inc.com>
2025-01-23 02:31:11 +00:00
wumu.zsl
e58f018e43 bfdd: implement Xpath callbacks for SBFD
Signed-off-by: wumu.zsl <wumu.zsl@alibaba-inc.com>
2025-01-23 02:30:44 +00:00
wumu.zsl
12af5e19a1 bfdd: support sbfd session create and destroy
refactor bfd_session_create and bfd_session_destroy to support SBFD

Signed-off-by: wumu.zsl <wumu.zsl@alibaba-inc.com>
2025-01-23 02:29:09 +00:00
wumu.zsl
2d6a4265e1 bfdd: add vtysh commands for sbfd
config examples:
    SBFD Initiator: peer 200::D bfd-mode sbfd-init bfd-name a-b-d multihop local-address 200::A remote-discr 456 srv6-source-ipv6 200::A srv6-encap-data 100::B 100::D
    SBFD Reflector: sbfd reflector source-address 200::D discriminator 456
    Echo SBFD: peer 200::A bfd-mode sbfd-echo bfd-name a-b-d local-address 200::A srv6-source-ipv6 200::A srv6-encap-data 100::B 100::D

Signed-off-by: wumu.zsl <wumu.zsl@alibaba-inc.com>
2025-01-23 01:27:55 +00:00
wumu.zsl
10e8a2e101 bfdd: modify frr-bfdd.yang for sbfd echo and sbfd init
Signed-off-by: wumu.zsl <wumu.zsl@alibaba-inc.com>
2025-01-23 01:27:02 +00:00
Pooja Jagadeesh Doijode
8c6489bc56 zebra: Return error if v6 prefix is passed to show ip route
Return error if IPv6 address or prefix is passed as an argument
to "show ip route" command.

UT:
r1# show ip route 2::3/128
% Cannot specify IPv6 address/prefix for IPv4 table
r1#
r1# show ip route 2::3
% Cannot specify IPv6 address/prefix for IPv4 table
r1#

Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
2025-01-22 10:09:03 -08:00
Philippe Guibert
3a677993c0 topotests: isis_srv6_topo1, fix wrong srte path
There is no connectivity by using the proposed srv6 path.

> From Carmine:
> This seg6-route tells rt1 to steer packets destined to fc00:0:9::1 over this path: rt1->rt2->-rt6.
> This path is not correct. Since we are installing this seg6-route on rt1,
> it means that a packet matching this seg6-route has already reached rt1.
> So rt1 should not be part of the path.
> The correct path should be rt2->rt6.

Fix this by changing the proposed seg6 route. Also, the ping test should
be swapped, because invalidating the RT1 locator does not have any
impacts on the built SRv6 path.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-22 18:29:27 +01:00
Louis Scalbert
dee3fd6f1b bgpd: fix bfd with update-source in peer-group
Fix BFD session not created when the peer is in update-group with the
update-source option.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-01-22 17:55:55 +01:00
Louis Scalbert
cb4846c057 tests: check bfd with update-source in peer-group
Check bfd with update-source in peer-group.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-01-22 17:55:55 +01:00
Philippe Guibert
2610c07831 isis_srv6_topo1: fix ping does not work as expected
The ping test does not detect when the command fails.

> 2025-01-13 15:38:27,494 INFO: topo: [+] check rt1 fc00:0:9::1 0% packet loss
> 2025-01-13 15:38:27,494 WARNING: topo: Waiting time is too small (count=10, wait=1), using default values (count=20, wait=3)
> 2025-01-13 15:38:28,501 WARNING: rt1: Router(rt1): proc failed: rc 1 pid 2028454
> 	args: /usr/bin/nsenter --mount=/proc/2026950/ns/mnt --net=/proc/2026950/ns/net --uts=/proc/2026950/ns/uts -F --wd=/tmp/topotests/isis_srv6_topo1.test_isis_srv6_topo1/rt1 /bin/bash -c ping6 fc00:0:9::1 -c 1 -w 1
> 	stdout: PING fc00:0:9::1(fc00:0:9::1) 56 data bytes
>
> --- fc00:0:9::1 ping statistics ---
> 1 packets transmitted, 0 received, 100% packet loss, time 0ms
> 	stderr: *empty*
> 2025-01-13 15:38:28,501 INFO: topo: PING fc00:0:9::1(fc00:0:9::1) 56 data bytes
>
> --- fc00:0:9::1 ping statistics ---
> 1 packets transmitted, 0 received, 100% packet loss, time 0ms
>
>
> PASSED
>

The match string is not precise enough. Complete it.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-22 17:16:53 +01:00
wumu.zsl
c4f9964aec bfdd: add bfdname in bfd_key
sbfd will use bfdname for key hash, We introduced a bfd-name for every sbfd session, normal BFD sessions can leave it as NULL.
A unique bfd-name can be used to identify a sbfd session quickly. This is quite useful in our Srv6 deployment for path protection case.
For example, if use the sbfd session to protect the SRv6 path A-B-D, we would assign the name 'path-a-b-d' or 'a-b-d' to the session.

Signed-off-by: wumu.zsl <wumu.zsl@alibaba-inc.com>
2025-01-22 15:00:24 +00:00
Donatas Abraitis
c6c570a7e6
Merge pull request #17899 from chiragshah6/evpn_dev1
bgpd: fix evpn path info get api
2025-01-22 10:23:44 +02:00
Donatas Abraitis
2991b39128
Merge pull request #17889 from louis-6wind/fix-rpki-table-version
tests: remove table version check in bgp rpki topo1
2025-01-22 07:06:25 +02:00
Donatas Abraitis
498bfbe60b
Merge pull request #17894 from pguibert6WIND/bmp_send_peerx_twice
bgpd: fix do not send twice peer up/down messages
2025-01-22 07:03:58 +02:00
Chirag Shah
c358b92c9f bgpd: fix evpn path info get api
EVPN imported routes AF is not AF_EVPN, in that case
the path info extra with EVPN is nver created.
In order to create evpn info under path extra, define
new api which does not specifically check for AF_EVPN
afi type.

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2025-01-21 15:17:20 -08:00
Donatas Abraitis
de90b70e65 tests: Check if OAD peers can exchange non-transitive extended communities
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-01-21 21:26:15 +02:00
Donatas Abraitis
f2759c46ce bgpd: Send non-transitive extended communities from/to OAD peers
draft-uttaro-idr-bgp-oad says:

Extended communities which are non-transitive across an AS boundary MAY be
advertised over an EBGP-OAD session if allowed by explicit policy configuration.
If allowed, all the members of the OAD SHOULD be configured to use the same
criteria.
For example, the Origin Validation State Extended Community, defined as
non-transitive in [RFC8097], can be advertised to peers in the same OAD.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-01-21 21:17:39 +02:00
Donald Sharp
6c7de02802
Merge pull request #17895 from LabNConsulting/chopps/fix-coverity-use-after-free
lib: fix coverity use after free issue: CID 1620101
2025-01-21 14:09:41 -05:00
Jafar Al-Gharaibeh
46a1a76783
Merge pull request #17793 from LabNConsulting/working/lb/fix-r8-rpms
Fix Rocky 8 RPMs, add options to build without rpki and docs (default is to include)
2025-01-21 10:32:32 -06:00
Christian Hopps
fb5a71fa95 lib: fix coverity use after free issue: CID 1620101
The code doesn't push more than one group (currently) so wouldn't hit the
bug yet, nice catch by coverity.

Signed-off-by: Christian Hopps <chopps@labn.net>
2025-01-21 16:27:44 +00:00
Philippe Guibert
b002757c26 bgpd: fix do not send twice peer up/down messages
With recent BMP code, on a standard BMP config, the peer up and peer
down messages related to a BGP peer are sent twice, whereas they should
be send only once.

Fix this by better controlling the condition.

Fixes: f8a6933111 ("bgpd: bmp, handle imported bgp instances for peer up/down events")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-21 16:01:10 +01:00
Donatas Abraitis
97b7875963
Merge pull request #17888 from krishna-samy/bgpd_mac_hash
bgpd: Fix for local interface MAC cache issue in 'bgp mac hash' table
2025-01-21 16:29:32 +02:00
Donatas Abraitis
5f231287a3
Merge pull request #16723 from jklaiber/fix-reload-interface-deletion
tools: fix reload interface deletion
2025-01-21 16:28:28 +02:00
Philippe Guibert
25b6751d14 bgpd: fix static analyzer issues around bgp pointer
Some static analyzer issues can be observed in BGP code:

> In file included from ./lib/zebra.h:13,
>                  from lib/event.c:8:
> ./lib/compiler.h:222:26: note: '#pragma message: Remove `clear thread cpu` command'
>   222 | #define CPP_NOTICE(text) _Pragma(CPP_STR(message text))
>       |                          ^~~~~~~
> lib/event.c:433:1: note: in expansion of macro 'CPP_NOTICE'
>   433 | CPP_NOTICE("Remove `clear thread cpu` command")
>       | ^~~~~~~~~~
> bgpd/bgp_vty.c:1592:5: warning: Access to field 'as_pretty' results in a dereference of a null pointer (loaded from variable 'bgp') [core.NullDereference]
> 1592 |                                 bgp->as_pretty);
>       |                                 ^~~~~~~~~~~~~~
> bgpd/bgp_vty.c:1599:5: warning: Access to field 'as_pretty' results in a dereference of a null pointer (loaded from variable 'bgp') [core.NullDereference]
> 1599 |                                 bgp->as_pretty);
>       |                                 ^~~~~~~~~~~~~~
> bgpd/bgp_vty.c:1612:7: warning: Access to field 'flags' results in a dereference of a null pointer (loaded from variable 'bgp') [core.NullDereference]
> 1612 |                     IS_BGP_INSTANCE_HIDDEN(bgp)) {
>       |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> ./bgpd/bgpd.h:2906:3: note: expanded from macro 'IS_BGP_INSTANCE_HIDDEN'
> 2906 |         (CHECK_FLAG(_bgp->flags, BGP_FLAG_INSTANCE_HIDDEN) &&                  \
>       |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> ./lib/zebra.h:274:31: note: expanded from macro 'CHECK_FLAG'
>   274 | #define CHECK_FLAG(V,F)      ((V) & (F))
>       |                               ^~~
> bgpd/bgp_vty.c:1614:4: warning: Access to field 'flags' results in a dereference of a null pointer (loaded from variable 'bgp') [core.NullDereference]
> 1614 |                         UNSET_FLAG(bgp->flags, BGP_FLAG_INSTANCE_HIDDEN);
>       |                         ^          ~~~
> ./lib/zebra.h:276:34: note: expanded from macro 'UNSET_FLAG'
>   276 | #define UNSET_FLAG(V,F)      (V) &= ~(F)
>       |                               ~  ^
> 4 warnings generated.
> Static Analysis warning summary compared to base:

Fix those issues by protecting the bgp pointer.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-21 13:48:36 +01:00