Commit Graph

38268 Commits

Author SHA1 Message Date
Donatas Abraitis
007243d94d
Merge pull request #18120 from louis-6wind/fix-bgp-rd-json-show
bgpd: fix incorrect JSON in bgp_show_table_rd
2025-02-12 22:09:39 +02:00
Christian Hopps
4d4e85a541
Merge pull request #18118 from y-bharath14/srib-yang-v1
yang: Reorder the revision statements
2025-02-12 14:46:59 -05:00
Mark Stapp
6d14b169e6
Merge pull request #18125 from donaldsharp/bfd_fd_zero
bfdd: 0 is a valid fd.
2025-02-12 14:21:42 -05:00
Donald Sharp
9219fa39f2
Merge pull request #17649 from ariel-anieli/calloc-warns
tests: clear `-Wcalloc-transposed-args` warnings
2025-02-12 13:00:36 -05:00
Jafar Al-Gharaibeh
acd10af3fb
Merge pull request #18026 from donaldsharp/bfd_fixups
Bfd fixups
2025-02-12 12:00:23 -06:00
Donald Sharp
7535465284 bfdd: 0 is a valid fd.
It's unlikely that this would ever get a 0 fd to use
but let's just let the code assume it is ok.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-02-12 10:33:22 -05:00
Donald Sharp
cea55c9223
Merge pull request #18062 from pguibert6WIND/cid_1636504
Cid 1636504
2025-02-12 09:36:21 -05:00
Donald Sharp
418d0064bc
Merge pull request #18068 from opensourcerouting/fix/coverity_link_local_capability
bgpd: Do not check for capability length for Link-Local Next Hop capability
2025-02-12 09:35:16 -05:00
Donald Sharp
9623612fc0
Merge pull request #18094 from opensourcerouting/event-tardy-bfd
lib (+bfd): improve late timer warnings
2025-02-12 09:29:54 -05:00
Mark Stapp
75bc4a47b7
Merge pull request #18049 from donaldsharp/fpm_keep_on_trying
zebra: Allow fpm_listener to continue to try to read
2025-02-12 08:47:02 -05:00
Acee Lindem
b44258413f ospfd: Replace LSDB callbacks with LSA Update/Delete hooks.
Replace the LSDB callbacks with LSA update and delete hooks using the
the FRR hook mechanism. Remove redundant callbacks by placing the LSA
update and delete hooks in a single place so that deletes don't need
to be handled by the update hook. Simplify existing OSPF TE and OSPF
API Server callbacks now that there is no ambiguity or redundancy.
Also cleanup the debugging by separating out opaque-lsa debugging
from the overloaded event debugging.

Signed-off-by: Acee Lindem <acee@lindem.com>
2025-02-12 08:21:34 -05:00
Louis Scalbert
d6363625c3 bgpd: release manual vpn label on instance deletion
When a BGP instance with a manually assigned VPN label is deleted, the
label is not released from the Zebra label registry. As a result,
reapplying a configuration with the same manual label leads to VPN
prefix export failures.

For example, with the following configuration:

> router bgp 65000 vrf BLUE
>  address-family ipv4 unicast
>   label vpn export <int>

Release zebra label registry on unconfiguration.

Fixes: d162d5f6f5 ("bgpd: fix hardset l3vpn label available in mpls pool")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-02-12 14:03:02 +01:00
Louis Scalbert
cf0269649c bgpd: fix incorrect json in bgp_show_table_rd
In bgp_show_table_rd(), the is_last argument is determined using the
expression "next == NULL" to check if the RD table is the last one. This
helps ensure proper JSON formatting.

However, if next is not NULL but is no longer associated with a BGP
table, the JSON output becomes malformed.

Updates the condition to also verify the existence of the next bgp_dest
table.

Fixes: 1ae44dfcba ("bgpd: unify 'show bgp' with RD with normal unicast bgp show")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-02-12 13:34:21 +01:00
Y Bharath
3b9191fcc9 yang: Reorder the revision statements
According to the YANG specification, the revision statements should be
ordered with the most recent revision first

Signed-off-by: y-bharath14 <y.bharath@samsung.com>
2025-02-12 12:13:06 +05:30
Jafar Al-Gharaibeh
d275f551c3
Merge pull request #18069 from cscarpitta/fix/bgp_request_srv6_locator
bgpd: Request SRv6 locator after zebra connection
2025-02-11 20:59:22 -06:00
Jafar Al-Gharaibeh
c821a7a207
Merge pull request #18078 from pguibert6WIND/nhrp_incomplete_msg
nhrpd: fix dont consider incomplete L2 entry
2025-02-11 20:57:09 -06:00
Mark Stapp
9943a08720 bgpd: fix vty output of evpn route-target AS4
evpn route-targets are decoded in  ... multiple places; at least
two have a bug where the AS4 form doesn't have its AS decoded.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-02-11 14:35:28 -05:00
Russ White
9af82a24ce
Merge pull request #18037 from pguibert6WIND/bmp_bgp_open_router_id_and_as_val
Bmp bgp open router id and as val
2025-02-11 13:43:09 -05:00
Donatas Abraitis
3d15f24a79 tests: Set scope to be link-local and not global for NH
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-02-11 20:41:14 +02:00
Rajesh Varatharaj
8280257cc9 pimd: Fix for data packet loss when FHR is LHR and RP
Topology:
A single router is acting as the First Hop Router (FHR), Last Hop Router (LHR), and RP.

RC and Issue:
When an upstream S,G is in join state, it sends a register message to the RP.
If the RP has the receiver, it sends a register stop message and switches to the shortest path.
When the register stop message is processed, it removes pimreg, moves to prune,
and starts the reg stop timer.

When the reg stop timer expires, PIM changes S,G state to Join Pending and sends out a NULL
register message to RP. RP receives it and fails to send Reg stop because SPT is not set at that point.

The problem is when the register stop timer pops and state is in Join Pending.
According to https://www.rfc-editor.org/rfc/rfc4601#section-4.4.1,
we need to put back the pimreg reg tunnel into the S,G mroute.
This causes data to be sent to the control plane and subsequently interrupts the line rate.

Fix:
If the router is FHR and RP to the group,
ignore SPT status and send out a register stop message back to the DR (in this context, the same router).

Ticket: #3506780

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Signed-off-by: Rajesh Varatharaj <rvaratharaj@nvidia.com>
2025-02-11 09:52:15 -08:00
Donald Sharp
54dc8382eb zebra: Allow fpm_listener to continue to try to read
Currently when the fpm_listener attempts to read say X
bytes it may only get Y( which is less than X ).  In this
case we should assume that the dplane_fpm_nl code is just
being slow, as that we know it is possible for it to send
a partial fpm message.  Let's just loosen the constraints
a bit and allow data to flow.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-02-11 12:42:02 -05:00
Donald Sharp
f64104bd97
Merge pull request #18060 from opensourcerouting/lib-crashlog-signals
lib: crash handlers must be allowed on threads
2025-02-11 12:25:28 -05:00
Russ White
c2159b7f53
Merge pull request #18081 from chiragshah6/bgp_dev6
bgpd: fix bgp vrf instance creation from implicit
2025-02-11 12:19:45 -05:00
Donatas Abraitis
6f42b09757 tests: Disable link-local capability to check if we can use GUA NHs
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-02-11 17:01:56 +02:00
Donatas Abraitis
ca24f56a5c bgpd: Add an ability to disable link-local capability per peer
Even if we have unnumbered peering, let's respect `no neighbor X capability link-local`
and disable it per-neighbor on demand.

Fixes: db853cc97e ("bgpd: Implement Link-Local Next Hop capability")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-02-11 17:01:56 +02:00
Russ White
b814cc5706
Merge pull request #18034 from donaldsharp/unneeded_isisd
isisd: Remove unneeded modify functions
2025-02-11 08:50:09 -05:00
Russ White
b040b83c35
Merge pull request #17870 from opensourcerouting/fix/bgp_show_ip_bgp_cmd_internal
bgpd: Show internal data for BGP routes
2025-02-11 08:44:43 -05:00
Russ White
5518a8c916
Merge pull request #17370 from louis-6wind/fix-vpn-leaking
bgpd: fix for the validity and the presence of prefixes in the BGP VPN table.
2025-02-11 08:41:03 -05:00
David Lamparter
236a5c8ddb lib: thread -> event in formatting
Make it consistent and call it `event` when formatting something to
display.  Much less confusing for some user seeing it too, since threads
aren't involved.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2025-02-11 12:16:17 +01:00
David Lamparter
5bc4309b61 bfdd: use lower lateness warning for TX timers
FRR's event loop prints a warning if a timer is executed more than some
given threshold late, default being 4s.  Set a more appropriate
threshold for BFD TX timers (half TX interval).

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2025-02-11 12:16:11 +01:00
David Lamparter
ff76fb21d7 lib: improve late timer warnings
Refactor the "timer getting executed too late" warning:

- warning threshold is now adjustable
- check is performed when event actually executes, rather than when it's
  thrown on ready list
- ignore_late_timer replaced with threshold = 0
- system load averages printed in log message
- warning ratelimited to once per 10s rather than once per poll()

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2025-02-11 12:16:08 +01:00
Donatas Abraitis
28c337de18 bgpd: Add additional JSON field linkLocalOnly
This is to show if the NH address received as Link-Local Next Hop capability.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-02-11 13:13:40 +02:00
Donatas Abraitis
f8b8286e1b tests: Adopt bgp_vrf_leaking_5549_routes for LL Next Hop capability
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-02-11 13:13:40 +02:00
Donatas Abraitis
ed2c3efc27 tests: Adopt bgp_ipv6_rtadv for LL Next Hop capability
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-02-11 13:13:40 +02:00
Donatas Abraitis
5f8ad4045c bgpd: Show scope as link-local if using LL Next Hop capability
Fixes: db853cc97e ("bgpd: Implement Link-Local Next Hop capability")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-02-11 13:13:39 +02:00
Philippe Guibert
3202323052 nhrpd: fix dont consider incomplete L2 entry
Sometimes, NHRP receives L2 information on a cache entry with the
0.0.0.0 IP address. NHRP considers it as valid and updates the binding
with the new IP address.

> Feb 09 20:09:54 aws-sin-vpn01 nhrpd[2695]: [QQ0NK-1H449] Netlink: new-neigh 10.2.114.238 dev dmvpn1 lladdr 162.251.180.10 nud 0x2 cache used 0 type 4
> Feb 09 20:10:35 aws-sin-vpn01 nhrpd[2695]: [QQ0NK-1H449] Netlink: new-neigh 10.2.114.238 dev dmvpn1 lladdr 162.251.180.10 nud 0x4 cache used 1 type 4
> Feb 09 20:10:48 aws-sin-vpn01 nhrpd[2695]: [QQ0NK-1H449] Netlink: del-neigh 10.2.114.238 dev dmvpn1 lladdr 162.251.180.10 nud 0x4 cache used 1 type 4
> Feb 09 20:10:49 aws-sin-vpn01 nhrpd[2695]: [QQ0NK-1H449] Netlink: who-has 10.2.114.238 dev dmvpn1 lladdr (unspec) nud 0x1 cache used 1 type 4
> Feb 09 20:10:49 aws-sin-vpn01 nhrpd[2695]: [QVXNM-NVHEQ] Netlink: update binding for 10.2.114.238 dev dmvpn1 from c 162.251.180.10 peer.vc.nbma 162.251.180.10 to lladdr (unspec)
> Feb 09 20:10:49 aws-sin-vpn01 nhrpd[2695]: [QQ0NK-1H449] Netlink: new-neigh 10.2.114.238 dev dmvpn1 lladdr 0.0.0.0 nud 0x2 cache used 1 type 4
> Feb 09 20:11:30 aws-sin-vpn01 nhrpd[2695]: [QQ0NK-1H449] Netlink: new-neigh 10.2.114.238 dev dmvpn1 lladdr 0.0.0.0 nud 0x4 cache used 1 type 4

Actually, the 0.0.0.0 IP addressed mentiones in the 'who-has' message is
wrong because the nud state value means that value is incomplete and
should not be handled as a valid entry. Instead of considering it, fix
this by by invalidating the current binding. This step is necessary in
order to permit NHRP to trigger resolution requests again.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-02-11 11:50:52 +01:00
Philippe Guibert
323d8edcd7 bgpd: fix bmp loc-rib peer up message should use correct AS number
The transmitted AS value in te tx open message of the peer up loc-rib
message is set to 0. Actually, it should reflect the AS value of the
current BGP instance.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-02-11 11:49:28 +01:00
Philippe Guibert
2a143041f8 bgpd: fix loc-rib open message should use router-id
When forging BMP open message, the BGP router-id of tx open message of
the BMP LOC-RIB peer up message is always set to 0.0.0.0, whatever the
configured value of 'bgp router-id'.

Actually, when forging a peer up LOC-RIB message, the BGP router-id
value should be taken from the main BGP instance, and not from the peer
bgp identifier. Fix this by refreshing the router-id whenever a peer up
loc-rib message should be sent.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-02-11 11:49:28 +01:00
Philippe Guibert
ba462af2e3 bgpd: fix bgp label evpn CID 1636504
The following static analysis can be seen :

> *** CID 1636504:    (ARRAY_VS_SINGLETON)
> /bgpd/bgp_evpn_mh.c: 1241 in bgp_evpn_type1_route_process()
> 1235            build_evpn_type1_prefix(&p, eth_tag, &esi, vtep_ip);
> 1236            /* Process the route. */
> 1237            if (attr) {
> 1238                    bgp_update(peer, (struct prefix *)&p, addpath_id, attr, afi, safi, ZEBRA_ROUTE_BGP,
> 1239                               BGP_ROUTE_NORMAL, &prd, &label, num_labels, 0, NULL);
> 1240            } else {
> >>>     CID 1636504:    (ARRAY_VS_SINGLETON)
> >>>     Passing "&label" to function "bgp_withdraw" which uses it as an array. This might corrupt or misinterpret adjacent memory locations.
> 1241                    bgp_withdraw(peer, (struct prefix *)&p, addpath_id, afi, safi, ZEBRA_ROUTE_BGP,
> 1242                                 BGP_ROUTE_NORMAL, &prd, &label, num_labels);
> 1243            }
> 1244            return 0;
> 1245     }
> 1246
> /bgpd/bgp_evpn_mh.c: 1238 in bgp_evpn_type1_route_process()
> 1232             * table
> 1233             */
> 1234            vtep_ip.s_addr = INADDR_ANY;
> 1235            build_evpn_type1_prefix(&p, eth_tag, &esi, vtep_ip);
> 1236            /* Process the route. */
> 1237            if (attr) {
> >>>     CID 1636504:    (ARRAY_VS_SINGLETON)
> >>>     Passing "&label" to function "bgp_update" which uses it as an array. This might corrupt or misinterpret adjacent memory locations.
> 1238                    bgp_update(peer, (struct prefix *)&p, addpath_id, attr, afi, safi, ZEBRA_ROUTE_BGP,
> 1239                               BGP_ROUTE_NORMAL, &prd, &label, num_labels, 0, NULL);
> 1240            } else {
> 1241                    bgp_withdraw(peer, (struct prefix *)&p, addpath_id, afi, safi, ZEBRA_ROUTE_BGP,
> 1242                                 BGP_ROUTE_NORMAL, &prd, &label, num_labels);
> 1243            }

Fix this by declaring a label array instead of a single array.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-02-11 11:48:02 +01:00
Philippe Guibert
82d28f137a bgpd: simplify bgp_evpn_process_rt1 with label
Remove the num_labels variable, the received bgp_update() and
bgp_withdraw() function will read the message as including one
label or vni value.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-02-11 11:48:02 +01:00
Donatas Abraitis
0050f82b8d bgpd: Send LL only if LL Next Hop capability is negotiated
If we have LL Next Hop capability exchanged, we should send LL-only as 16-bytes
NH instead of a GUA (global unicast).

Fixes: db853cc97e ("bgpd: Implement Link-Local Next Hop capability")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-02-11 10:19:20 +02:00
Chirag Shah
2ff08af78e bgpd: fix bgp vrf instance creation from implicit
In bgp route leak, when import vrf x is executed,
it creates bgp instance as hidden with asn value as unspecified.

When router bgp x is configured ensure the correct as,
asnotation is applied otherwise running config shows asn value as 0.

This can lead to frr-reload failure when any FRR config change.

Fix:
Move asn and asnotiation, as_pretty value in common done section,
so when bgp_create gets existing instance but before returning
update asn and required fields in common section.

In bgp_create(): when returning for hidden at least update asn
and required when bgp instance created implicitly due to vrf leak.

if (hidden) {
    bgp = bgp_old;
    goto peer_init; <<<
}

Before fix:
show running:

router bgp 0 vrf purple
 bgp router-id 10.10.3.11
 !
 address-family ipv4 unicast
  redistribute static
  import vrf blue
 exit-address-family
 !
 address-family ipv6 unicast
  import vrf blue
 exit-address-family
 !
 address-family l2vpn evpn
  advertise ipv4 unicast
  advertise ipv6 unicast
 exit-address-family
exit

Testing:

1) following snippet config:
router bgp 63420 vrf blue
 import vrf purple
router bgp 63420 vrf purple
 import vrf blue
2) restart frr leads to the running config with 0 asn value.

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2025-02-10 19:08:00 -08:00
Donatas Abraitis
c91c5e8463 bgpd: Make sure Link-Local Next Hop capability has its own update-group
We should involve checking received (not only advertised) capability, because
otherwise we put both peers (one with LL capability, another without) into a
single update-group and send 16-bytes NH instead of 16-bytes and 32-bytes
separately.

Fixes: db853cc97e ("bgpd: Implement Link-Local Next Hop capability")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-02-10 23:50:26 +02:00
Donatas Abraitis
e4b14dae7c bgpd: Do not show neighbor X capability link-local for unnumbered peering
This capability is enabled by default.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-02-10 23:24:55 +02:00
Donatas Abraitis
87a6a0f2ae tests: Check if Link-Local Next Hop capability is enabled implicitly
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-02-10 23:07:28 +02:00
Donatas Abraitis
195636e3b3 doc: Enable Link-Local Next Hop capability for unnumbered peers implicitly
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-02-10 23:05:15 +02:00
Donatas Abraitis
87da3ec038 bgpd: Enable Link-Local Next Hop capability for unnumbered peers implicitly
Fixes: db853cc97e ("bgpd: Implement Link-Local Next Hop capability")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-02-10 22:59:16 +02:00
Rafael Zalamena
3d272221a4 topotests: test IGMP/MLD group/source limits
Add new topology for testing IGMP/MLD group/source limiting and more features
in the future.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2025-02-10 15:40:07 -03:00
Rafael Zalamena
c4c7118c2a topotests: multicast source group join
Allow topotests to generate source group join to test SSM.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2025-02-10 15:40:07 -03:00
Rafael Zalamena
54c5da3ab0 doc: document MLD reset command
Document newly added reset command for MLD (similar to clear ip igmp
interfaces).

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2025-02-10 15:40:07 -03:00