Commit Graph

38290 Commits

Author SHA1 Message Date
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
Rafael Zalamena
99861a084a pim6d: implement clear IPv6 MLD interfaces
Allow user to reset MLD state on all interfaces in a VRF.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2025-02-10 15:40:07 -03:00
Rafael Zalamena
8a29d74004 doc: IGMP/MLD commands to limit source/groups
Document the newly added commands to limit the maximum amount of
groups/source to learn.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2025-02-10 15:40:07 -03:00
Rafael Zalamena
a98f2b86c4 pim6d: implement MLD source/group limits
Let user configure a source/group limit for MLD protocol.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2025-02-10 15:40:07 -03:00
David Lamparter
f07d379b74 pimd: implement IGMP group/source count limit
For groups we can just look at the length of the list, for sources we
need to count them on a per-interface level.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2025-02-10 15:40:07 -03:00
Donald Sharp
14eac319e8 bgpd: Fix crash in bgp_labelpool
The bgp labelpool code is grabbing the vpn policy data structure.
This vpn_policy has a pointer to the bgp data structure.  If
a item placed on the bgp label pool workqueue happens to sit
there for the microsecond or so and the operator issues a
`no router bgp...` command that corresponds to the vpn_policy
bgp pointer, when the workqueue is run it will crash because
the bgp pointer is now freed and something else owns it.

Modify the labelpool code to store the vrf id associated
with the request on the workqueue.  When you wake up
if the vrf id still has a bgp pointer allow the request
to continue, else drop it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-02-10 12:09:59 -05:00
Donald Sharp
baf4c1a78f
Merge pull request #18077 from y-bharath14/srib-babeld-code-maintainability
babeld: Improve code clarity and maintainability
2025-02-10 09:48:23 -05:00
David Lamparter
a97be61de8
Merge pull request #17775 from gromit1811/pr_journald_bugfix 2025-02-10 09:27:50 +01:00
Y Bharath
db8e385752 babeld: Improve code clarity and maintainability
Improve code clarity and maintainability

Signed-off-by: y-bharath14 <y.bharath@samsung.com>
2025-02-10 11:43:05 +05:30
Carmine Scarpitta
16640b615d 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>
2025-02-09 00:54:29 +01:00
Carmine Scarpitta
a6d02fe2fb 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>
2025-02-08 22:31:19 +01:00
Carmine Scarpitta
312f7b3f8c 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>
2025-02-08 22:31:19 +01:00
Carmine Scarpitta
e1654ba554 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>
2025-02-08 22:31:19 +01:00
Donatas Abraitis
d3741f8437 bgpd: Do not check for capability length for Link-Local Next Hop capability
Capability's length is 0 and this is not needed to check if it's multiplied by
X or there is a minimum length for that.

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

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2025-02-08 13:01:53 +02:00
Russ White
2ef76a3350
Merge pull request #17871 from opensourcerouting/feature/bgp_link_local_capability
bgpd: Implement Link-Local Next Hop capability
2025-02-07 14:00:59 -05:00
Donald Sharp
eebe460168
Merge pull request #18045 from LabNConsulting/ziemba/250205-rfapi-mem-cleanup
bgpd: rfapi: fix mem leak when killed
2025-02-07 11:20:08 -05:00
David Lamparter
13a6ac5b4c 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>
2025-02-07 13:37:43 +01:00
Jafar Al-Gharaibeh
452732024e
Merge pull request #18048 from opensourcerouting/msdpt3f
pimd: fix DR election race on startup
2025-02-06 21:40:45 -06:00
Rafael Zalamena
fd66ede08b
Merge pull request #14105 from routingrocks/pim_ageout_fix
pimd: Fix for FHR mroute taking longer to age out
2025-02-06 21:25:45 -03:00
Rafael Zalamena
8644524606 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>
2025-02-06 19:30:51 -03:00
Russ White
f04f611633
Merge pull request #18033 from donaldsharp/isis_leak_lists
isisd: Do not leak a linked list in the circuit
2025-02-06 13:14:50 -05:00
Rajesh Varatharaj
51f26d17da pimd: During prefix-list update, behave as PIM_UPSTREAM_NOTJOINED state (conformance issue)
Issue:
If there are any changes to the prefix list, we perform a re-lookup to map the correct RP for the group.
Even if the S,G entry is PIM_UPSTREAM_NOTJOINED and in FHR, In the case of IGMPv3, an S,G entry can be
created with no joins. this is not necessary.
 https://www.rfc-editor.org/rfc/rfc4601#section-4.5.7 says no op in case of NOTJOINED

Solution:
To solve this issue, Stop RP mapping when the state is NOTJOINED

Ticket: #3496931

Signed-off-by: Rajesh Varatharaj <rvaratharaj@nvidia.com>
2025-02-06 10:59:34 -06:00
G. Paul Ziemba
125a480b53 bgpd: rfapi: if BGP is terminating, free peer BPIs now instead of using timer
Signed-off-by: G. Paul Ziemba <paulz@labn.net>
2025-02-06 08:45:01 -08:00
Jafar Al-Gharaibeh
92b8e14460
Merge pull request #18038 from opensourcerouting/msdp-filter-leak
pimd: fix memory leak and assign allocation type
2025-02-06 10:31:31 -06:00
Rajesh Varatharaj
afed39ea2b 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>
2025-02-06 10:19:46 -06:00
Jafar Al-Gharaibeh
92288c9069
Merge pull request #17865 from donaldsharp/coverity_2024_new_hotness
Coverity 2024 new hotness
2025-02-06 10:15:55 -06:00
Martin Winter
075f44a417
Merge pull request #18029 from donaldsharp/more_support_bundle_data
tools: Add some more support bundle commands
2025-02-06 15:12:49 +01:00
Mark Stapp
e46bd54541
Merge pull request #18025 from donaldsharp/remove_sbfd_pymark
tests: Remove improper pymark
2025-02-06 08:58:27 -05:00
Rafael Zalamena
d1440dadff 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>
2025-02-06 10:17:19 -03:00
Philippe Guibert
658bf0281d 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>
2025-02-06 08:21:56 +01:00
Donald Sharp
bbb764c0f0 isisd: Remove unneeded modify functions
Our infrastructure was complaining about this:

2025/02/05 19:38:42 ISIS: [ZKB8W-3S2Q4][EC 100663330] unneeded 'modify' callback for '/frr-isisd:isis/instance/fast-reroute/level-1/lfa/tiebreaker/type'
2025/02/05 19:38:42 ISIS: [ZKB8W-3S2Q4][EC 100663330] unneeded 'modify' callback for '/frr-isisd:isis/instance/fast-reroute/level-2/lfa/tiebreaker/type'

Seems we don't need it.  Let's just remove it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-02-05 20:46:25 -05:00
Donald Sharp
3510a37b11 isisd: Do not leak a linked list in the circuit
Address sanitizer was telling us that linked lists
were being leaked.  No need to do so.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2025-02-05 20:15:01 -05:00