Commit graph

487 commits

Author SHA1 Message Date
Mark Stapp 660cbf5651 bgpd: clean up variable-shadowing compiler warnings
Clean up -Wshadow warnings in bgp.

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-04-08 14:41:27 -04:00
Russ White ab67e5544e
Merge pull request #18396 from pguibert6WIND/srv6l3vpn_to_bgp_vrf_redistribute
Add BGP redistribution in SRv6 BGP
2025-04-03 08:25:32 -04:00
Louis Scalbert cbf27be5d9 bgpd: optimize attrhash_cmp calls
Only call attrhash_cmp when necessary.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2025-04-01 16:52:58 +02:00
Philippe Guibert 99acebcdc9 bgpd: fix check validity of a VPN SRv6 route with modified nexthop
When exporting a VPN SRv6 route, the path may not be considered valid if
the nexthop is not valid. This is the case when the 'nexthop vpn export'
command is used. The below example illustrates that the VPN path to
2001:1::/64 is not selected, as the expected nexthop to find in vrf10 is
the one configured:

> # show running-config
> router bgp 1 vrf vrf10
>  address-family ipv6 unicast
>   nexthop vpn export 2001::1

> # show bgp ipv6 vpn
> [..]
> Route Distinguisher: 1:10
>      2001:1::/64      2001::1@4                0             0 65001 i
>     UN=2001::1 EC{99:99} label=16 sid=2001:db8:1:1:: sid_structure=[40,24,16,0] type=bgp, subtype=5

The analysis indicates that the 2001::1 nexthop is considered.

> 2025/03/20 21:47:53.751853 BGP: [RD1WY-YE9EC] leak_update: entry: leak-to=VRF default, p=2001:1::/64, type=10, sub_type=0
> 2025/03/20 21:47:53.751855 BGP: [VWNP2-DNMFV] Found existing bnc 2001::1/128(0)(VRF vrf10) flags 0x82 ifindex 0 #paths 2 peer 0x0, resolved prefix UNK prefix
> 2025/03/20 21:47:53.751856 BGP: [VWC2R-4REXZ] leak_update_nexthop_valid: 2001:1::/64 nexthop is not valid (in VRF vrf10)
> 2025/03/20 21:47:53.751857 BGP: [HX87B-ZXWX9] leak_update: ->VRF default: 2001:1::/64: Found route, no change

Actually, to check the nexthop validity, only the source path in the VRF
has the correct nexthop. Fix this by reusing the source path information
instead of the current one.

> 2025/03/20 22:43:51.703521 BGP: [RD1WY-YE9EC] leak_update: entry: leak-to=VRF default, p=2001:1::/64, type=10, sub_type=0
> 2025/03/20 22:43:51.703523 BGP: [VWNP2-DNMFV] Found existing bnc fe80::b812:37ff:fe13:d441/128(0)(VRF vrf10) flags 0x87 ifindex 0 #paths 2 peer 0x0, resolved prefix fe80::/64
> 2025/03/20 22:43:51.703525 BGP: [VWC2R-4REXZ] leak_update_nexthop_valid: 2001:1::/64 nexthop is valid (in VRF vrf10)
> 2025/03/20 22:43:51.703526 BGP: [HX87B-ZXWX9] leak_update: ->VRF default: 2001:1::/64: Found route, no change

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2025-03-24 09:17:01 +01:00
Russ White a3e0e4eb49
Merge pull request #17526 from raja-rajasekar/rajasekarr/evpn_bp_and_optimizations_3864372_FINAL_upstream
EVPN L2VNI/L3VNI Optimize inline Global walk for remote route installations
2024-12-17 11:15:27 -05:00
Chirag Shah 3f3c923d7a bgpd: copy asn of src vrf to evpn type5 route
When a unicast route from source vrf is imported into
evpn as type5 route, prepend the asn of the source vrf into
type5 asn path list.

The condition of evpn type5 prefix path info is present but
source vrf route has been cleared via clear command. In this
case existing path info needs to rewrite the source vrf asn.

prepends asn of the source vrf, but the further condition
for existing path attribute for the same route needs to prepend
source vrf asn.

Ticket: #2943080
Testing:
Before fix:
r4# clear ip bgp vrf overlay prefix 0.0.0.0/0
Route Distinguisher: 128.117.243.209:4
*> [5]:[0]:[0]:[0.0.0.0]
         203.0.113.1          0          0 194 ? <--- 64512 is missing
         ET:8 RT:64532:104001 Rmac:06:ec:bf:59:e8:93

After fix:
r4# clear ip bgp vrf overlay prefix 0.0.0.0/0

Route's source vrf bgp output containing ASN 64512:
r4# show bgp vrf overlay
BGP table version is 2, local router ID is 128.117.243.209, vrf id 10
Default local pref 100, local AS 64512
...

Notice after clear command source vrf asn 64512 is retained.
Route Distinguisher: 128.117.243.209:4
*> [5]:[0]:[0]:[0.0.0.0]
         203.0.113.1          0          0 64512 194 ?
         ET:8 RT:64532:104001 Rmac:06:ec:bf:59:e8:93

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2024-12-09 12:39:08 -05:00
Trey Aspelund 7ec7446ea8 bgpd: only import specific route-types into EVIs
Prior to this we were only filtering EVPN routes from the import logic
if they were not route-type 1/2/3/5, which allowed things like RT-5s to
be imported into an L2VNI/MAC-VRF. This adds additional logic to ensure
routes are only imported into EVIs where they make sense.
No more nonsensical route importing!

Ticket: 2848204
Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
2024-12-09 12:39:08 -05:00
Rajasekar Raja bd32706c70 bgpd: Suppress redundant L3VNI delete processing
Consider a master bridge interface (br_l3vni) having a slave vxlan99
mapped to vlans used by 3 L3VNIs.

During ifdown br_l3vni interface, the function
zebra_vxlan_process_l3vni_oper_down() where zebra sends ZAPI to bgp for
a delete L3VNI is sent twice.
 1) if_down -> zebra_vxlan_svi_down()
 2) VXLAN is unlinked from the bridge i.e. vxlan99
    zebra_if_dplane_ifp_handling() --> zebra_vxlan_if_update_vni()
    (since ZEBRA_VXLIF_MASTER_CHANGE flag is set)

During ifup br_l3vni interface, the function
zebra_vxlan_process_l3vni_oper_down() is invoked because of access-vlan
change - process oper down, associate with new svi_if and then process
oper up again

The problem here is that the redundant ZAPI message of L3VNI delete
results in BGP doing a inline Global table walk for remote route
installation when the L3VNI is already removed/deleted. Bigger the
scale, more wastage is the CPU utilization.

Given the triggers for bridge flap is not a common scenario, idea is to
simply return from BGP if the L3VNI is already set to 0 i.e.
if the L3VNI is already deleted, do nothing and return.

NOTE/TBD: An ideal fix is to make zebra not send the second L3VNI delete
ZAPI message. However it is a much involved and a day-1 code to handle
corner cases.

Ticket :#3864372

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
2024-12-09 08:46:16 -08:00
Rajasekar Raja 0f2cb27310 bgpd: backpressure - Optimize EVPN L3VNI remote routes processing
Anytime BGP gets a L3 VNI ADD/DEL from zebra,
 - Walking the entire global routing table per L3VNI is very expensive.
 - The next read (say of another VNI ADD/DEL) from the socket does
   not proceed unless this walk is complete.

So for triggers where a bulk of L3VNI's are flapped, this results in
huge output buffer FIFO growth spiking up the memory in zebra since bgp
is slow/busy processing the first message.

To avoid this, idea is to hookup the BGP-VRF off the struct bgp_master
and maintain a struct bgp FIFO list which is processed later on, where
we walk a chunk of BGP-VRFs and do the remote route install/uninstall.

Ticket :#3864372

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
2024-12-09 08:46:16 -08:00
Rajasekar Raja 07a80709c7 bgpd: backpressure - Optimize EVPN L2VNI remote routes processing
Anytime BGP gets a L2 VNI ADD from zebra,
 - Walking the entire global routing table per L2VNI is very expensive.
 - The next read (say of another VNI ADD) from the socket does
   not proceed unless this walk is complete.

So for triggers where a bulk of L2VNI's are flapped, this results in
huge output buffer FIFO growth spiking up the memory in zebra since bgp
is slow/busy processing the first message.

To avoid this, idea is to hookup the VPN off the bgp_master struct and
maintain a VPN FIFO list which is processed later on, where we walk a
chunk of VPNs and do the remote route install.

Note: So far in the L3 backpressure cases(#15524), we have considered
the fact that zebra is slow, and the buffer grows in the BGP.

However this is the reverse i.e. BGP is very busy processing the first
ZAPI message from zebra due to which the buffer grows huge in zebra
and memory spikes up.

Ticket :#3864372

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
2024-12-09 08:46:16 -08:00
Rajasekar Raja 898852f269 bgpd : backpressure - Fix to pop items off zebra_announce FIFO for few EVPN triggers
In cases such as 'no advertise-all-vni' and L2 VNI DELETE, we need to
pop all the VPN routes present in the bgp_zebra_announce FIFO yet to
be processed regardless of VNI is configured or not.

NOTE: NO need to pop the VPN routes in two cases
 1) In free_vni_entry
   - Called by bgp_free()->bgp_evpn_cleanup().
   - Since bgp_delete is called before bgp_free and we pop all the dest
     pertaining to bgp under delete.
 2) evpn_delete_vni() when user configures "no vni" since the withdraw
    of all routes happen in normal cycle.

Fixes: a07df6f754
("bgpd : backpressure - Handle BGP-Zebra(EPVN) Install evt Creation")

Ticket :#4163611

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
2024-11-15 00:32:42 -08:00
Russ White 80dc863d92
Merge pull request #16946 from opensourcerouting/fix/match_src-peer
bgpd: Implement match src-peer ... command
2024-10-16 07:51:20 -04:00
Chirag Shah 3f00709a39 bgpd: fix evpn mh esi flap remove local routes
In symmetric routing, when local ESI is down,
the MH peer learnt local mac-ip
prefix is installed into teannt vrf (given l3vni).

When ESI is back up and associated to evi/vni then
remove the local synced mac-ip imported routes from the
tenant vrf as local neigh/arp is present.

Ticket: #3878699
Testing:

peer advertised mac-ip route:
*> [2]:[0]:[48]:[aa:aa:aa:00:00:01]:[32]:[45.0.0.51] RD 27.0.0.4:9
                    27.0.0.4 (spine-1)
                                                           0 64435 65016 i
                    ESI:03:44:38:39:ff:ff:01:00:00:01
                    RT:65016:1000 RT:65016:4000 ET:8 Rmac:44:38:39:ff:ff:16

When local ESI is flapped
torm-11:# ip neigh show 45.0.0.51
45.0.0.51 dev vlan1000 lladdr aa:aa:aa:00:00:01 REACHABLE proto zebra

Before fix:
(The imported route remained in tenant-vrf)
torm-11:# ip route show vrf vrf1 45.0.0.51
45.0.0.51 nhid 257 proto bgp metric 20

After fix:

torm-11# ip route show vrf vrf1 45.0.0.51
torm-11#

trace:
2024/10/11 18:19:29 BGP: [JMP3T-178G8] route [2]:[0]:[48]:[00:02:00:00:00:08]:[32]:[21.1.0.5]
is matched on local esi 03:00:00:00:77:01:04:00:00:0e, uninstall from VRF tenant1 route table

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2024-10-14 10:09:57 -07:00
Donatas Abraitis 419e024b3f bgpd: Add back pointer to source (from) peer in bgp_path_info struct
This is handy when you need to do source matching e.g. `match src-peer ...`
on outgoing direction with a route-map.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-09-27 22:53:46 +03:00
Russ White 1a2eaba14c
Merge pull request #16838 from opensourcerouting/fix/refresh_pr_9079
Refreshement of BGP multi ASNs
2024-09-24 10:01:10 -04:00
Donatas Abraitis cc7d3afdd5
Merge pull request #16848 from enkechen-panw/ecomm-val
bgpd: define val in ecommunity_val as uint8_t
2024-09-19 11:33:58 +02:00
sri-mohan1 8b590cf759 bgpd: changes for code maintainability
these changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2024-09-19 09:18:06 +05:30
Enke Chen 4b138bdd00 bgpd: define val in ecommunity_val as uint8_t
The type of the val field in ecommunity_val is used inconsistently
in a number of places. It should be defined as uint8_t.

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
2024-09-18 12:28:03 -07:00
Don Slice dc4440bdb2 bgpd: copy asn for prefixes imported as type5 from a vrf
When a prefix in a vrf is imported into evpn as a type5,
copy the asn of the source to make sure it is reflected
in the target vrf.

Ticket: cumuluslinux-2554562
Signed-off-by: Don Slice <dslice@nvidia.com>
2024-09-18 18:03:10 +03:00
Mark Stapp 0b10720b61 bgpd: fix duplicated test clause
Fix a duplicated test clause - cut-and-paste mistake, maybe?

Signed-off-by: Mark Stapp <mjs@cisco.com>
2024-09-03 16:11:17 -04:00
Louis Scalbert a152692f5a bgpd: fix labels static-analyser
Fix static-analyser warnings with BGP labels:

> $ scan-build make -j12
> bgpd/bgp_updgrp_packet.c:819:10: warning: Access to field 'extra' results in a dereference of a null pointer (loaded from variable 'path') [core.NullDereference]
>                                                 ? &path->extra->labels->label[0]
>                                                    ^~~~~~~~~

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-08-26 10:29:12 +02:00
Donatas Abraitis 5eb80edf97 bgpd: Free epvn_overlay memory on error
When parsing EVPN NLRIs, and an error occurred, do no forget to free the memory.

Fixes: 4ace11d010 ("bgpd: Move evpn_overlay to a pointer")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-08-24 11:58:48 +03:00
Donatas Abraitis 4ace11d010 bgpd: Move evpn_overlay to a pointer
Before this convertion:

```
	/* --- cacheline 3 boundary (192 bytes) --- */
	struct bgp_attr_encap_subtlv * encap_subtlvs;    /*   192     8 */
	struct bgp_attr_encap_subtlv * vnc_subtlvs;      /*   200     8 */
	struct bgp_route_evpn      evpn_overlay;         /*   208    36 */
```

After this convertion:

```
	/* --- cacheline 3 boundary (192 bytes) --- */
	struct bgp_attr_encap_subtlv * encap_subtlvs;    /*   192     8 */
	struct bgp_attr_encap_subtlv * vnc_subtlvs;      /*   200     8 */
	struct bgp_route_evpn *    evpn_overlay;         /*   208     8 */
```

Saving 28 bytes when EVPN is not used.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-08-11 13:59:13 +03:00
Donatas Abraitis 353efe7ae8
Merge pull request #16416 from raja-rajasekar/rajasekarr/fix_logs_bp
bgpd: backpressure - fix ret value and log err for evpn
2024-07-25 21:09:39 +03:00
Rajasekar Raja 40965e5999 bgpd: backpressure - Avoid use after free
Coverity complains there is a use after free (1598495 and 1598496)
At this point, most likely dest->refcount cannot go 1 and free up
the dest, but there might be some code path where this can happen.

Fixing this with a simple order change (no harm fix).

Ticket :#4001204

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
2024-07-22 10:16:16 -07:00
Rajasekar Raja c4bbb5b436 bgpd: backpressure - fix ret value evpn_route_select_install
The return value of evpn_route_select_install is ignored in all cases
except during vni route table install/uninstall and based on the
returned value, an error is logged. Fixing this.

Ticket :#3992392

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
2024-07-18 22:18:06 -07:00
Rajasekar Raja 4395fcd8e1 bgpd: backpressure - fix to properly remove dest for bgp under deletion
In case of imported routes (L3vni/vrf leaks), when a bgp instance is
being deleted, the peer->bgp comparision with the incoming bgp to remove
the dest from the pending fifo is wrong. This can lead to the fifo
having stale entries resulting in crash.

Two changes are done here.
 - Instead of pop/push items in list if the struct bgp doesnt match,
   simply iterate the list and remove the expected ones.

 - Corrected the way bgp is fetched from dest rather than relying on
   path_info->peer so that it works for all kinds of routes.

Ticket :#3980988

Signed-off-by: Chirag Shah <chirag @nvidia.com>
Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
2024-07-15 14:09:44 -07:00
Donatas Abraitis d4c577e483 bgpd: Move sticky, default_gw, router_flag into a single flags variable
Instead of using 3 uint8_t variables under struct attr, let's use a single
uint8_t as the flags. Saving 2-bytes. Not a big deal, but it's even easier to
track EVPN-related flags/variables.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-07-04 09:47:07 +03:00
Donatas Abraitis c9426177f6 bgpd: Drop memset() before encoding EVPN extended communities
memset() is already handled inside the helpers for a particular extended
community.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-07-02 18:35:48 +03:00
Piotr Suchy 8044d73300 bgpd: Ignore routes from evpn if VRF is unknown
Fix for a bug, where FRR fails to install route received for an unknown but later-created VRF - detailed description can be found here https://github.com/FRRouting/frr/issues/13708

Signed-off-by: Piotr Suchy <psuchy@akamai.com>
2024-06-24 20:27:58 +00:00
Donatas Abraitis 34a6e223fb
Merge pull request #16059 from kacpekwasny/kkwasny/CLIC-139-4
bgpd: fixed failing to remove VRF if there is a stale l3vni
2024-06-20 10:51:06 +03:00
Louis Scalbert ca32945b1f bgpd: move labels from extra to extra->labels
Move labels from extra to extra->labels. Labels are now stored in a hash
list.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-06-05 13:11:29 +02:00
Louis Scalbert a6de910448 bgpd: store number of labels with 8 bits
8 bits are sufficient to store the number of labels because the current
maximum is 2.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-06-05 13:11:29 +02:00
Louis Scalbert 64fe15fd28 bgpd: add bgp_path_info_num_labels()
Add bgp_path_info_num_labels() to get the number of labels stored in
a path_info structure.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-06-05 11:08:46 +02:00
Kacper Kwaśny 171d2583d0 bgpd: fixed failing remove of vrf if there is a stale l3vni
Problem statement:
==================
When a vrf is deleted from the kernel, before its removed from the FRR
config, zebra gets to delete the the vrf and assiciated state.

It does so by sending a request to delete the l3 vni associated with the
vrf followed by a request to delete the vrf itself.

2023/10/06 06:22:18 ZEBRA: [JAESH-BABB8] Send L3_VNI_DEL 1001 VRF
testVRF1001 to bgp
2023/10/06 06:22:18 ZEBRA: [XC3P3-1DG4D] MESSAGE: ZEBRA_VRF_DELETE
testVRF1001

The zebra client communication is asynchronous and about 1/5 cases the
bgp client process them in a different order.

2023/10/06 06:22:18 BGP: [VP18N-HB5R6] VRF testVRF1001(766) is to be
deleted.
2023/10/06 06:22:18 BGP: [RH4KQ-X3CYT] VRF testVRF1001(766) is to be
disabled.
2023/10/06 06:22:18 BGP: [X8ZE0-9TS5H] VRF disable testVRF1001 id 766
2023/10/06 06:22:18 BGP: [X67AQ-923PR] Deregistering VRF 766
2023/10/06 06:22:18 BGP: [K52W0-YZ4T8] VRF Deletion:
testVRF1001(4294967295)
.. and a bit later :
2023/10/06 06:22:18 BGP: [MRXGD-9MHNX] DJERNAES: process L3VNI 1001 DEL
2023/10/06 06:22:18 BGP: [NCEPE-BKB1G][EC 33554467] Cannot process L3VNI
1001 Del - Could not find BGP instance

When the bgp vrf config is removed later it fails on the sanity check if
l3vni is removed.

        if (bgp->l3vni) {
            vty_out(vty, "%% Please unconfigure l3vni %u\n",
                bgp->l3vni);
            return CMD_WARNING_CONFIG_FAILED;
        }

Solution:
=========
The solution is to make bgp cleanup the l3vni a bgp instance is going
down.

The fix:
========
The fix is to add a function in bgp_evpn.c to be responsible for for
deleting the local vni, if it should be needed, and call the function
from bgp_instance_down().

Testing:
========
Created a test, which can run in container lab that remove the vrf on
the host before removing the vrf and the bgp config form frr. Running
this test in a loop trigger the problem 18 times of 100 runs. After the
fix it did not fail.

To verify the fix a log message (which is not in the code any longer)
were used when we had a stale l3vni and needed to call
bgp_evpn_local_l3vni_del() to do the cleanup. This were hit 20 times in
100 test runs.

Signed-off-by: Kacper Kwasny <kkwasny@akamai.com>

bgpd: braces {} are not necessary for single line block

Signed-off-by: Kacper Kwasny <kkwasny@akamai.com>
2024-05-27 12:35:04 +02:00
Rajasekar Raja 920bf45e10 bgpd: backpressure - Fix to avoid CPU hog
In case when bgp_evpn_free or bgp_delete is called and the announce_list
has few items where vpn/bgp does not match, we add the item back to the
list. Because of this the list count is always > 0 thereby hogging CPU or
infinite loop.

Ticket: #3905624

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
2024-05-17 15:43:59 -07:00
Russ White 1c043440ea
Merge pull request #15572 from donaldsharp/best_path_stuff_sigh
bgp_process work
2024-04-16 07:52:09 -04:00
Donald Sharp c8e0ece39d bgpd: Convert int's to bool in a couple of spots
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-04-12 07:35:38 -04:00
Donald Sharp 9edf45b889 bgpd: Increase install/uninstall speed of evpn vpn vni's
BGP receives notification from zebra about an vpn that
needs to be installed into the evpn tables.  Unfortunately
this function was walking the entirety of evpn tables
3 times.  Modify the code to walk the tree 1 time and
to just look for the needed route types as you go.

This reduces, in a scaled environment, processing
time of the zclient_read function from 130 seconds
to 95 seconds.  For a up / down / up interface
scenario.

Signed-off-by: Rajasekar Raja <rajasekarr@vndia.com>
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-04-12 07:35:38 -04:00
Rajasekar Raja a07df6f754 bgpd : backpressure - Handle BGP-Zebra(EPVN) Install evt Creation
Current changes deals with EVPN routes installation to zebra.

In evpn_route_select_install() we invoke evpn_zebra_install/uninstall
which sends zclient_send_message().

This is a continuation of code changes (similar to
ccfe452763) but to handle evpn part
of the code.

Ticket: #3390099

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
2024-04-08 10:51:43 -07:00
Donald Sharp f3575f61c7 bgpd: Sort the bgp_path_info's
Currently bgp_path_info's are stored in reverse order
received.  Sort them by the best path ordering.

This will allow for optimizations in the future on
how multipath is done.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-04-01 14:54:02 -04:00
Donald Sharp 6ebb7add1f bgpd: Do not reap, schedule for deletion
Do not reap instead let's schedule for deletion
and let best_path_selection take care of the deletion
as it should.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-04-01 10:24:14 -04:00
Donald Sharp fca805972d bgpd: bgp_best_selection is inherently pi based
Currently evpn code calls bgp_best_selection for local
decisions for local tables to figure out what to do.
This is also pi based so let's note that the pi has
been changed before calling bgp_best_selection.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-04-01 10:24:14 -04:00
Donald Sharp ab49fc9c48 bgpd: Add pi to bgp_process
This will allow a consistency of approach to adding/removing
pi's to from the workqueue for processing as well as properly
handling the dest->info pi list more appropriately.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-04-01 10:24:14 -04:00
Donald Sharp f4fd5c8e36 bgpd: Modify update_evpn_type5_route_entry to include path_info pointer
Modify update_evpn_type5_route_entry to return a pointer to the
struct bgp_path_info modified in this function.  This code
merely follows the standards used in other bgp_evpn.c code
where the update function returns the pointer to the path
info.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-04-01 10:24:14 -04:00
Chirag Shah 5cb7712b3e bgpd:aggr summary-only remove suppressed from evpn
Ticket: #3534718 #3720960
Testing Done:

Config:
router bgp 65564 vrf sym_2
 bgp router-id 27.0.0.9
 !
 address-family ipv4 unicast
  redistribute static
 exit-address-family

vrf sym_2
 vni 8889
 ip route 63.2.1.0/24 blackhole
 ip route 63.2.1.2/32 blackhole
 ip route 63.2.1.3/32 blackhole
exit-vrf

tor-1:# vtysh -c "show bgp l2vpn evpn route" | grep -A3 63.2
*> [5]:[0]:[24]:[63.2.1.0] RD 27.0.0.9:19
                    27.0.0.9 (tor-1)
                                             0         32768 ?
                    ET:8 RT:28:8889 Rmac:44:38:39:ff:ff:29
--
*> [5]:[0]:[32]:[63.2.1.2] RD 27.0.0.9:19
                    27.0.0.9 (tor-1)
                                             0         32768 ?
                    ET:8 RT:28:8889 Rmac:44:38:39:ff:ff:29
*> [5]:[0]:[32]:[63.2.1.3] RD 27.0.0.9:19
                    27.0.0.9 (tor-1)
                                             0         32768 ?
                    ET:8 RT:28:8889 Rmac:44:38:39:ff:ff:29

tor-1(config)# router bgp 65564 vrf sym_2
tor-1(config-router)# address-family ipv4 unicast
tor-1(config-router-af)# aggregate-address 63.2.0.0/16 summary-only
tor-1(config-rou-f)# end

tor-1:# vtysh -c "show bgp l2vpn evpn route" | grep -A3 63.2.1
tor-1:# vtysh -c "show bgp l2vpn evpn route" | grep -A3 63.2
*> [5]:[0]:[16]:[63.2.0.0] RD 27.0.0.9:19
                    27.0.0.9 (tor-1)
                                             0         32768 ?
                    ET:8 RT:28:8889 Rmac:44:38:39:ff:ff:29

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2024-03-05 07:03:39 -08:00
Donatas Abraitis bfe52f8929
Merge pull request #15068 from chiragshah6/zdev
bgpd: lttng tp add ethtag to macip zebra send
2024-01-02 10:42:28 +02:00
Mark Stapp 39b8872941 bgpd: fix coverity warnings about evpn vpn variable
A few paths could see a vpn variable with a NULL value;
check and protect those paths.

Signed-off-by: Mark Stapp <mstapp@nvidia.com>
2023-12-27 18:01:36 -08:00
Chirag Shah fa00a2f765 bgpd: revamp evpn debugs nexthop and l3vni
Add nexthop fied when import/unimport evpn route in vrf,
print bgp vrf instance name which contains "VRF" keyword.

Include pathcount which is list of paths linked to nexthop.

add and delete l3vni to keep symmetric "L3VNI" keyword as
used in other debug statements.

Ticket: #3671288
Testing Done:

2023/12/27 05:10:03.339616 BGP: [HPE1G-3H7F2] ... new pi VRF vrf2
dest 0x55663e8372c0 (l 2) pi 0x55663e8374d0 (l 1, f 0x4010) nh 6.0.0.1

2023/12/27 05:58:56.650116 BGP: [MC0JJ-7ZYQB] ... delete pi VRF vrf2
dest 0x55663e885110 (l 5) pi 0x55663e8851e0 (l 1, f 0x4098) nh 6.0.0.1

2023/12/27 05:10:03.339581 BGP: [P4TBX-3W31N] evpn VRF vrf2 nh
6.0.0.1 rmac 00:02:00:00:00:04 add to zebra

2023/12/27 06:13:12.685906 BGP: [SWSCZ-2Z6M4] evpn vrf VRF vrf1 nh
6.0.0.1 del to zebra

2023/12/27 05:10:03.339603 BGP: [Y2EAK-4N7FV] path 60.1.1.111/32 linked
to VRF vrf2 nh 6.0.0.1 pathcount 0

2023/12/27 05:58:56.650125 BGP: [GVE17-CSNTB] path 81.1.1.0/24 unlinked
from VRF vrf2 nh 6.0.0.1 pathcount 16

2023/12/27 05:08:10.108038 ZEBRA: [Q8ZEK-CT776] Send L3VNI ADD 104001
VRF vrf1 RMAC 00:04:ba:10:10:62 VRR 1c:34:da:19:59:62 local-ip 6.0.0.31
filter none to bgp

2023/12/27 05:08:26.043121 ZEBRA: [R43YF-2MKZ3] Send L3VNI DEL 104001
VRF vrf1 to bgp

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2023-12-27 16:13:13 -08:00
Chirag Shah 7d168d9ef1 bgpd: check bgp evpn instance presence in soo
(pi=pi@entry=0x55e86ec1a5a0, evp=evp@entry=0x7fff4edc2160)
    at bgpd/bgp_evpn.c:3623
3623    bgpd/bgp_evpn.c: No such file or directory.
(gdb) info locals
bgp_evpn = 0x0
macvrf_soo = <optimized out>
ret = false
__func__ = <optimized out>

	(pi=pi@entry=0x55e86ec1a5a0, evp=evp@entry=0x7fff4edc2160)
    at bgpd/bgp_evpn.c:3623
	(bgp=bgp@entry=0x55e86e9cd010, afi=afi@entry=AFI_L2VPN,
    safi=safi@entry=SAFI_EVPN, p=p@entry=0x0,
	pi=pi@entry=0x55e86ec1a5a0, import=import@entry=1,
	in_vrf_rt=true,
    in_vni_rt=true) at bgpd/bgp_evpn.c:4200
	(import=1, pi=pi@entry=0x55e86ec1a5a0, p=p@entry=0x0,
    safi=safi@entry=SAFI_EVPN, afi=afi@entry=AFI_L2VPN,
	bgp=bgp@entry=0x55e86e9cd010) at bgpd/bgp_evpn.c:6266
	afi=afi@entry=AFI_L2VPN, safi=safi@entry=SAFI_EVPN,
    p=p@entry=0x7fff4edc2160, pi=pi@entry=0x55e86ec1a5a0)
	at bgpd/bgp_evpn.c:6266
	(peer=peer@entry=0x55e86ea35400, p=p@entry=0x7fff4edc2160,
    addpath_id=addpath_id@entry=0, attr=attr@entry=0x7fff4edc4400,
	afi=afi@entry=AFI_L2VPN, safi=<optimized out>,
    safi@entry=SAFI_EVPN, type=9, sub_type=0, prd=0x7fff4edc2120,
	label=0x7fff4edc211c, num_labels=1,
    soft_reconfig=0, evpn=0x7fff4edc2130) at bgpd/bgp_route.c:4805
	(peer=peer@entry=0x55e86ea35400, afi=afi@entry=AFI_L2VPN,
    safi=safi@entry=SAFI_EVPN, attr=attr@entry=0x7fff4edc4400,
	pfx=<optimized out>, psize=psize@entry=34,
    addpath_id=0) at bgpd/bgp_evpn.c:4922
	(peer=0x55e86ea35400, attr=0x7fff4edc4400, packet=<optimized out>,
    withdraw=0) at bgpd/bgp_evpn.c:5997
	(peer=peer@entry=0x55e86ea35400, attr=attr@entry=0x7fff4edc4400,
    packet=packet@entry=0x7fff4edc43d0,
	mp_withdraw=mp_withdraw@entry=0) at bgpd/bgp_packet.c:363
	(peer=peer@entry=0x55e86ea35400, size=size@entry=161)
    at bgpd/bgp_packet.c:2076
	(thread=<optimized out>) at bgpd/bgp_packet.c:2931

Ticket: #3683053

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2023-12-04 19:53:34 -08:00