Commit Graph

37295 Commits

Author SHA1 Message Date
Donatas Abraitis
ebfcbbcc89
Merge pull request #16220 from donaldsharp/zebra_fpm_backpressure
Zebra fpm backpressure
2024-09-06 09:28:24 +03:00
sri-mohan1
53819c298b babeld: 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-06 07:02:51 +05:30
Donald Sharp
340d51fc3a
Merge pull request #16751 from opensourcerouting/fix/solo_peer-group
bgpd: Some peer-groups related changes/fixes
2024-09-05 17:42:20 -04:00
Donald Sharp
98b11de9f6 zebra: Modify show zebra dplane providers to give more data
The show zebra dplane provider command was ommitting
the input and output queues to the dplane itself.
It would be nice to have this insight as well.

New output:
r1# show zebra dplane providers
dataplane Incoming Queue from Zebra: 100
Zebra dataplane providers:
  Kernel (1): in: 6, q: 0, q_max: 3, out: 6, q: 14, q_max: 3
  dplane_fpm_nl (2): in: 6, q: 10, q_max: 3, out: 6, q: 0, q_max: 3
dataplane Outgoing Queue to Zebra: 43
r1#

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-09-05 15:52:05 -04:00
Donald Sharp
8926ac1984 zebra: Limit queue depth in dplane_fpm_nl
The dplane providers have a concept of input queues
and output queues.  These queues are chained together
during normal operation.  The code in zebra also has
a feedback mechanism where the MetaQ will not run when
the first input queue is backed up.  Having the dplane_fpm_nl
code grab all contexts when it is backed up prevents
this system from behaving appropriately.

Modify the code to not add to the dplane_fpm_nl's internal
queue when it is already full.  This will allow the backpressure
to work appropriately in zebra proper.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-09-05 15:52:05 -04:00
Donald Sharp
3af381b502 zebra: Modify dplane loop to allow backpressure to filter up
Currently when the dplane_thread_loop is run, it moves contexts
from the dg_update_list and puts the contexts on the input queue
of the first provider.  This provider is given a chance to run
and then the items on the output queue are pulled off and placed
on the input queue of the next provider.  Rinse/Repeat down through
the entire list of providers.  Now imagine that we have a list
of multiple providers and the last provider is getting backed up.
Contexts will end up sticking in the input Queue of the `slow`
provider.  This can grow without bounds.  This is a real problem
when you have a situation where an interface is flapping and an
upper level protocol is sending a continous stream of route
updates to reflect the change in ecmp.  You can end up with
a very very large backlog of contexts.  This is bad because
zebra can easily grow to a very very large memory size and on
restricted systems you can run out of memory.  Fortunately
for us, the MetaQ already participates with this process
by not doing more route processing until the dg_update_list
goes below the working limit of dg_updates_per_cycle.  Thus
if FRR modifies the behavior of this loop to not move more
contexts onto the input queue if either the input queue
or output queue of the next provider has reached this limit.
FRR will naturaly start auto handling backpressure for the dplane
context system and memory will not go out of control.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-09-05 15:44:34 -04:00
Donald Sharp
34670c476a zebra: Use the ctx queue counters
The ctx queue data structures already have a counter
associated with them.  Let's just use them instead.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-09-05 15:44:34 -04:00
Donald Sharp
ade1d8a211
Merge pull request #16752 from opensourcerouting/skip_scale_on_32bit
tests: Skip bgp_l3vpn vrf tests on 32bit systems
2024-09-05 13:45:19 -04: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
Martin Winter
97f14c5e5e
tests: Skip bgp_l3vpn vrf tests on 32bit systems
Tests may fail because of limited memory on 32bit system

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
2024-09-05 15:57:35 +02:00
Donatas Abraitis
b63315f15d tests: Check if we can use solo with a peer-group
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-09-05 16:31:36 +03:00
Donatas Abraitis
9de74cf0be bgpd: Show what is the real type of the peer-group
```
ton# sh ip bgp peer-group

BGP peer-group pg-a
  Peer-group type is auto
  Configured address-families: IPv4 Unicast;

BGP peer-group pg-e, remote AS 0
  Peer-group type is external
  Configured address-families: IPv4 Unicast;

BGP peer-group pg-i, remote AS 65001
  Peer-group type is internal
  Configured address-families: IPv4 Unicast;
ton#
```

`auto` should be handled accordingly.

Fixes: 0dfe25697f ("bgpd: Implement neighbor X remote-as auto")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-09-05 15:48:14 +03:00
Mark Stapp
7fef8d39b5
Merge pull request #16749 from opensourcerouting/fix/issue_16747
bgpd: Retry connecting to label manager if failed
2024-09-05 08:21:54 -04:00
Donatas Abraitis
b9d4191a51 bgpd: Allow using solo for peer-groups
Inherit solo flag for peer-group members also.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-09-05 15:16:05 +03:00
Donatas Abraitis
014acb15d6 tests: Add valid, bestpath, and selectionReason to JSON files
They are expected in router_vrf_json_cmp_exact_filter(), because it has
exact=True.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-09-05 12:49:42 +03: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
8227268b8c bgpd: Cleanup related to SRv6
Remove unused SRv6 code.

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
7a9f26c794 bgpd: Make sid_register() non-static
Make the `sid_register()` function non-static to allow other BGP modules
(e.g. bgp_zebra.c) to register SIDs.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-09-05 10:59:59 +02:00
Carmine Scarpitta
2ed0ebdb02 bgpd: Request SRv6 SIDs to SID Manager
Currently, BGP allocates SIDs without interacting with Zebra.

Recently, the SRv6 implementation has been improved. Now, the daemons
need to interact with Zebra through ZAPI to obtain and release SIDs.

This commit extends BGP to request SIDs from Zebra instead of allocating
the SIDs on its own.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-09-05 10:59:59 +02:00
Carmine Scarpitta
831b825b89 bgpd: Release SIDs when disabling SRv6 in BGP
When SRv6 VPN is unconfigured in BGP, BGP needs to interact with SID Manager to
release the SID and make it available to other daemons

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
Donatas Abraitis
34f7a5730b tests: Check if VPN routes can be imported with a next-hop in a default VRF
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-09-05 11:38:07 +03:00
Donatas Abraitis
93fd9cbb50 bgpd: Validate imported routes next-hop that is in a default VRF
Without this patch:

```
r1# sh ip bgp vrf CUSTOMER-A
BGP table version is 1, local router ID is 20.20.20.0, vrf id 4
Default local pref 100, local AS 65000
Status codes:  s suppressed, d damped, h history, u unsorted, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
     192.168.2.0/24   192.168.179.5@0<
                                             0             0 479 ?

Displayed 1 routes and 1 total paths
r1#
```

This is because the route is imported, next-hop is in a default VRF, and we should
evaluate an ultimate path info, not the current path info.

After:

```
r1# sh ip bgp vrf CUSTOMER-A
BGP table version is 1, local router ID is 20.20.20.0, vrf id 4
Default local pref 100, local AS 65000
Status codes:  s suppressed, d damped, h history, u unsorted, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>  192.168.2.0/24   192.168.179.5@0<
                                             0             0 479 ?

Displayed 1 routes and 1 total paths
r1#
```

In both cases next-hop in cache table is valid:

```
r1# sh ip bgp nexthop
Current BGP nexthop cache:
 192.168.179.5 valid [IGP metric 0], #paths 2, peer 192.168.179.5
  Resolved prefix 192.168.179.0/24
  if r1-eth0
  Last update: Thu Sep  5 11:24:37 2024
r1#
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-09-05 11:24:53 +03:00
Donatas Abraitis
356f92b8c1 bgpd: Show the resolved prefix in debug when checking next-hop tracking
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-09-05 10:13:43 +03:00
Jafar Al-Gharaibeh
2054b49c40 tests: nhrp, use unified config, remove misleading error log
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2024-09-05 00:00:52 -05:00
Donatas Abraitis
4f185c5c9d
Merge pull request #16743 from lsang6WIND/vpn_leak_label
bgpd: remove redundant loopback check in label update
2024-09-04 13:34:12 +03:00
Loïc Sang
d173522bbf bgpd: remove redundant loopback check in label update
The "if_is_vrf" check is unnecessary because it’s already handled by
"if_get_vrf_loopback". Additionally, it ignores the default loopback and
could introduce potential bugs.

Fixes: 8b81f32e97 ("bgpd: fix label lost when vrf loopback comes back")
Signed-off-by: Loïc Sang <loic.sang@6wind.com>
2024-09-04 09:37:08 +02:00
Donatas Abraitis
3ae49f732c
Merge pull request #16724 from cscarpitta/fix/fix-srv6-frr-config
isisd: Add missing `exit` statement to `show running-config` output
2024-09-04 08:15:24 +03:00
Donatas Abraitis
3dbef7a119
Merge pull request #16733 from gtataranni/fix/regex-string
tools: fix invalid escape on regex string
2024-09-04 08:13:19 +03:00
Donatas Abraitis
40a47a92f4
Merge pull request #16736 from mjstapp/fix_bgp_evpn_if_clause
bgpd: fix duplicated test clause
2024-09-04 08:12:26 +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
Giovanni Tataranni
fe9e148aaa tools: fix invalid escape on regex string
fix usage of regex string without proper escaping

Signed-off-by: Giovanni Tataranni <g.tataranni@gmail.com>
2024-09-03 19:14:45 +02:00
Louis Scalbert
f1bc6c5d81 isisd: fix crash when reading asla
isisd is crashing when reading a ASLA sub-TLV with Application
Identifier Bit Mask length greater than 1 octet.

Set a limit of 8 bytes in accordance with RFC9479 and check that the
received value does not exceed the limit.

Reported-by: Iggy Frankovic <iggyfran@amazon.com>
Link: https://www.rfc-editor.org/rfc/rfc9479.html#name-application-identifier-bit-
Fixes: 5749ac83a8 ("isisd: add ASLA support")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-09-03 17:30:41 +02:00
Russ White
7ba895f685
Merge pull request #16712 from opensourcerouting/fix/do_not_send_route_refresh_if_no_capability
bgpd: Do not send route-refresh if it wasn't negotiated in capabilities
2024-09-03 10:57:09 -04:00
Russ White
2446c63c28
Merge pull request #16667 from louis-6wind/fix-isis-link-params-circuit-up
isisd: fix update link params after circuit is up
2024-09-03 10:55:39 -04:00
Donald Sharp
1e32a3098c
Merge pull request #16713 from opensourcerouting/fix/bgpd_parse_received_err
bgpd: Print errors as error not as information when parsing OPEN message
2024-09-03 10:36:16 -04:00
Russ White
8287c0b316
Merge pull request #15605 from donaldsharp/evpn_local_table_warning
bgpd: Ensure evpn local table display shows route send status
2024-09-03 10:19:34 -04:00
Jafar Al-Gharaibeh
66144d34b2
Merge pull request #16725 from chiragshah6/bgp_dev1
bgpd: fix proper json format for unicast statistics for non exists vrf
2024-09-03 10:02:01 -04:00
Donatas Abraitis
5b24d3b223 bgpd: Turn off default-originate timer
If the neighbor is not configured with `neighbor X default-originate route-map ...`,
then this timer is useless.

Change the logic to be it disabled by default, but enabled automatically once the
route-map is configured for default-originate command.

Automatically assigned timer value is as before, 5 seconds.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-09-03 16:09:26 +03:00
Donald Sharp
1e2ccf1697
Merge pull request #16726 from LabNConsulting/native-munet-topotest
fix native munet topotest
2024-09-03 07:15:32 -04:00
Christian Hopps
a88f3c2d1c tests: improve example munet test
Signed-off-by: Christian Hopps <chopps@labn.net>
2024-09-03 00:45:55 -04:00
Christian Hopps
08253740ef tests: fix munet native topotest runs
Enabe/fix using a munet.yaml config file for topology configuration.
Easier test writing.

This also uses the standard `frrinit.sh` to launch and teardown
FRR, so we actually test what most users use.

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-09-03 00:45:48 -04:00
Sindhu Parvathi Gopinathan
40c0b891e3 bgpd: fix proper json format for unicast statistics for non exists vrf
Ticket: #4060069

show bgp vrf afi unicast statistics json output is not return in json
format for non exists vrf.

Fix:
Json output is formatted for non exists vrf cases.

Command supported:

```
show bgp vrf <VRFNAME> ipv4/ipv6 unicast statistics json
show bgp vrf <VRFNAME> l2vpn evpn statistics json
```

Before Fix:

```
leaf11#
leaf11# show bgp vrf test ipv4 unicast statistics json
View/Vrf test is unknown
leaf11#
leaf11#
leaf11# show bgp vrf test ipv6 unicast statistics json
View/Vrf test is unknown
leaf11#
leaf11#
leaf11# show bgp vrf default1 l2vpn evpn statistics json
View/Vrf default1 is unknown
leaf11#

```

After Fix:

```
leaf11#
leaf11# show bgp vrf test ipv4 unicast statistics json
{
  "warning":"View/Vrf is unknown"
}
leaf11#
leaf11#
leaf11# show bgp vrf test ipv6 unicast statistics json
{
  "warning":"View/Vrf is unknown"
}
leaf11#
leaf11# show bgp vrf default1 l2vpn evpn statistics json
{
  "warning":"View/Vrf is unknown"
}
leaf11#
```

Ticket: #4060069

Signed-off-by: Sindhu Parvathi Gopinathan's <sgopinathan@nvidia.com>
2024-09-02 17:22:01 -07:00
Carmine Scarpitta
8be8864ffd isisd: Add missing exit statement
Add missing `exit` statement to `show running-config` output.

```
router isis ISIS_CORE
 is-type level-2-only
 net 49.0001.0000.0000.0004.00
 lsp-mtu 1300
 topology ipv6-unicast
 log-adjacency-changes
 segment-routing srv6
  locator ISIS_LOC
 exit   <<<<<<<<<<<<<<<<<<<<<<<<
exit
```

Fixes https://github.com/FRRouting/frr/issues/16694

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-09-03 00:03:32 +02:00
Donatas Abraitis
4788206b16 bgpd: Drop unused route-map types
When applying the route-map, we always set rmap_type to know who triggered
this action. PEER_RMAP_TYPE_IMPORT/EXPORT was used as a dead-code, and
PEER_RMAP_TYPE_NOSET not used at all.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-09-02 15:32:00 +03:00