Commit Graph

38290 Commits

Author SHA1 Message Date
David Lamparter
cae176e10a lib: fix use after free in clear event cpu
Freeing any item here means freeing someone's `event->hist`, leaving a
dangling pointer there.  Which will immediately be written to because
we're executing in a CLI function under the `vty_read` event, whose
`event->hist` is then updated.

Deallocating `event->hist` anywhere other than shutting down the whole
event loop is a bad idea to begin with, just zero out the stats instead.

Fixes: FRRouting/frr#16419
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2025-01-28 16:40:25 +01:00
Russ White
f3b6651954
Merge pull request #17863 from opensourcerouting/fix/bgp_coverity_1617727
bgpd: Check if the peer really exists before sending dynamic capability
2025-01-28 10:35:57 -05:00
Russ White
7b6f686a9f
Merge pull request #17736 from opensourcerouting/table-direct
bgpd,lib,zebra: permit table-direct on VRFs
2025-01-28 10:24:00 -05:00
Donatas Abraitis
f373f41445 bgpd: Do not ignore auto generated VRF instances when deleting
When VRF instance is going to be deleted inside bgp_vrf_disable(), it uses
a helper method that skips auto created VRF instances and that leads to STALE
issue.

When creating a VNI for a particular VRF vrfX with e.g. `advertise-all-vni`,
auto VRF instance is created, and then we do `router bgp ASN vrf vrfX`.

But when we do a reload bgp_vrf_disable() is called, and we miss previously
created auto instance.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-01-28 17:11:58 +02:00
David Lamparter
91540d2e31 topotests: test v6 & dst-src in static_simple
The "static_simple" test has code for testing IPv6 routes, but it wasn't
even being run (duh.)  Enable it, and also test IPv6 dst-src routes.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2025-01-28 15:40:17 +01:00
David Lamparter
2726a239d4 staticd: fix NHT for dst-src routes
staticd's NHT code wasn't updating dst-src routes :(

Fixes: FRRouting/frr#14247
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2025-01-28 15:40:17 +01:00
David Lamparter
2af780650f lib, zebra: carry source prefix in route_notify
When a daemon wants to know about its routes, make it possible to have
that work for dst-src routes.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2025-01-28 15:40:17 +01:00
David Lamparter
3671ce36fd staticd: fix botched staticd YANG for dst-src
The staticd YANG conversion completely f*cked up dst-src routes.
Stupidly enough, the correct thing is much simpler as seen by the amount
of deletes in this commit.

This does, unfortunately, involve a rather annoying YANG edge case with
what should reasonably be an optional leaf as part of a list key, which
is not possible.  It uses `::/0` as unconditional filler instead, since
that is semantically correct.

The `test_yang_mgmt` topotest needed to be adjusted after this to add
`src-prefix='::/0'`.

Fixes: 88fa5104a0 ("staticd : Configuration northbound implementation")
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2025-01-28 15:40:17 +01:00
Alexander Skorichenko
0fd5ba93e3 bgpd: fix table-map option
Schedule zebra to withdraw routes filtered out by a table-map.

Signed-off-by: Alexander Skorichenko <askorichenko@netgate.com>
2025-01-28 12:52:47 +01:00
David Lamparter
1d341d461e zebra: install dst-src routes without NHG
The Linux kernel doesn't support dst-src routes with NHGs as nexthop,
for some (rather dubious) caching reasons.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2025-01-28 11:10:31 +01:00
Donatas Abraitis
ee67699bd7
Merge pull request #17905 from pguibert6WIND/advertised_routes_incorrect_json
Advertised routes incorrect json
2025-01-27 23:32:33 +02:00
Donatas Abraitis
95db38f394
Merge pull request #17919 from pguibert6WIND/bgp_suppressed_attribute
Bgp suppressed attribute
2025-01-27 23:31:46 +02:00
Mark Stapp
cb7cf73992 zebra: include resolving nexthops in nhg hash
Ensure that the nhg hash comparison function includes all
nexthops, including recursive-resolving nexthops.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-01-27 14:17:24 -05:00
Nathan Bahr
5d102a0a70 pimd: Close AutoRP socket when not needed
Don't leave the socket open if we are not enabled for discovery
or announcements.

Signed-off-by: Nathan Bahr <nbahr@atcorp.com>
2025-01-27 17:04:14 +00:00
Donald Sharp
9890d3acce
Merge pull request #17926 from opensourcerouting/fix/remove_addpath_dynamic_handling
Revert "bgpd: Handle Addpath capability using dynamic capabilities"
2025-01-27 07:14:00 -05:00
Philippe Guibert
e78a049c49 bgpd: fix missing braces when dumping json vpn advertised-routes
The json output of advertised-routes is incorrect, as there is a missing
brace with route-distinguisher:

observed with the bgp_vpnv4_noretain test:
> "bgpTableVersion":0,"bgpLocalRouterId":"192.0.2.1","defaultLocPrf":100,"localAS":65500,
> "advertisedRoutes": "192.0.2.1:1":{"rd":"192.0.2.1:1","10.101.0.0/24":{"prefix":"10.101.0.0/24",

expected:
> "bgpTableVersion":0,"bgpLocalRouterId":"192.0.2.1","defaultLocPrf":100,"localAS":65500,
> "advertisedRoutes": { "192.0.2.1:1":{"rd":"192.0.2.1:1","10.101.0.0/24":{"prefix":"10.101.0.0/24",
>                     ^
>                     missing brace

Fix this by adding the missing braces.

Fixes: 4838bac033 ("bgpd: neighbors received-routes/advertised-routes stringify changes")

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-27 11:50:32 +01:00
Philippe Guibert
d17fce21fc topotests: bgp_vpnv4_noretain, check presence of locpref in adj-rib-out
Add a test that check that the detailed command of show bgp advertised
neighbors 10.125.0.2 displays the locpref value.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-27 11:50:29 +01:00
Philippe Guibert
e1ab99261a topotests: bgp_aggregate_address_topo1, add test for suppressed keyword
Add a test that checks that the BGP route to 192.168.0.1 has all the
necessary json outputs. This route is chosen because it is a suppressed
route.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-27 11:47:41 +01:00
Philippe Guibert
c742817312 bgpd: fix add json attribute to reflect suppressed path
When aggregate is used, the suppressed information is not displayed in
the json attributes of a given path. To illustrate, the dump of the
192.168.2.1/32 path in the bgp_aggregate_address_topo1 topotest:

> # show bgp ipv4
> [..]
>  s> 192.168.2.1/32   10.0.0.2                               0 65001 i
>
> # show bgp ipv4 detail
> [..]
> BGP routing table entry for 192.168.2.1/32, version 17
> Paths: (1 available, best #1, table default, vrf (null), Advertisements suppressed by an aggregate.)
>   Not advertised to any peer
>   65001            <---- missing suppressed flag
>     10.0.0.2 from 10.0.0.2 (10.254.254.3)
>       Origin IGP, valid, external, best (First path received)
>       Last update: Fri Jan 24 13:11:41 2025
>
> # show bgp ipv4 detail json
> [..]
> ,"192.168.2.1/32": [{"aspath":{"string":"65001","segments":[{"type":"as-sequence","list":[65001]}],"length":1},"origin":"IGP","valid":true,"version":17,
> "bestpath":{"overall":true,"selectionReason":"First path received"},                <---- missing suppressed flag
> "lastUpdate":{"epoch":1737720700,"string":"Fri Jan 24 13:11:40 2025\n"},
> "nexthops":[{"ip":"10.0.0.2","afi":"ipv4","metric":0,"accessible":true,"used":true}],
> "peer":{"peerId":"10.0.0.2","routerId":"10.254.254.3","type":"external"}}]

Fix this by adding the json information.

> # show bgp ipv4 detail
> [..]
> BGP routing table entry for 192.168.2.1/32, version 17
> Paths: (1 available, best #1, table default, vrf (null), Advertisements suppressed by an aggregate.)
>   Not advertised to any peer
>   65001, (suppressed)
>     10.0.0.2 from 10.0.0.2 (10.254.254.3)
>       Origin IGP, valid, external, best (First path received)
>       Last update: Fri Jan 24 13:11:41 2025
>
> # show bgp ipv4 detail json
> [..]
> ,"192.168.2.1/32": [{"aspath":{"string":"65001","segments":[{"type":"as-sequence","list":[65001]}],"length":1},"suppressed":true,"origin":"IGP","valid":true,"version":17,
> "bestpath":{"overall":true,"selectionReason":"First path received"},
> "lastUpdate":{"epoch":1737720991,"string":"Fri Jan 24 13:16:31 2025"},
> "nexthops":[{"ip":"10.0.0.2","afi":"ipv4","metric":0,"accessible":true,"used":true}],"peer":{"peerId":"10.0.0.2","routerId":"10.254.254.3","type":"external"}}]

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-27 11:47:41 +01:00
Loïc Sang
9860583e0a topotests: add bgpevpnrt2 route map match tests
Add bgpevpn route type-2 route map filter in/out tests.

Signed-off-by: Loïc Sang <loic.sang@6wind.com>
2025-01-27 10:56:31 +01:00
Donatas Abraitis
ed63f849ef
Merge pull request #17917 from pguibert6WIND/isis_duplicate_asla
isisd: fix duplicate rfc8919 defines
2025-01-27 11:51:14 +02:00
Donatas Abraitis
4338e21aa2 Revert "bgpd: Handle Addpath capability using dynamic capabilities"
This reverts commit 05cf9d03b3.

TL;DR; Handling BGP AddPath capability is not trivial (possible) dynamically.

When the sender is AddPath-capable and sends NLRIs encoded with AddPath ID,
and at the same time the receiver sends AddPath capability "disable-addpath-rx"
(flag update) via dynamic capabilities, both peers are out of sync about the
AddPath state. The receiver thinks already he's not AddPath-capable anymore,
hence it tries to parse NLRIs as non-AddPath, while they are actually encoded
as AddPath.

AddPath capability itself does not provide (in RFC) any mechanism on backward
compatible way to handle NLRIs if they come mixed (AddPath + non-AddPath).

This explains why we have failures in our CI periodically.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-01-25 20:51:16 +02:00
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