Commit Graph

38268 Commits

Author SHA1 Message Date
Donald Sharp
c41155221e zebra: Ensure dplane does not send work back to master at wrong time
When looping through the dplane providers, the worklist was
being populated with items from the last provider and then
the event system was checked to see if we should stop processing.
If the event system says `yes` then the dplane code would stop
and send the worklist to the master zebra pthread for collection.
This obviously skipped the next dplane provider on the list
which is double plus not good.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-01-31 12:38:20 -05:00
Donatas Abraitis
ce20b8cc0d
Merge pull request #17956 from pguibert6WIND/isis_srv6_codepoint_erroneous
isisd: fix erroneous srv6 information in database
2025-01-31 13:56:09 +02:00
Carmine Scarpitta
339c49bcff tests: Add testcase for static End/uN validation
This commit adds a testcase to validate static End/uN allocation.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2025-01-30 19:28:34 +01:00
Carmine Scarpitta
a879aebf69 zebra: Fix SRv6 SID Manager
The SRv6 SID Manager does not allow allocating an SRv6 End/uN function
even though it is already supported by staticd.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2025-01-30 19:28:34 +01:00
Donatas Abraitis
de8f52b525
Merge pull request #17934 from nabahr/autorp-close
pimd: Close AutoRP socket when not needed
2025-01-30 16:19:40 +02:00
Mikhail Sokolovskiy
90fe717352 topotests: Router deletion in SRv6 sid reachability
Signed-off-by: Mikhail Sokolovskiy <sokolmish@gmail.com>
2025-01-30 01:54:47 +03:00
Mikhail Sokolovskiy
f3680ab410 bgpd: Release SID on router deletion
Signed-off-by: Mikhail Sokolovskiy <sokolmish@gmail.com>
2025-01-30 01:54:31 +03:00
Donatas Abraitis
48560b5c9b tests: Check if the peer stays Idle if router-id is not set
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-01-29 23:17:20 +02:00
Donatas Abraitis
739f2b566a bgpd: Do not start BGP session if BGP identifier is not set
If we have IPv6-only network and no IPv4 addresses at all, then by default
0.0.0.0 is created which is treated as malformed according to RFC 6286.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-01-29 23:03:06 +02:00
Donatas Abraitis
c9a2928954 doc: Say that 0.0.0.0 (0) BGP identifier is invalid
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-01-29 22:24:39 +02:00
David Lamparter
001fcfa1dd lib: clean up nexthop hashing mess
We were hashing 4 bytes of the address.  Even for IPv6 addresses.

Oops.

The reason this was done was to try to make it faster, but made a
complex maze out of everything.  Time for a refactor.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2025-01-29 16:48:37 +01:00
David Lamparter
4a0e1419a6 lib: guard against padding garbage in ZAPI read
When reading in a nexthop from ZAPI, only set the fields that actually
have meaning.  While it shouldn't happen to begin with, we can otherwise
carry padding garbage into the unused leftover union bytes.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2025-01-29 16:48:37 +01:00
David Lamparter
b666ee510e zebra: guard against junk in nexthop->rmap_src
rmap_src wasn't initialized, so for IPv4 the unused 12 bytes would
contain whatever junk is on the stack on function entry.  Also move
the IPv4 parse before the IPv6 parse so if it's successful we can be
sure the other bytes haven't been touched.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2025-01-29 16:48:37 +01:00
David Lamparter
c88589f5e9 pbrd: initialize structs used in hash_lookup
Doesn't seem to break anything but really poor style to pass potentially
uninitialized data to hash_lookup.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2025-01-29 16:48:37 +01:00
David Lamparter
95cf0b2279 fpm: guard against garbage in unused address bytes
Zero out the 12 unused bytes (for the IPv6 address) when reading in an
IPv4 address.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2025-01-29 16:48:37 +01:00
David Lamparter
ce7f5b2122 bgpd: don't reuse nexthop variable in loop/switch
While the loop is currently exited in all cases after using nexthop, it
is a footgun to have "nh" around to be reused in another iteration of
the loop.  This would leave nexthop with partial data from the previous
use.  Make it local where needed instead.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2025-01-29 16:48:37 +01:00
Donald Sharp
f849511c47
Merge pull request #17935 from mjstapp/fix_nhg_hash_equal
zebra: include resolving nexthops in nhg hash
2025-01-29 10:14:37 -05:00
Donald Sharp
fb8e399e4f lib: Remove System routes from ip protocol route map choices
Do not allow system routes to be selected for ip protocol

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-01-29 09:31:53 -05:00
Donatas Abraitis
190906aaf1
Merge pull request #17946 from bobuhiro11/normalize_ebgp_multihop
tools: Fix frr-reload for ebgp-multihop TTL reconfiguration.
2025-01-29 14:05:12 +02:00
Philippe Guibert
4150f9bbb1 isisd: fix erroneous srv6 information in database
The show isis database detail command dumps invalid srv6 information:
>  SRv6 Locator: fc00:0:6::/64 (Metric: 0) ipv6-unicast
>    Sub-TLVs:
>      SRv6 End SID Endpoint Behavior: unknown, SID value: fc00:0:6:0:1::
>
>  MT Reachability: 0123.6452.1973.03 (Metric: 10) ipv6-unicast
>    Local Interface IPv6 Address(es): 192::4:3
>    SRv6 Lan End.X SID: fc00:0:3:0:43::, Algorithm: SPF, Weight: 0, Endpoint Behavior: End.DX6, Flags: B:0, S:0, P:0 Neighbor-ID: 0123.6452.1975
>        SRv6 SID Structure Locator Block length: 40, Locator Node length: 24, Function length: 16, Argument length: 0,

The behavior codepoint should use the IANA definitions to display the
correct value. Fix this by calling the appropriate convert function.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-01-29 12:20:24 +01:00
Nobuhiro MIKI
594e917656 tools: Fix frr-reload for ebgp-multihop TTL reconfiguration.
In ebgp-multihop, there is a difference in reload behavior when TTL is
unspecified (meaning default 255) and when 255 is explicitly specified.
For example, when reloading with 'neighbor <neighbor> ebgp-multihop
255' in the config, the following difference is created. This commit
fixes that.

    Lines To Delete
    ===============
    router bgp 65001
     no neighbor 10.0.0.4 ebgp-multihop
    exit

    Lines To Add
    ============
    router bgp 65001
     neighbor 10.0.0.4 ebgp-multihop 255
    exit

The commit 767aaa3a80 is not sufficient and frr-reload needs to be
fixed to handle both unspecified and specified cases.

Signed-off-by: Nobuhiro MIKI <nob@bobuhiro11.net>
2025-01-29 04:43:17 +00:00
Donald Sharp
73ab6a46c5 tests: Add a test that shows the v6 recursive nexthop problem
Currently FRR does not handle v6 recurisive resolution properly
when the route being recursed through changes and the most
significant bits of the route are not changed.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-01-28 13:52:32 -05:00
Russ White
bd82864d03
Merge pull request #17941 from opensourcerouting/fix-dst-src
static: fix botched staticd YANG conversion for dst-src
2025-01-28 12:23:06 -05:00
Russ White
e82788de46
Merge pull request #17802 from askorichenko/test-fix-table-map
bgpd: fix table-map option
2025-01-28 12:20:43 -05:00
Russ White
3bdb561d1c
Merge pull request #17906 from LabNConsulting/aceelindem/ospf-prune-dup-next-hops
ospfd: Prune duplicate next-hop when installing into zebra route table.
2025-01-28 12:19:07 -05:00
Russ White
e54c11d54d
Merge pull request #17848 from pguibert6WIND/isis_srv6_topo1_ping
Isis srv6 topo1 ping
2025-01-28 11:49:20 -05:00
Russ White
219b00cb74
Merge pull request #17924 from donaldsharp/evaluate_paths_optimization
bgpd: Optimize evaluate paths for a peer going down
2025-01-28 11:29:15 -05:00
Russ White
cec2e9b159
Merge pull request #17881 from opensourcerouting/fix/last_reset_reason
bgpd: last reset SNAFU
2025-01-28 10:40:50 -05:00
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