Commit Graph

643 Commits

Author SHA1 Message Date
Carmine Scarpitta
29729027de bgpd: Use IPV6_MAX_BITLEN when deleting SRv6 VPN6 SIDs
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-11-03 08:54:43 +01:00
Carmine Scarpitta
688aaa4e62 bgpd: Use IPV6_MAX_BITLEN when deleting SRv6 VPN4 SIDs
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-11-03 08:54:32 +01:00
Carmine Scarpitta
d3a9fe9993 bgpd: Use IPV6_MAX_BITLEN when deleting SRv6 functions
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-11-03 08:54:03 +01:00
Mikhail Sokolovskiy
7b1c0c23fc bgpd: add bgp ipv6-auto-ra command
Introduce a command to stop bgpd from enabling IPv6 router advertisement
messages sending on interfaces.

Signed-off-by: Mikhail Sokolovskiy <sokolmish@gmail.com>
2024-09-24 19:00:11 +03:00
Enke Chen
3c433ae558 bgpd: fix misplaced arguments in bgp_redistribute_add()
Fix the misplaced arguments "bhtype" and "api.distance" in
bgp_redistribute_add().

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
2024-09-19 08:52:35 -07:00
Russ White
5d9ddcce7c
Merge pull request #15676 from cscarpitta/bgp-srv6-sid-manager
bgpd: Extend BGP to communicate with the SRv6 SID Manager to allocate/release SRv6 SIDs
2024-09-05 11:40:48 -04:00
Donatas Abraitis
befffb2d51 bgpd: Retry connecting to label manager if failed
Fixes: https://github.com/FRRouting/frr/issues/16747

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-09-05 12:35:51 +03:00
Philippe Guibert
f686609386 bgpd: add locator name in sid notify messages
In the near future, some daemons may only register SIDs. This may be
the case for the pathd daemon when creating SRv6 binding SIDs.

When a locator is getting deleted at ZEBRA level, the daemon may have
an easy way to find out the SIds to unregister to.

This commit proposes to add the locator name to the SID_SRV6_NOTIFY
message whenever possible. Only case when an allocation failure happens,
the locator will not be present. In all other places, the notify API
at procol levels has the locator name extra-parameter.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-09-05 10:59:59 +02:00
Carmine Scarpitta
7a2e64e663 bgpd: Receive SRv6 SIDs notification from zebra
Zebra sends a `SRV6_SID_NOTIFY` notification to inform clients about the
result of a SID alloc/release operation.  This commit adds a handler to
process a `SRV6_SID_NOTIFY` notification received from zebra.

If the notification indicates that a SID allocation operation was
successful, then it stores the allocated SID in the SRv6 database,
installs the SID into the RIB, and advertises the SID to the other BGP
routers.

If the notification indicates that an operation has failed, it logs the
error.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-09-05 10:59:59 +02:00
Carmine Scarpitta
b0be30bbef bgpd: Add API to get/release SRv6 SIDs
Add an API to get/release SRv6 SIDs through the SRv6 SID Manager.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-09-05 10:59:59 +02:00
Carmine Scarpitta
8b0fb91865 bgpd: Receive SRv6 locator info from zebra
This commit extends BGP to process locator information received from
SRv6 Manager (zebra) and save the locator info in the SRv6 database.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-09-05 10:59:59 +02:00
Carmine Scarpitta
fe5037b703 bgpd: Deal with SRv6 locator instead of chunk
Currently, when SRv6 is enabled in BGP, BGP requests a locator chunk
from Zebra. Zebra assigns a locator chunk to BGP, and then BGP can
allocate SIDs from the locator chunk.

Recently, the implementation of SRv6 in Zebra has been improved, and a
new API has been introduced for obtaining/releasing the SIDs.

Now, the daemons no longer need to request a chunk.

Instead, the daemons interact with Zebra to obtain information about the
locator and subsequently to allocate/release the SIDs.

This commit extends BGP to use the new SRv6 API. In particular, it
removes the chunk throughout the BGP code and modifies BGP to
request/save/advertise the locator instead of the chunk.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-09-05 10:59:59 +02:00
Carmine Scarpitta
c50b4b9afc bgpd: Add API to get SRv6 locator info
Add an API to request information from the SRv6 SID Manager (zebra)
regarding a specific SRv6 locator.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-09-05 10:59:59 +02: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
Jafar Al-Gharaibeh
0097489b4a Revert "Merge pull request #15614 from louis-6wind/fix-6pe-address"
This reverts commit b3600d82dc, reversing
changes made to 51119823d0.
2024-08-21 13:37:43 -05: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
Russ White
ea5498ec5a
Merge pull request #16403 from lsang6WIND/vpn_leak_label
bgpd: fix label lost when vrf loopback comes back
2024-07-23 10:54:12 -04:00
Rajasekar Raja
6cf5b79311 bgpd: backpressure - log error for evpn when route install to zebra fails.
log error for evpn in case route install to zebra fails.

Ticket :#3992392

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
2024-07-18 22:23:23 -07:00
Loïc Sang
c21c597d5d bgpd: do not update leak label at loopback up down
The up/down state of the lo loopback interface does not determine the
availability of the default vrf-lite.

Do not update leak label at lo loopback up/down change.

Fixes: b45c5cd959 ("bgpd: update route leak when vrf state changes")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
Signed-off-by: Loïc Sang <loic.sang@6wind.com>
2024-07-17 15:42:12 +02:00
Donatas Abraitis
16bfdf58f7 bgpd: Print tableid when sending (add/remove) routes to Zebra
In case this is used under `set table X` via route-maps, it's good to know
in debugs the table id.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-07-07 18:49:53 +03:00
Donatas Abraitis
d7144594ca bgpd: Drop unnecessary is_add check for bgp_zebra_announce_actual()
Fixes: ccfe452763 ("bgpd : backpressure - Handle BGP-Zebra Install evt Creation")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-07-07 18:49:29 +03:00
vivek
c30b683338 bgpd: Refine debug logs for zebra GR registration
Signed-off-by: Vivek Venkatraman <vivek@nvidia.com>
2024-07-01 13:02:52 -07:00
Philippe Guibert
d4390fc217 bgpd: fix do not use api.backup_nexthop in ZAPI message
The backup_nexthop entry list has been populated by mistake,
and should not. Fix this by reverting the introduced behavior.

Fixes: 237ebf8d45 ("bgpd: rework bgp_zebra_announce() function, separate nexthop handling")

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-06-20 18:19:43 +02:00
Donatas Abraitis
994792bace
Merge pull request #16234 from chiragshah6/fdev2
bgpd: backpressure - fix evpn route sync to zebra
2024-06-20 08:03:42 +03:00
Chirag Shah
b47a92e2e5 bgpd: backpressure - fix evpn route sync to zebra
In scaled EVPN + ipv4/ipv6 uni route sync to zebra,
some of the ipv4/ipv6 routes skipped reinstallation
due to incorrect local variable's stale value.

Once the local variable value reset in each loop
iteration all skipped routes synced to zebra properly.

Ticket: #3948828

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
Signed-off-by: Chirag Shah <chirag@nvidia.com>
2024-06-18 19:41:38 -07:00
Donald Sharp
d10bd26e80 bgpd: Convert over to using vrf name instead of id
Use the name for when putting out debugs in bgp_zebra.c.
Additionally add an evpn flag for announce_route_actual.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-06-18 16:00:42 -04: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
Louis Scalbert
747da057e8 bgpd: check and set extra num_labels
The handling of MPLS labels in BGP faces an issue due to the way labels
are stored in memory. They are stored in bgp_path_info but not in
bgp_adj_in and bgp_adj_out structures. As a consequence, some
configuration changes result in losing labels or even a bgpd crash. For
example, when retrieving routes from the Adj-RIB-in table
("soft-reconfiguration inbound" enabled), labels are missing.

bgp_path_info stores the MPLS labels, as shown below:

> struct bgp_path_info {
>   struct bgp_path_info_extra *extra;
>   [...]
> struct bgp_path_info_extra {
>	mpls_label_t label[BGP_MAX_LABELS];
>	uint32_t num_labels;
>   [...]

To solve those issues, a solution would be to set label data to the
bgp_adj_in and bgp_adj_out structures in addition to the
bgp_path_info_extra structure. The idea is to reference a common label
pointer in all these three structures. And to store the data in a hash
list in order to save memory.

However, an issue in the code prevents us from setting clean data
without a rework. The extra->num_labels field, which is intended to
indicate the number of labels in extra->label[], is not reliably checked
or set. The code often incorrectly assumes that if the extra pointer is
present, then a label must also be present, leading to direct access to
extra->label[] without verifying extra->num_labels. This assumption
usually works because extra->label[0] is set to MPLS_INVALID_LABEL when
a new bgp_path_info_extra is created, but it is technically incorrect.

Cleanup the label code by setting num_labels each time values are set in
extra->label[] and checking extra->num_labels before accessing the
labels.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-06-05 11:08:46 +02:00
Rajasekar Raja
f4ba47238e bgpd: backpressure - Fix to withdraw evpn type-5 routes immediately
As part of backpressure changes, there is a bug where immediate withdraw
is to be sent for evpn imported type-5 prefix to clear the nh neigh and
RMAC entry.

Fixing this by sending withdraw immediately to keep it inline with the
code today

Ticket: #3905571

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
2024-05-17 12:42:30 -07:00
Donatas Abraitis
b3600d82dc
Merge pull request #15614 from louis-6wind/fix-6pe-address
bgpd: fix ipv4-mapped ipv6 on non 6pe
2024-05-10 22:55:12 +03:00
Donatas Abraitis
a8db605731 bgpd: Remove redundant recursion flag variable
Reuse an existing one.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-05-08 17:02:15 +03:00
Carmine Scarpitta
bdc2c7bc54 bgpd: Fix the order of NULL check and ZAPI decode
When BGP receives an SRV6_LOCATOR_ADD message from zebra, it calls the
`bgp_zebra_process_srv6_locator_add()` function to process the message.
`bgp_zebra_process_srv6_locator_add()` decodes the message first, and
then if the pointer to the default BGP instance is NULL (i.e. the
default BGP instance is not configured yet), it returns early without
doing anything and without using the decoded message information.

This commit fixes the order of the operations executed by
`bgp_zebra_process_srv6_locator_add()`. We first ensure that the default
BGP instance is ready and we return early if it is not. Then, we decode
the message and do something with the information contained in it.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-05-05 07:25:57 +02:00
Carmine Scarpitta
ae3241b96d bgpd: Fix crash when deleting the SRv6 locator
When BGP receives a `SRV6_LOCATOR_DEL` from zebra, it invokes
`bgp_zebra_process_srv6_locator_delete` to process the message.

`bgp_zebra_process_srv6_locator_delete` obtains a pointer to the default
BGP instance and then dereferences this pointer.

If the default BGP instance is not ready / not configured yet, this
pointer this pointer is `NULL` and dereferencing it causes BGP to crash.

This commit fix the issue by adding a a check to verify if the pointer
is `NULL` and returning early if it is.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-05-03 23:40:29 +02:00
Russ White
1a9c3a710d
Merge pull request #15782 from opensourcerouting/fix/drop_srte_color_flag
bgpd: Drop SRTE_COLOR attribute flag
2024-04-27 08:19:09 -04:00
Louis Scalbert
ee0378cdbb bgpd: fix removing ipv6 global nexhop
When the IPv6 global is removed on an interface towards a peer, the
IPv6 nexthop global that is sent is a IPv4-mapped IPv6 address. It
should be the link-local.

At removal, replace the global by the next global address or the
link-local as last resort.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-04-23 11:28:36 +02:00
Louis Scalbert
fc1dd2e506 bgpd: optimize bgp_interface_address_del
Move common checks outside of the loop.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-04-23 11:28:36 +02:00
Louis Scalbert
424fe0bf80 bgpd: fix sending ipv6 local nexthop if global present
bgpd keeps on advertising IPv6 prefixes with a IPv6 link-local nexthop
after a valid IPv6 global appears.

At bgpd startup, the IPv6 global is announced by zebra after the
link-local. Only the link-local is advertised. Clearing the BGP sessions
make the global to to be announced.

Update the nexthops with the global IPv6 when available.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-04-23 11:26:49 +02:00
Louis Scalbert
b083885198 bgpd: log new ipv6 global in bgp_interface_address_add
Log new IPv6 global address in bgp_interface_address_add

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-04-23 11:26:49 +02:00
Louis Scalbert
778e0df87b bgpd: reduce bgp_interface_address_add indentation
Reduce bgp_interface_address_add indentation

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-04-23 11:26:49 +02:00
Louis Scalbert
8599fe2b5e bgpd: optimize bgp_interface_address_add
Move common checks outside of the loop.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-04-23 11:26:49 +02:00
Donatas Abraitis
a988a0a88a *: Use uint64_t for weight down the path to Zebra
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-04-22 17:50:08 +03:00
Donatas Abraitis
619321de78 bgpd: Drop SRTE_COLOR attribute flag
SRTE_COLOR is not defined at all as an attribute, it was a mistake from the
beginning.

SRTE_COLOR is extended community, can't see the reason having it as a community,
and a separate attribute.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-04-17 22:50:44 +03: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
Rajasekar Raja
ed7005d0ed zebra: backpressure - Fix Null ptr access (Coverity Issue)
Fix dereferencing NULL ptr making coverity happy.

Ticket :#3390099

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
2024-04-12 09:48:00 -07:00
Donatas Abraitis
0a0ec0e165
Merge pull request #15624 from raja-rajasekar/rajasekarr/backpressure_bgp_zebra_client_EVPN
bgpd : backpressure - Handle BGP-Zebra(EPVN) Install evt Creation
2024-04-10 08:22:25 +03: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
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