Commit Graph

36576 Commits

Author SHA1 Message Date
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
Donatas Abraitis
d12306d3e0 bgpd: Do not scan update-groups if default-originate timer is set to 0
With lots of update-groups, subgroups, this could be very tricky and the timer
is spawned even if it's totally unnecessary (default-originate is not enabled).

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-09-02 15:02:10 +03:00
Donatas Abraitis
8412fa8f98 bgpd: Allow setting default-originate rescan to be up to 65535 seconds
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-09-02 14:58:10 +03:00
Jafar Al-Gharaibeh
745cd3e6bf
Merge pull request #16711 from donaldsharp/memory_type_stuff
Memory type stuff
2024-09-01 19:44:29 -04:00
Donatas Abraitis
b120c4f1aa bgpd: Print errors as error not as information when parsing OPEN message
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-09-01 22:42:54 +03:00
Donatas Abraitis
19a85c68bf bgpd: Do not send route-refresh if it wasn't negotiated in capabilities
Fixes: 04dfcb14ff ("bgpd: Deprecate Prestandard Route Refresh capability (128)")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-09-01 22:35:22 +03:00
Donatas Abraitis
2931b78537
Merge pull request #16698 from louis-6wind/fix-nhrp-redundancy
nhrpd, test: fix nhrp_redundancy topotest
2024-09-01 20:30:02 +03:00
Donald Sharp
d97c535c1e *: Create termtable specific temp memory
When trying to track down a MTYPE_TMP memory leak
it's harder to search for it when you happen to
have some usage of ttable_dump.  Let's just give
it it's own memory type so that we can avoid
confusion in the future.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-09-01 13:07:46 -04:00
Donald Sharp
a556f6e38b isisd: in isis_mt.c use appropriate memory allocator
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-09-01 13:07:39 -04:00
Donald Sharp
3bf359b04e
Merge pull request #16701 from Jafaral/unified-config
tests: detect all daemons correctly when using frr.conf
2024-08-31 08:56:55 -04:00
Jafar Al-Gharaibeh
0c14da4121
Merge pull request #16688 from donaldsharp/no_connected_nexthops_at_first
No connected/local/kernel nexthops at first
2024-08-30 17:36:17 -04:00
Donald Sharp
4dd9d1176f bgpd: Ensure evpn local table display shows route send status
evpn has a concept of `local` tables where the evpn routes
are actually converted into underlying routes/neighbor
table entries( or vice versa ).  Then this local route
is propagated to the global evpn l2vpn table and sent
to the peers.  Certain show commands in evpn look
operate on the local table but make the output look
like the data has not been sent to the peer.  This
is confusing for the operator.  Modify the code
such that local tables get a `Local BGP table not advertised`
in the place where the code talks about whom has received
the data or not.

Example:
torm11# show bgp l2vpn evpn route vni 1000 mac 8a:a1:cc:73:a3:ac ip 45.0.0.5
BGP routing table entry for [2]:[0]:[48]:[8a:a1:cc:73:a3:ac]:[32]:[45.0.0.5]
Paths: (2 available, best #2)
  Local BGP table not advertised
  Route [2]:[0]:[48]:[8a:a1:cc:73:a3:ac]:[32]:[45.0.0.5] VNI 1000
  Imported from 192.168.100.18:2:[2]:[0]:[48]:[8a:a1:cc:73:a3:ac]:[32]:[45.0.0.5], VNI 1000
  65101 65005
    192.168.100.18(leaf2) from leaf2(192.168.5.1) (192.168.100.14)
      Origin IGP, valid, external
      Extended Community: RT:65005:1000 ET:8
      Last update: Thu Mar 21 14:29:04 2024
  Route [2]:[0]:[48]:[8a:a1:cc:73:a3:ac]:[32]:[45.0.0.5] VNI 1000
  Imported from 192.168.100.18:2:[2]:[0]:[48]:[8a:a1:cc:73:a3:ac]:[32]:[45.0.0.5], VNI 1000
  65101 65005
    192.168.100.18(leaf1) from leaf1(192.168.1.1) (192.168.100.13)
      Origin IGP, valid, external, bestpath-from-AS 65101, best (Router ID)
      Extended Community: RT:65005:1000 ET:8
      Last update: Thu Mar 21 14:29:04 2024

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-08-30 16:23:20 -04:00
Jafar Al-Gharaibeh
02256fd23b tests: detect all daemons correctly when using frr.conf
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2024-08-30 14:35:31 -05:00
Louis Scalbert
64ad1dca42 tests: use private addresses in nhrp_redundancy
Use private addresses in nhrp_redundancy.

> cd tests/topotests/nhrp_redundancy
> git grep 176.16  | cut -f1 -d: | uniq | xargs -L1 sed -e 's|176.16|172.16|g' -i
> git grep 5.5.5.  | cut -f1 -d: | uniq | xargs -L1 sed -e 's|5.5.5.|10.5.5.|g' -i
> git grep 4.4.4  | cut -f1 -d: | uniq | xargs -L1 sed -e 's|4.4.4.|10.4.4.|g' -i

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-08-30 14:59:22 +02:00
Louis Scalbert
94ba96747b tests: check show ip nhrp shorcut in nhrp_redundancy
Check show ip nhrp shorcut in nhrp_redundancy

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-08-30 14:59:22 +02:00
Louis Scalbert
cdd9dee9b8 nhrpd: fix show nhrp shortcut json
Fix show nhrp shortcut json

Fixes: 87b9e98203 ("nhrpd: add json support to show nhrp vty commands")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-08-30 14:59:22 +02:00
Louis Scalbert
25e10819e3 tests: fix iptables command in nhrp_redundancy
Replace --nflog-range argument by --nflog-range due to:

> 2024-08-30 10:44:54,816 INFO: topo: input: iptables -A FORWARD -i nhs3-gre0 -o nhs3-gre0 -m hashlimit --hashlimit-upto 4/minute --hashlimit-burst 1 --hashlimit-mode srcip,dstip --hashlimit-srcmask 24 --hashlimit-dstmask 24 --hashlimit-name loglimit-0 -j NFLOG --nflog-group 1 --nflog-range 128
> 2024-08-30 10:44:54,819 INFO: topo: output: warn: --nflog-range has never worked and is no longer supported, please use --nflog-size insted

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-08-30 14:59:22 +02:00
Louis Scalbert
2933d7f236 tests: fix nhs1 down check in nhrp_redundancy
Fully check the NHRP convergence after setting nhs1 down. Otherwise the
ping may pass because the previous shortcut is still present.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-08-30 14:59:22 +02:00
Louis Scalbert
432b60d194 tests: fix nhc1 route check after nhs1 down
After setting down nhs1, the test is checking that nhc1 routing table
matches routes in nhc1/nhrp_route.json. It is incorrect because it
checks that the NHRP route to nhs1 is still present but it should have
disappeared.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-08-30 14:59:22 +02:00