Commit Graph

38017 Commits

Author SHA1 Message Date
Donald Sharp
f432c7b5b5
Merge pull request #18179 from FRRouting/mergify/bp/dev/10.3/pr-18178
isisd: Request SRv6 locator after zebra connection (backport #18178)
2025-02-16 15:50:08 -05:00
Donald Sharp
ea9fc3e7f8
Merge pull request #18183 from FRRouting/mergify/bp/dev/10.3/pr-18109
bgpd: fix vty output of evpn route-target AS4 (backport #18109)
2025-02-16 08:10:09 -05:00
Mark Stapp
ec023e084f 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>
(cherry picked from commit 9943a08720)
2025-02-15 20:11:56 +00:00
Carmine Scarpitta
c4ef0e37ef isisd: Request SRv6 locator after zebra connection
When SRv6 is enabled and an SRv6 locator is specified in the IS-IS
configuration, IS-IS may attempt to request SRv6 locator information from
zebra before the connection is fully established. If this occurs, the
request fails with the following error:

```
2025/02/14 21:41:20 ISIS: [HR66R-TWQYD][EC 100663302] srv6_manager_get_locator: invalid zclient socket
````

As a result, IS-IS is unable to obtain the locator information,
preventing SRv6 from working.

This commit fixes the issue by ensuring IS-IS requests SRv6 locator
information once the connection with zebra is successfully established.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
(cherry picked from commit f02dba19d2)
2025-02-15 14:40:39 +00:00
Carmine Scarpitta
5de0b8dc9d isisd: Add helper function to request SRv6 locator information
This commit adds a function that iterates over all IS-IS areas and asks
the SRv6 Manager for information about the configured locators.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
(cherry picked from commit 0b76fb3c13)
2025-02-15 14:40:39 +00:00
Jafar Al-Gharaibeh
6cfea1aa87
Merge pull request #18146 from FRRouting/mergify/bp/dev/10.3/pr-18023
lib: fix false context information for SRv6 route (backport #18023)
2025-02-13 19:04:18 -06:00
Jafar Al-Gharaibeh
478864436d
Merge pull request #18151 from FRRouting/mergify/bp/dev/10.3/pr-18064
staticd: Fix SRv6 SID installation and deletion (backport #18064)
2025-02-13 19:03:50 -06:00
Donald Sharp
961a9528ec
Merge pull request #18154 from FRRouting/mergify/bp/dev/10.3/pr-18121
bgpd: release manual vpn label on instance deletion (backport #18121)
2025-02-13 17:44:20 -05:00
Louis Scalbert
6a72facbdc 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>
(cherry picked from commit d6363625c3)
2025-02-13 19:09:09 +00:00
Carmine Scarpitta
92fa579d04 tests: Extend SRv6 static SIDs topotest to verify SID structure
The `static_srv6_sids` topotest verifies that staticd correctly
programs the SIDs in the zebra RIB. Currently, the topotest only
validates the programmed behavior and SID attributes.

This commit extends the topotest to also validate the SID structure.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
(cherry picked from commit a6d02fe2fb)
2025-02-13 18:38:17 +00:00
Carmine Scarpitta
2a23344123 lib: Add sidStructure in SRv6 SIDs JSON output
The `show ipv6 route json` command displays the IPv6 routing table in
JSON format, including SRv6 SIDs. For each SRv6 SID, it provides
behavior and SID attributes. However, it does not include the SID
structure.

This commit adds the SID structure to the SRv6 SID JSON output.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
(cherry picked from commit 312f7b3f8c)
2025-02-13 18:38:17 +00:00
Carmine Scarpitta
fce911649b staticd: Fix SRv6 SID installation and deletion
The SRv6 support in staticd (PR #16894) does not set the correct SID
parameters (block length, node length, function length).

This commit fixes the issue and computes the correct parameters.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
(cherry picked from commit e1654ba554)
2025-02-13 18:38:16 +00:00
Philippe Guibert
1f0845ad29 lib: fix false context information for SRv6 route
The seg6local route dumped by 'show ipv6 route' makes think that the USP
flavor is supported, whereas it is not the case. This information is a
context information, and for End, the context information should be
empty.

> # show ipv6 route
> [..]
> I>* fc00:0:4::/128 [115/0] is directly connected, sr0, seg6local End USP, weight 1, 00:49:01

Fix this by suppressing the USP information from the output.

Fixes: e496b42030 ("bgpd: prefix-sid srv6 l3vpn service tlv")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
(cherry picked from commit 658bf0281d)
2025-02-13 17:58:27 +00:00
Donald Sharp
dcebe85aa6
Merge pull request #18129 from FRRouting/mergify/bp/dev/10.3/pr-18026
Bfd fixups (backport #18026)
2025-02-13 11:19:28 -05:00
Jafar Al-Gharaibeh
e9e93e91fc
Merge pull request #18132 from opensourcerouting/fix/backport_82d28f137aed2e60380807a302e2b312408eff6e_10.3
Cid 1636504 (backport)
2025-02-12 22:26:21 -06:00
Jafar Al-Gharaibeh
98b774ada1
Merge pull request #18133 from FRRouting/mergify/bp/dev/10.3/pr-18120
bgpd: fix incorrect JSON in bgp_show_table_rd (backport #18120)
2025-02-12 22:25:55 -06:00
Louis Scalbert
83b859bf46 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>
(cherry picked from commit cf0269649c)
2025-02-12 20:10:58 +00:00
Philippe Guibert
867d79f5ac 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-12 21:54:38 +02:00
Philippe Guibert
50fe9e6e29 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-12 21:54:24 +02:00
Donald Sharp
461f2c327d bfdd: Use pass by reference for bfd_key_delete
Coverity is pointing out that bfd_key_delete is
passing by value instead of reference for a very
large structure.  Double plus not good.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 8119e167b0)
2025-02-12 18:01:22 +00:00
Donald Sharp
c7eb30d5b5 bfdd: Use pass by reference instead of pass by value for a struct
The function bfd_key_lookup is currently sending by value for
a now very large structure.  Let's convert this over to pass
by reference.  This is noticed by coverity.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 6d80d0c595)
2025-02-12 18:01:22 +00:00
Donald Sharp
45e7fc0bed
Merge pull request #18056 from FRRouting/mergify/bp/dev/10.3/pr-18048
pimd: fix DR election race on startup (backport #18048)
2025-02-12 12:39:27 -05:00
Donald Sharp
6d933fcbc3
Merge pull request #18083 from FRRouting/mergify/bp/dev/10.3/pr-17901
lib: actually hash all 16 bytes of IPv6 addresses, not just 4 (backport #17901)
2025-02-12 09:30:11 -05:00
Donald Sharp
8edcdf0149
Merge pull request #18101 from FRRouting/mergify/bp/dev/10.3/pr-18060
lib: crash handlers must be allowed on threads (backport #18060)
2025-02-12 08:18:58 -05:00
Donald Sharp
57c152832b
Merge pull request #18112 from FRRouting/mergify/bp/dev/10.3/pr-18078
nhrpd: fix dont consider incomplete L2 entry (backport #18078)
2025-02-12 08:17:12 -05:00
Donald Sharp
60dbf7eeba
Merge pull request #18115 from FRRouting/mergify/bp/dev/10.3/pr-18069
bgpd: Request SRv6 locator after zebra connection (backport #18069)
2025-02-12 08:15:05 -05:00
Carmine Scarpitta
8e4f5716c5 bgpd: Request SRv6 locator after zebra connection
When SRv6 is enabled and an SRv6 locator is specified in the BGP
configuration, BGP may attempt to request SRv6 locator information from
zebra before the connection is fully established. If this occurs, the
request fails with the following error:

```
2025/02/06 16:37:32 BGP: [HR66R-TWQYD][EC 100663302] srv6_manager_get_locator: invalid zclient socket
````

As a result, BGP is unable to obtain the locator information,
preventing SRv6 VPN from working.

This commit fixes the issue by ensuring BGP requests SRv6 locator
information once the connection with zebra is successfully established.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
(cherry picked from commit 16640b615d)
2025-02-12 03:00:15 +00:00
Philippe Guibert
ffcaa8ebb5 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>
(cherry picked from commit 3202323052)
2025-02-12 02:58:06 +00:00
Russ White
624682cfe9
Merge pull request #18099 from FRRouting/mergify/bp/dev/10.3/pr-18081
bgpd: fix bgp vrf instance creation from implicit (backport #18081)
2025-02-11 12:28:57 -05:00
David Lamparter
cbcc66c5d6 lib: crash handlers must be allowed on threads
Blocking all signals on non-main threads is not the way to go, at least
the handlers for SIGSEGV, SIGBUS, SIGILL, SIGABRT and SIGFPE need to run
so we get backtraces.  Otherwise the process just exits.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit 13a6ac5b4c)
2025-02-11 17:26:42 +00:00
Chirag Shah
e2d2797f7a 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>
(cherry picked from commit 2ff08af78e)
2025-02-11 17:20:28 +00:00
David Lamparter
a04474c061 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>
(cherry picked from commit 001fcfa1dd)
2025-02-11 08:43:29 +00:00
David Lamparter
e9f1d637ee 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>
(cherry picked from commit 4a0e1419a6)
2025-02-11 08:43:29 +00:00
David Lamparter
e74b0ca0fc 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>
(cherry picked from commit b666ee510e)
2025-02-11 08:43:29 +00:00
David Lamparter
9a8ad94ce9 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>
(cherry picked from commit c88589f5e9)
2025-02-11 08:43:28 +00:00
David Lamparter
a8775530a0 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>
(cherry picked from commit 95cf0b2279)
2025-02-11 08:43:28 +00:00
David Lamparter
36534e15c0 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>
(cherry picked from commit ce7f5b2122)
2025-02-11 08:43:28 +00:00
Donatas Abraitis
bf16e53186
Merge pull request #18053 from FRRouting/mergify/bp/dev/10.3/pr-14105
pimd: Fix for FHR mroute taking longer to age out (backport #14105)
2025-02-07 16:10:46 +02:00
Rafael Zalamena
b61fedd029 pimd: fix DR election race on startup
In case interface address is learnt during configuration, make sure to
run DR election when configuring PIM/PIM passive on interface.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
(cherry picked from commit 8644524606)
2025-02-07 03:42:34 +00:00
Rajesh Varatharaj
ccbe9f985b pimd: Fix for FHR mroute taking longer to age out
Issue:
When there is no traffic for a group, the LHR and RP take the default KAT+Join timer expiry of
a maximum of 480 seconds to clear the S,G . However, in the FHR, we update the state from JOINED
to NOT Joined, downstream state from PPto NOINFO.  This restarts the ET timer, causing S,G on FHR to
take more than 10 minutes to age out.

In other words,
Consider a case where (S,G) is in Join state. When the traffic stops and the KAT (210) expires,
 the Join expiry timer restarts. At this time, if we receive a prune, the expectation is to set
 PPT to 0 (RFC 4601 sec 4.5.2).
 When the PPT expires, we move to the noinfo state and restart the expiry timer one more time. We remove the
 (S,G) entry only after ~10 minutes when there is no active traffic.

Summary:
KAT Join ET 210 + PP ET 210 + NOINFO ET 210.

Solution:
Delete the ifchannel when in noinfo state, and KAT is not running.

Ticket: #13703

Signed-off-by: Rajesh Varatharaj <rvaratharaj@nvidia.com>
(cherry picked from commit afed39ea2b)
2025-02-07 03:40:41 +00:00
Jafar Al-Gharaibeh
3d61bbe0d9
Merge pull request #18042 from FRRouting/mergify/bp/dev/10.3/pr-17865
Coverity 2024 new hotness (backport #17865)
2025-02-06 17:20:22 -06:00
Jafar Al-Gharaibeh
8b5df22906
Merge pull request #18043 from FRRouting/mergify/bp/dev/10.3/pr-18038
pimd: fix memory leak and assign allocation type (backport #18038)
2025-02-06 17:20:03 -06:00
Rafael Zalamena
92792cb2ac pimd: fix memory leak and assign allocation type
Use a memory allocation specific type for filter names (to help detect memory
leaks) and fix a memory leak when releasing peer memory.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
(cherry picked from commit d1440dadff)
2025-02-06 16:32:34 +00:00
Donald Sharp
ae8ee154ef zebra: Ensure that changes to dg_update_list are protected by mutex
The dg_update_list access is controlled by the dg_mutex in all
other locations.  Let's just add a mutex usage around the initialization
of the dg_update_list even if it's part of the startup, just to keep
things consistent.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 19af3f3d7a)
2025-02-06 16:16:49 +00:00
Donald Sharp
edfcf0662b bgpd: Ensure ibuf count is protected by mutex
Grab the count of streams in ibuf when it is protected
by a mutex.  Since this data is written to it in another
pthread.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit f94ad538cf)
2025-02-06 16:16:48 +00:00
Donald Sharp
791ec8ebdd zebra: Add some documentation on when zserv_open should be used
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 4b96752737)
2025-02-06 16:16:48 +00:00
Donald Sharp
01af91e5ff ospfd: Fix Coverity SA #1617470, 76 and 78
msg_new takes a uint16_t, the length passed
down variable is a unsigned int, thus 32 bit.
It's possible, but highly unlikely, that the
msglen could be greater than 16 bit.
Let's just add some checks to ensure that
this could not happen.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 283cc51178)
2025-02-06 16:16:48 +00:00
Donald Sharp
62e01a8982
Merge pull request #18019 from FRRouting/mergify/bp/dev/10.3/pr-18000
bgpd: Fix up memory leak in processing eoiu marker (backport #18000)
2025-02-05 08:17:07 -05:00
Donald Sharp
9b99397859 bgpd: Fix up memory leak in processing eoiu marker
Memory is being leaked when processing the eoiu marker.
BGP is creating a dummy dest to contain the data but
it was never freed.  As well as the eoiu info was
not being freed either.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit c6b7a993fb)
2025-02-05 05:22:23 +00:00
Russ White
b2f9962550
Merge pull request #18006 from FRRouting/mergify/bp/dev/10.3/pr-17959
bgpd: Do not start BGP session if BGP identifier is not set (backport #17959)
2025-02-04 11:46:15 -05:00