]> git.puffer.fish Git - matthieu/frr.git/log
matthieu/frr.git
10 months agoMerge pull request #16230 from zhou-run/202406171103
Russ White [Tue, 18 Jun 2024 15:20:13 +0000 (11:20 -0400)]
Merge pull request #16230 from zhou-run/202406171103

isisd: After the router switches IS-IS type several times, the neighbor adjacency cannot be established.

10 months agoMerge pull request #16236 from opensourcerouting/fix/recursive_weighted_ecmp
Russ White [Tue, 18 Jun 2024 15:14:00 +0000 (11:14 -0400)]
Merge pull request #16236 from opensourcerouting/fix/recursive_weighted_ecmp

zebra: Set the weight for non-recursive next-hop

10 months agoMerge pull request #16153 from pguibert6WIND/bgp_recursive_duplicate
Russ White [Tue, 18 Jun 2024 15:00:41 +0000 (11:00 -0400)]
Merge pull request #16153 from pguibert6WIND/bgp_recursive_duplicate

bgpd: fix do not skip paths with same nexthop

10 months agoMerge pull request #16172 from LabNConsulting/dleroy/nhrpd-auth-support
Russ White [Tue, 18 Jun 2024 14:04:24 +0000 (10:04 -0400)]
Merge pull request #16172 from LabNConsulting/dleroy/nhrpd-auth-support

nhrpd: add cisco-authentication password support

10 months agoMerge pull request #16179 from pguibert6WIND/isis_psid_and_backup
Russ White [Tue, 18 Jun 2024 13:58:47 +0000 (09:58 -0400)]
Merge pull request #16179 from pguibert6WIND/isis_psid_and_backup

isisd: fix 'show isis route prefix-sid backup' command

10 months agoMerge pull request #16194 from opensourcerouting/fix/bfd_profile_shutdown
Russ White [Tue, 18 Jun 2024 13:57:00 +0000 (09:57 -0400)]
Merge pull request #16194 from opensourcerouting/fix/bfd_profile_shutdown

bgpd: Do not start BGP session if BFD profile is in shutdown state

10 months agoMerge pull request #16195 from opensourcerouting/fix/drop_recent_confdate
Russ White [Tue, 18 Jun 2024 13:56:19 +0000 (09:56 -0400)]
Merge pull request #16195 from opensourcerouting/fix/drop_recent_confdate

ospfd: Drop `interfaceIp` from `show ip ospf neigh json`

10 months agotests: Check if recursive weighted ECMP works
Donatas Abraitis [Tue, 18 Jun 2024 09:16:54 +0000 (12:16 +0300)]
tests: Check if recursive weighted ECMP works

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agozebra: Set the weight for non-recursive next-hop
Donatas Abraitis [Tue, 18 Jun 2024 09:07:23 +0000 (12:07 +0300)]
zebra: Set the weight for non-recursive next-hop

If using weighted ECMP, the weight for non-recursive next-hop should be
inherited from recursive next-hop.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agolib: Get the weight from Zebra
Donatas Abraitis [Tue, 18 Jun 2024 09:06:46 +0000 (12:06 +0300)]
lib: Get the weight from Zebra

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agoisisd: After the router switches IS-IS type several times, the neighbor adjacency...
zhou-run [Mon, 17 Jun 2024 08:45:09 +0000 (16:45 +0800)]
isisd: After the router switches IS-IS type several times, the neighbor adjacency cannot be established.

1. Router A is configured with "is-type level-1-2", while Router B is configured with "is-type level-1". Only level 1 neighbor entries are present on Router A.
2. After configuring Router B with "is-type level-2-only", both level 1 and level 2 neighbor entries exist on Router A. The state of these entries is UP, and the level 1 neighbor entry is currently aging.
3. Before the level 1 neighbor entry on Router A ages out, configuring Router B with "is-type level-1", both level 1 and level 2 neighbor entries exist on Router A. The level 2 neighbor entry is UP and will age out normally. However, the level 1 neighbor entry remains in the Initializing state, preventing the establishment of level 1 neighbor adjacency between Router A and Router B.

When the adjacency type of the link is switched in function isis_circuit_is_type_set, the function circuit_resign_level() is called to delete the old level's circuit->u.bc.lan_neighs linked list. If the old level is not level-1-2, the function circuit_commence_level() is called to create a new level's circuit->u.bc.lan_neighs linked list, but neither of these functions handle the circuit->u.bc.adjdb linked list. This leads to a situation where upon receiving hello packets again before the circuit->u.bc.adjdb linked list entries age out, the circuit->u.bc.lan_neighs linked list is not constructed based on the circuit->u.bc.adjdb linked list. As a result, the hello packets sent will consistently lack an SNPA, causing the neighbor to remain unable to establish an adjacency upon receiving the hello packets.

Signed-off-by: zhou-run <166502045+zhou-run@users.noreply.github.com>
10 months agoMerge pull request #16225 from anlancs/doc/ldpd-fix-one-session-cmd
Renato Westphal [Sat, 15 Jun 2024 12:07:05 +0000 (09:07 -0300)]
Merge pull request #16225 from anlancs/doc/ldpd-fix-one-session-cmd

doc: fix one ldp neighbor command

10 months agodoc: fix one ldp neighbor command
anlan_cs [Sat, 15 Jun 2024 05:56:25 +0000 (13:56 +0800)]
doc: fix one ldp neighbor command

Signed-off-by: anlan_cs <anlan_cs@tom.com>
10 months agoMerge pull request #16221 from donaldsharp/atomic_surprise
Jafar Al-Gharaibeh [Fri, 14 Jun 2024 16:45:47 +0000 (11:45 -0500)]
Merge pull request #16221 from donaldsharp/atomic_surprise

zebra: Use built in data structure counter

10 months agoMerge pull request #16202 from y-bharath14/srib-topotest-d
Donatas Abraitis [Fri, 14 Jun 2024 07:25:25 +0000 (10:25 +0300)]
Merge pull request #16202 from y-bharath14/srib-topotest-d

tests: suppress unused variables at topotests

10 months agoisisd: fix 'show isis route prefix-sid backup' command
Philippe Guibert [Thu, 6 Jun 2024 13:18:48 +0000 (15:18 +0200)]
isisd: fix 'show isis route prefix-sid backup' command

It is not possible to dump both backup and prefix-sid
information. Fix this by authorising it.

> rt1# show isis route prefix-sid backup
> Area 1:
> IS-IS paths to level-1 routers that speak IP
> Vertex               Type         Metric Next-Hop             Interface Parent
> rt1
> 10.12.0.0/24         IP internal  0                                     rt1(4)
> 10.13.0.0/24         IP internal  0                                     rt1(4)
> 1.1.1.1/32           IP internal  0                                     rt1(4)
> rt2                  TE-IS        10     rt2                  eth-rt2   rt1(4)
> rt3                  TE-IS        10     rt3                  eth-rt3   rt1(4)
> 10.12.0.0/24         IP TE        20     rt2                  eth-rt2   rt2(4)
> 10.23.0.0/24         IP TE        20     rt2                  eth-rt2   rt2(4)
>                                          rt3                  eth-rt3   rt3(4)
> 2.2.2.2/32           IP TE        20     rt2                  eth-rt2   rt2(4)
> 10.13.0.0/24         IP TE        20     rt3                  eth-rt3   rt3(4)
> 3.3.3.3/32           IP TE        20     rt3                  eth-rt3   rt3(4)
>
> IS-IS L1 IPv4 routing table:
>
> IS-IS paths to level-1 routers that speak IPv6
> Vertex               Type         Metric Next-Hop             Interface Parent
> rt1
> 2001:db8:1000::1/128 IP6 internal 0                                     rt1(4)
> rt2                  TE-IS        10     rt2                  eth-rt2   rt1(4)
> rt3                  TE-IS        10     rt3                  eth-rt3   rt1(4)
> 2001:db8:1000::2/128 IP6 internal 20     rt2                  eth-rt2   rt2(4)
> 2001:db8:1000::3/128 IP6 internal 20     rt3                  eth-rt3   rt3(4)
>
> IS-IS L1 IPv6 routing table:
>

Fixes: d47d6089e06c ("isisd: refactor handling of SR Prefix-SIDs")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
10 months agozebra: Use built in data structure counter
Donald Sharp [Thu, 13 Jun 2024 19:30:00 +0000 (15:30 -0400)]
zebra: Use built in data structure counter

Instead of keeping a counter that is independent
of the queue's data structure.  Just use the queue's
built-in counter.  Ensure that it's pthread safe by
keeping it wrapped inside the mutex for adding/deleting
to the queue.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
10 months agoMerge pull request #16188 from anlancs/isisd/fix-metric-style
Olivier Dugeon [Thu, 13 Jun 2024 13:27:21 +0000 (15:27 +0200)]
Merge pull request #16188 from anlancs/isisd/fix-metric-style

yang: fix wrong check for isis metric style

10 months agoMerge pull request #16184 from LabNConsulting/chopps/fe-notify-select
Jafar Al-Gharaibeh [Thu, 13 Jun 2024 05:20:09 +0000 (00:20 -0500)]
Merge pull request #16184 from LabNConsulting/chopps/fe-notify-select

mgmtd: add notification selection to front-end API

10 months agobuild: FRR 10.2 development version frr-10.2-dev
Jafar Al-Gharaibeh [Wed, 12 Jun 2024 17:03:21 +0000 (12:03 -0500)]
build: FRR 10.2 development version

Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
10 months agoospfd: Fix memory leak after cleaning cleaning up interfaceIp JSON field
Donatas Abraitis [Wed, 12 Jun 2024 13:28:38 +0000 (16:28 +0300)]
ospfd: Fix memory leak after cleaning cleaning up interfaceIp JSON field

```
=================================================================
==6717==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 1008 byte(s) in 14 object(s) allocated from:
    0 0x7f9ea0dc7d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    1 0x7f9ea034d51f in json_object_new_object (/lib/x86_64-linux-gnu/libjson-c.so.3+0x351f)
    2 0x564b56d0fed6 in show_ip_ospf_interface_common ospfd/ospf_vty.c:4011
    3 0x564b56d1068c in show_ip_ospf_interface ospfd/ospf_vty.c:4285
    4 0x7f9ea06fe1c0 in cmd_execute_command_real lib/command.c:1002
    5 0x7f9ea06fe684 in cmd_execute_command lib/command.c:1060
    6 0x7f9ea06feb03 in cmd_execute lib/command.c:1227
    7 0x7f9ea08415b2 in vty_command lib/vty.c:616
    8 0x7f9ea0841a5d in vty_execute lib/vty.c:1379
    9 0x7f9ea084b367 in vtysh_read lib/vty.c:2374
    10 0x7f9ea08350cd in event_call lib/event.c:2011
    11 0x7f9ea0764386 in frr_run lib/libfrr.c:1217
    12 0x564b56c25b18 in main ospfd/ospf_main.c:295
    13 0x7f9e9fd5bc86 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)

Indirect leak of 7168 byte(s) in 14 object(s) allocated from:
    0 0x7f9ea0dc7d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    1 0x7f9ea0350fa4 in lh_table_new (/lib/x86_64-linux-gnu/libjson-c.so.3+0x6fa4)

Indirect leak of 1232 byte(s) in 14 object(s) allocated from:
    0 0x7f9ea0dc7d28 in __interceptor_calloc (/usr/lib/x86_64-linux-gnu/libasan.so.4+0xded28)
    1 0x7f9ea0350f82 in lh_table_new (/lib/x86_64-linux-gnu/libjson-c.so.3+0x6f82)

SUMMARY: AddressSanitizer: 9408 byte(s) leaked in 42 allocation(s).
***********************************************************************************
```

Fixes: e24ff4c275f0729f75be9f68d08be80ac1e0ec56 ("ospfd: Drop `interfaceIp` from `show ip ospf neigh json")
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agoMerge pull request #16191 from pguibert6WIND/srte_color_not_copied base_10.1
Donatas Abraitis [Wed, 12 Jun 2024 12:39:10 +0000 (15:39 +0300)]
Merge pull request #16191 from pguibert6WIND/srte_color_not_copied

lib: fix copy srte_color from zapi_nexthop structure

10 months agotests: supress unused variables at topotests
Y Bharath [Wed, 12 Jun 2024 08:26:34 +0000 (13:56 +0530)]
tests: supress unused variables at topotests

For code maintainability, suppressed unused variables with "_"

Signed-off-by: y-bharath14 <y.bharath@samsung.com>
10 months agobgpd: Do not start BGP session if BFD profile is in shutdown state
Donatas Abraitis [Wed, 12 Jun 2024 05:39:48 +0000 (08:39 +0300)]
bgpd: Do not start BGP session if BFD profile is in shutdown state

If we do:

```
bfd
 profile foo
  shutdown
```

The session is dropped, but immediately established again because we don't
have a proper check on BFD.

If BFD is administratively shutdown, ignore starting the session.

Fixes: https://github.com/FRRouting/frr/issues/16186
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agoMerge pull request #16190 from trots/master
Russ White [Tue, 11 Jun 2024 18:44:14 +0000 (14:44 -0400)]
Merge pull request #16190 from trots/master

doc: Add reloading script into Python dependency section

10 months agoMerge pull request #16050 from rgirada/ospfv3_helper
Russ White [Tue, 11 Jun 2024 15:48:05 +0000 (11:48 -0400)]
Merge pull request #16050 from rgirada/ospfv3_helper

ospf6d: Handling Topo Change in GR-HELPER mode for max-age lsas

10 months agodoc: Add reloading script into Python dependency section
Alexander Trotsenko [Sat, 8 Jun 2024 22:10:02 +0000 (01:10 +0300)]
doc: Add reloading script into Python dependency section

Signed-off-by: Alexander Trotsenko <trotsenko93@mail.ru>
10 months agoMerge pull request #16193 from opensourcerouting/fix/ecommunity_linkbw_present_overrun
Russ White [Tue, 11 Jun 2024 15:21:42 +0000 (11:21 -0400)]
Merge pull request #16193 from opensourcerouting/fix/ecommunity_linkbw_present_overrun

bgpd: Check against extended community unit size for link bandwidth

10 months agotests: add native session-req/reply support to fe_client.py
Christian Hopps [Tue, 11 Jun 2024 14:26:08 +0000 (10:26 -0400)]
tests: add native session-req/reply support to fe_client.py

Use this to test new native message format for creating sessions.

Signed-off-by: Christian Hopps <chopps@labn.net>
10 months agomgmtd: add native session-req (create/delete) messages
Christian Hopps [Tue, 11 Jun 2024 09:08:49 +0000 (05:08 -0400)]
mgmtd: add native session-req (create/delete) messages

This addition allows for a limited native-message-only front-end
interaction.

Signed-off-by: Christian Hopps <chopps@labn.net>
10 months agoMerge pull request #16187 from opensourcerouting/isis_tilfa_topo_rework
Donald Sharp [Tue, 11 Jun 2024 13:49:35 +0000 (09:49 -0400)]
Merge pull request #16187 from opensourcerouting/isis_tilfa_topo_rework

isis_tilfa_topo1 rework

10 months agobgpd: Keep last notification's state about hard reset
Donatas Abraitis [Tue, 11 Jun 2024 08:41:53 +0000 (11:41 +0300)]
bgpd: Keep last notification's state about hard reset

When we receive a hard-reset notification, we always show it if it was a hard,
or not.

For sending side, we missed that. Let's display it too.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agotests: Check if BFD notification is sent and session remains in down state
Donatas Abraitis [Tue, 11 Jun 2024 08:40:40 +0000 (11:40 +0300)]
tests: Check if BFD notification is sent and session remains in down state

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agotests: Drop `interfaceIp` from OSPF tests
Donatas Abraitis [Tue, 11 Jun 2024 12:48:23 +0000 (15:48 +0300)]
tests: Drop `interfaceIp` from OSPF tests

Deprecated.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agoyang: fix wrong check for isis metric style
anlan_cs [Sat, 8 Jun 2024 15:38:05 +0000 (23:38 +0800)]
yang: fix wrong check for isis metric style

Before:
```
anlan(config)# route isis ix
anlan(config-router)# metric-style transition
...
anlan(config-if)# isis metric 200
% Configuration failed.

Error type: validation
Error description: YANG error(s):
 Path: Data location "/frr-interface:lib/interface[name='x']/frr-isisd:isis/metric/level-1".
 Error: Must condition ". < 64 or /frr-isisd:isis/instance[area-tag = current()/../../area-tag]/metric-style = 'wide' or not(/frr-isisd:isis/instance[area-tag = current()/../../area-tag]/metric-style)" not satisfied.
 Path: Data location "/frr-interface:lib/interface[name='x']/frr-isisd:isis/metric/level-2".
 Error: Must condition ". < 64 or /frr-isisd:isis/instance[area-tag = current()/../../area-tag]/metric-style = 'wide' or not(/frr-isisd:isis/instance[area-tag = current()/../../area-tag]/metric-style)" not satisfied
```

After:
```
anlan(config)# route isis ix
anlan(config-router)# metric-style transition
...
anlan(config-if)# isis metric 200
anlan(config-if)#
```

Signed-off-by: anlan_cs <anlan_cs@tom.com>
10 months agoospfd: Drop `interfaceIp` from `show ip ospf neigh json`
Donatas Abraitis [Tue, 11 Jun 2024 08:59:37 +0000 (11:59 +0300)]
ospfd: Drop `interfaceIp` from `show ip ospf neigh json`

Deprecated. Now it's under interface field directly:

```
{
  "interfaces":{
    "enp3s0":{
      "ifUp":true,
      "ifIndex":2,
      "mtuBytes":1500,
      "bandwidthMbit":100,
      "ifFlags":"<UP,LOWER_UP,BROADCAST,RUNNING,MULTICAST>",
      "ospfEnabled":true,
      "ipAddress":"192.168.10.19",
      "ipAddressPrefixlen":24,
      "ospfIfType":"Broadcast",
      "localIfUsed":"192.168.10.255",
      "area":"0.0.0.0",
      "routerId":"100.100.100.100",
      "networkType":"POINTOPOINT",
      "cost":1000,
      "transmitDelaySecs":1,
      "state":"Point-To-Point",
      "priority":1,
      "opaqueCapable":true,
      "mcastMemberOspfAllRouters":true,
      "timerMsecs":10000,
      "timerDeadSecs":40,
      "timerWaitSecs":40,
      "timerRetransmitSecs":5,
      "timerHelloInMsecs":2924,
      "nbrCount":0,
      "nbrAdjacentCount":0,
      "grHelloDelaySecs":10,
      "prefixSuppression":false,
      "nbrFilterPrefixList":"N\/A"
    }
  }
}
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agotopotests: add bgp duplicate nexthop test
Philippe Guibert [Tue, 4 Jun 2024 16:50:26 +0000 (18:50 +0200)]
topotests: add bgp duplicate nexthop test

Add a topotest that ensures that when addpath is enabled and two
paths with same nexthop are received, they are sent to ZEBRA which
detects 'duplicate nexthop'.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
10 months agotopotests: add API to detect if iproute2 is json capable
Philippe Guibert [Mon, 10 Jun 2024 06:38:22 +0000 (08:38 +0200)]
topotests: add API to detect if iproute2 is json capable

Some tests may want to use the json facility of iproute2 to
dump some results.
Add an internal API in lib/topotest.py that tells whether iproute2
is json capable or not.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
10 months agobgpd: fix do not skip paths with same nexthop
Philippe Guibert [Thu, 30 May 2024 13:47:11 +0000 (15:47 +0200)]
bgpd: fix do not skip paths with same nexthop

Under a setup where two BGP prefixes are available from multiple sources,
if one of the two prefixes is recursive over the other BGP prefix, then
it will not be considered as multipath. The below output shows the two
prefixes 192.0.2.24/32 and 192.0.2.21/32. The 192.0.2.[5,6,8] are the
known IP addresses visible from the IGP.

> # show bgp ipv4 192.0.2.24/32
> *>i 192.0.2.24/32    192.0.2.21               0    100      0 i
> * i                  192.0.2.21               0    100      0 i
> * i                  192.0.2.21               0    100      0 i
> # show bgp ipv4 192.0.2.21/32
>  *>i 192.0.2.21/32    192.0.2.5                0    100      0 i
>  *=i                  192.0.2.6                0    100      0 i
>  *=i                  192.0.2.8                0    100      0 i

The bgp best selection algorithm refuses to consider the paths to
'192.0.2.24/32' as multipath, whereas the BGP paths which use the
BGP peer as nexthop are considered multipath.

> ... has the same nexthop as the bestpath, skip it ...

Previously, this condition has been added to prevent ZEBRA from
installing routes with same nexthop:

>     Here you can see the two paths with nexthop 210.2.2.2
>     superm-redxp-05# show ip route 2.23.24.192/28
>     Routing entry for 2.23.24.192/28
>       Known via "bgp", distance 20, metric 0, best
>       Last update 00:32:12 ago
>       * 210.2.2.2, via swp3
>       * 210.2.0.2, via swp1
>       * 210.2.1.2, via swp2
>       * 210.2.2.2, via swp3
> [..]

But today, ZEBRA knows how to handle it. When receiving incoming routes,
nexthop groups are used. At creation, duplicated nexthops are
identified, and will not be installed. The below output illustrate the
duplicate paths to 172.16.0.200 received by an other peer.

> r1# show ip route 172.18.1.100 nexthop-group
> Routing entry for 172.18.1.100/32
>   Known via "bgp", distance 200, metric 0, best
>   Last update 00:03:03 ago
>   Nexthop Group ID: 75757580
>     172.16.0.200 (recursive), weight 1
>   *   172.31.0.3, via r1-eth1, label 16055, weight 1
>   *   172.31.2.4, via r1-eth2, label 16055, weight 1
>   *   172.31.0.3, via r1-eth1, label 16006, weight 1
>   *   172.31.2.4, via r1-eth2, label 16006, weight 1
>   *   172.31.8.7, via r1-eth4, label 16008, weight 1
>     172.16.0.200 (duplicate nexthop removed) (recursive), weight 1
>       172.31.0.3, via r1-eth1 (duplicate nexthop removed), label 16055, weight 1
>       172.31.2.4, via r1-eth2 (duplicate nexthop removed), label 16055, weight 1
>       172.31.0.3, via r1-eth1 (duplicate nexthop removed), label 16006, weight 1
>       172.31.2.4, via r1-eth2 (duplicate nexthop removed), label 16006, weight 1
>       172.31.8.7, via r1-eth4 (duplicate nexthop removed), label 16008, weight 1

Fix this by proposing to let ZEBRA handle this duplicate decision.

Fixes: 7dc9d4e4e360 ("bgp may add multiple path entries with the same nexthop")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
10 months agobgpd: Check against extended community unit size for link bandwidth
Donatas Abraitis [Tue, 11 Jun 2024 07:03:17 +0000 (10:03 +0300)]
bgpd: Check against extended community unit size for link bandwidth

If we receive a malformed packets, this could lead ptr_get_be64() reading
the packets more than needed (heap overflow).

```
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
    0 0xaaaaaadf86ec in __asan_memcpy (/home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/.libs/bgpd+0x3586ec) (BuildId: 78123cd26ada92b8b59fc0d74d292ba70c9d2e01)
    1 0xaaaaaaeb60fc in ptr_get_be64 /home/ubuntu/frr-public/frr_public_private-libfuzzer/./lib/stream.h:377:2
    2 0xaaaaaaeb5b90 in ecommunity_linkbw_present /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_ecommunity.c:1895:10
    3 0xaaaaaae50f30 in bgp_attr_ext_communities /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_attr.c:2639:8
    4 0xaaaaaae49d58 in bgp_attr_parse /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_attr.c:3776:10
    5 0xaaaaab063260 in bgp_update_receive /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_packet.c:2371:20
    6 0xaaaaab05df00 in bgp_process_packet /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_packet.c:4063:11
    7 0xaaaaaae36110 in LLVMFuzzerTestOneInput /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_main.c:582:3
```

This is triggered when receiving such a packet (malformed):

```
(gdb) bt
0  ecommunity_linkbw_present (ecom=0x555556287990, bw=bw@entry=0x7fffffffda68)
    at bgpd/bgp_ecommunity.c:1802
1  0x000055555564fcac in bgp_attr_ext_communities (args=0x7fffffffd840) at bgpd/bgp_attr.c:2619
2  bgp_attr_parse (peer=peer@entry=0x55555628cdf0, attr=attr@entry=0x7fffffffd960, size=size@entry=20,
    mp_update=mp_update@entry=0x7fffffffd940, mp_withdraw=mp_withdraw@entry=0x7fffffffd950)
    at bgpd/bgp_attr.c:3755
3  0x00005555556aa655 in bgp_update_receive (connection=connection@entry=0x5555562aa030,
    peer=peer@entry=0x55555628cdf0, size=size@entry=41) at bgpd/bgp_packet.c:2324
4  0x00005555556afab7 in bgp_process_packet (thread=<optimized out>) at bgpd/bgp_packet.c:3897
5  0x00007ffff7ac2f73 in event_call (thread=thread@entry=0x7fffffffdc70) at lib/event.c:2011
6  0x00007ffff7a6fb90 in frr_run (master=0x555555bc7c90) at lib/libfrr.c:1212
7  0x00005555556457e1 in main (argc=<optimized out>, argv=<optimized out>) at bgpd/bgp_main.c:543
(gdb) p *ecom
$1 = {refcnt = 1, unit_size = 8 '\b', disable_ieee_floating = false, size = 2, val = 0x555556282150 "",
  str = 0x5555562a9c30 "UNK:0, 255 UNK:2, 6"}
```

Reported-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agonhrpd: add cisco-authentication password support
Dave LeRoy [Wed, 5 Jun 2024 19:10:11 +0000 (12:10 -0700)]
nhrpd: add cisco-authentication password support

Taking over this development from https://github.com/FRRouting/frr/pull/14788

This commit addresses 4 issues found in the previous PR

1) FRR would accept messages from a spoke without authentication when FRR NHRP had auth configured.
2) The error indication was not being sent in network byte order
3) The debug print in nhrp_connection_authorized was not correctly printing the received password
4) The addresses portion of the mandatory part of the error indication was invalid on the wire (confirmed in wireshark)

Signed-off-by: Dave LeRoy <dleroy@labn.net>
Co-authored-by: Volodymyr Huti <volodymyr.huti@gmail.com>
10 months agonhrp: add `cisco-authentication` password support
Volodymyr Huti [Mon, 13 Nov 2023 20:47:31 +0000 (22:47 +0200)]
nhrp: add `cisco-authentication` password support

Implemented:
- handling 8 char long password, aka Cisco style.
- minimal error inidication routine
- test case, password change affects conection

Signed-off-by: Volodymyr Huti <v.huti@vyos.io>
10 months agoMerge pull request #16183 from LabNConsulting/chopps/notif-doc-update
Donatas Abraitis [Mon, 10 Jun 2024 19:25:10 +0000 (22:25 +0300)]
Merge pull request #16183 from LabNConsulting/chopps/notif-doc-update

mgmtd: add empty notif xpath map for completeness

10 months agotests: introduce method to update reference data in isis_tilfa_topo1
Renato Westphal [Fri, 7 Jun 2024 15:03:17 +0000 (12:03 -0300)]
tests: introduce method to update reference data in isis_tilfa_topo1

The isis_tilfa_topo1 topotest is comprehensive and contains a large
amount of reference data. One problem is that, when changes occur,
updating this reference data can be difficult.

To address this problem, this commit introduces a method to
automatically regenerate the reference data by setting the `REGEN_DATA`
environment variable.

Usage:
$ REGEN_DATA=true python3 ./test_isis_tilfa_topo1.py

When `REGEN_DATA` is set, the topotest regenerates reference data
from the current run instead of comparing against existing reference
data. Note that regenerated data must be manually verified for
correctness.

This commit also simplifies the reference data by replacing all diff
files with complete JSON snapshots.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
10 months agotests: rework isis_tilfa_topo1 to fix timing issues
Renato Westphal [Fri, 7 Jun 2024 13:41:38 +0000 (10:41 -0300)]
tests: rework isis_tilfa_topo1 to fix timing issues

In this topotest, steps 10-15 were added to test the IS-IS switchover
functionality. In short, two cases were tested: switchover after a
link down event and switchover after a BFD down event. Both cases
were tested in sequence on the same router, rt6. This involved the
following steps:
- Setting the SPF delay timer to 15 seconds
- Shutting down the eth-rt5 interface from the switch side
- Testing the post-switchover RIB and LIB (triggered by the link down
  event)
- Testing the post-SPF RIB and LIB
- Bringing the eth-rt5 interface back up
- Configuring a BFD session between rt6 and rt5
- Shutting down the eth-rt5 interface from the switch side once again
- Testing the post-switchover RIB and LIB (triggered by the BFD down
  event)
- Testing the post-SPF RIB and LIB

Since the time window to test the post-switchover RIB and LIB was too
narrow (10 seconds), these tests were having sporadic failures.

To resolve this problem, we can simplify the switchover test as follows:
- Setting the SPF delay timer to 60 seconds (not 15)
- Disabling "link-detect" on rt6's eth-rt5 interface
- Shutting down the eth-rt5 interface from the switch side
- On rt6, testing the post-switchover RIB and LIB (triggered by the
  BFD down event)
- On rt5, testing the post-switchover RIB and LIB (triggered by the
  link down event)

Notice how we can test both post-link-down and post-BFD-down switchover
cases simultaneously by having different "link-detect" configurations
on rt5 and rt6. Additionally, by using a larger SPF delay timer, the
time window to test the post-switchover RIB and LIB is much larger
and less prone to sporadic failures.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
10 months agolib: fix copy srte_color from zapi_nexthop structure
Philippe Guibert [Sun, 17 Dec 2023 20:04:31 +0000 (21:04 +0100)]
lib: fix copy srte_color from zapi_nexthop structure

When switching from nexthop to zapi_nexthop, the srte color
is copied. Do the same in reverse.

Fixes: 31f937fb43f4 ("lib, zebra: Add SR-TE policy infrastructure to zebra")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
10 months agoMerge pull request #16093 from louis-6wind/fix-show-route-memory
Donatas Abraitis [Mon, 10 Jun 2024 08:26:23 +0000 (11:26 +0300)]
Merge pull request #16093 from louis-6wind/fix-show-route-memory

zebra: fix Out Of Memory issue when displaying large route tables in JSON

10 months agoMerge pull request #16189 from LabNConsulting/chopps/triage-github-action
Donald Sharp [Sun, 9 Jun 2024 01:34:42 +0000 (21:34 -0400)]
Merge pull request #16189 from LabNConsulting/chopps/triage-github-action

10 months agoci: do apt-get update before installing required modules
Christian Hopps [Sat, 8 Jun 2024 19:37:47 +0000 (15:37 -0400)]
ci: do apt-get update before installing required modules

- Use `uname -r` to also install specific module versions since
  with github runners the running kernel can become out-dated with
  the deployed packages.

Signed-off-by: Christian Hopps <chopps@labn.net>
10 months agoMerge pull request #15900 from mikemallin/v6-vtep-lib-upstream
Donald Sharp [Fri, 7 Jun 2024 18:34:11 +0000 (14:34 -0400)]
Merge pull request #15900 from mikemallin/v6-vtep-lib-upstream

lib, bgpd, tests, zebra: prefix_sg changes for V6 VTEP

10 months agodoc: add some text on native message API and notif xpath array
Christian Hopps [Thu, 6 Jun 2024 23:49:40 +0000 (19:49 -0400)]
doc: add some text on native message API and notif xpath array

Signed-off-by: Christian Hopps <chopps@labn.net>
10 months agomgmtd: add empty notif xpath map for completeness
Christian Hopps [Thu, 6 Jun 2024 18:08:00 +0000 (14:08 -0400)]
mgmtd: add empty notif xpath map for completeness

New back-end clients may need to add notification static allocations so
we should have it available for those users, rather than requiring the
new user delve into the mgmtd infra and modify it themselves.

Signed-off-by: Christian Hopps <chopps@labn.net>
10 months agotests: check show route vrf all json output
Louis Scalbert [Mon, 27 May 2024 08:35:26 +0000 (10:35 +0200)]
tests: check show route vrf all json output

Check that "show ip route vrf XXX json" and the JSON at key "XXX" of
"show ip route vrf all json" gives the same output.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
10 months agozebra: fix show route memory consumption
Louis Scalbert [Fri, 24 May 2024 14:34:23 +0000 (16:34 +0200)]
zebra: fix show route memory consumption

When displaying a route table in JSON, a table JSON object is storing
all the prefix JSON objects containing the prefix information. This
results in excessive memory allocation for JSON objects, potentially
leading to an out-of-memory error on the machine with large routing
tables.

To Fix the memory consumption issue for the "show ip[v6] route [vrf XX]
json" command, display the prefixes one by one and free the memory of
each JSON object after it has been displayed.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
10 months agozebra: fix show route vrf all memory consumption
Louis Scalbert [Fri, 24 May 2024 15:06:59 +0000 (17:06 +0200)]
zebra: fix show route vrf all memory consumption

0e2fc3d67f ("vtysh, zebra: Fix malformed json output for multiple vrfs
in command 'show ip route vrf all json'") has been reverted in the
previous commit. Although the fix was correct, it was consuming too muca
memory when displaying large route tables.

A root JSON object was storing all the JSON objects containing the route
tables, each containing their respective prefixes in JSON objects. This
resulted in excessive memory allocation for JSON objects, potentially
leading to an out-of-memory error on the machine.

To Fix the memory consumption issue for the "show ip[v6] route vrf all
json" command, display the tables one by one and free the memory of each
JSON object after it has been displayed.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
10 months agolib: add helpers to print json keys
Louis Scalbert [Mon, 27 May 2024 08:04:14 +0000 (10:04 +0200)]
lib: add helpers to print json keys

Add helpers to print json keys in order to prepare the next commits.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
10 months agoRevert "vtysh, zebra: Fix malformed json output for multiple vrfs in command 'show...
Louis Scalbert [Fri, 24 May 2024 14:46:17 +0000 (16:46 +0200)]
Revert "vtysh, zebra: Fix malformed json output for multiple vrfs in command 'show ip route vrf all json'"

This reverts commit 0e2fc3d67f1d358896a764373f41cb59c095eda9.

This fix was correct but not optimal for memory consumption at scale.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
10 months agoMerge pull request #16143 from eremcan/patch-1
Donatas Abraitis [Fri, 7 Jun 2024 07:49:55 +0000 (10:49 +0300)]
Merge pull request #16143 from eremcan/patch-1

docker: fix chmod issues when running container for debian

10 months agotests: switch test to new fe_client notify selector syntax
Christian Hopps [Thu, 6 Jun 2024 14:06:04 +0000 (10:06 -0400)]
tests: switch test to new fe_client notify selector syntax

Signed-off-by: Christian Hopps <chopps@labn.net>
10 months agotests: add notify select support in fe client test utility
Christian Hopps [Tue, 4 Jun 2024 14:57:10 +0000 (10:57 -0400)]
tests: add notify select support in fe client test utility

Signed-off-by: Christian Hopps <chopps@labn.net>
10 months agomgmtd: add front-end notification selector support
Christian Hopps [Tue, 4 Jun 2024 14:29:46 +0000 (10:29 -0400)]
mgmtd: add front-end notification selector support

Signed-off-by: Christian Hopps <chopps@labn.net>
10 months agolib: native msg add array of strings support
Christian Hopps [Tue, 4 Jun 2024 14:28:48 +0000 (10:28 -0400)]
lib: native msg add array of strings support

Signed-off-by: Christian Hopps <chopps@labn.net>
10 months agolib: fix incorrect use of error checking macro
Christian Hopps [Tue, 4 Jun 2024 10:01:59 +0000 (06:01 -0400)]
lib: fix incorrect use of error checking macro

Signed-off-by: Christian Hopps <chopps@labn.net>
10 months agolib: darr: add free with element cleanup functions
Christian Hopps [Tue, 4 Jun 2024 09:43:49 +0000 (05:43 -0400)]
lib: darr: add free with element cleanup functions

- `darr_free_free` to `darr_free` each element prior to `darr_free`
  the array.
- `darr_free_func` to call `func` on each element prior to `darr_free`
  the array.

Signed-off-by: Christian Hopps <chopps@labn.net>
10 months agoMerge pull request #11906 from louis-6wind/show_isis_db_json
Russ White [Thu, 6 Jun 2024 20:27:57 +0000 (16:27 -0400)]
Merge pull request #11906 from louis-6wind/show_isis_db_json

isisd: fix show isis database [detail] json

10 months agoMerge pull request #15434 from louis-6wind/labels-hash
Russ White [Thu, 6 Jun 2024 20:27:38 +0000 (16:27 -0400)]
Merge pull request #15434 from louis-6wind/labels-hash

bgpd: move labels from extra to extra->labels and add them to adj-rib-in and adj-rib-out

10 months agoMerge pull request #16151 from pguibert6WIND/srv6_fix_source_address
Donald Sharp [Thu, 6 Jun 2024 16:22:15 +0000 (12:22 -0400)]
Merge pull request #16151 from pguibert6WIND/srv6_fix_source_address

zebra: display srv6 encapsulation source-address when configured

10 months agoMerge pull request #16171 from mjstapp/fix_fpm_nl_len_check
Donald Sharp [Thu, 6 Jun 2024 12:20:53 +0000 (08:20 -0400)]
Merge pull request #16171 from mjstapp/fix_fpm_nl_len_check

zebra: fix incoming FPM message length validation

10 months agoMerge pull request #16176 from LabNConsulting/chopps/munet-version-update
Donald Sharp [Thu, 6 Jun 2024 12:20:37 +0000 (08:20 -0400)]
Merge pull request #16176 from LabNConsulting/chopps/munet-version-update

tests: munet: update to version 0.14.9

10 months agoospf6d: Handling Topo Change in GR-HELPER mode for max-age lsas
Rajesh Girada [Mon, 20 May 2024 16:34:41 +0000 (09:34 -0700)]
ospf6d: Handling Topo Change in GR-HELPER mode for max-age lsas

Description:
OSPF6 GR HELPER router should  consider as TOPOCHANGE when
it receives lsas with max age and should exit from Helper.
But, it is not exiting from helper because this max age lsa is
considered as duplicated lsa since the sender uses same seq
number for max age lsa from the previous lsa update.
Currently, topo change is not considered for duplicated lsas.
So removed the duplicated check when validating TOPOCHNAGE.

Signed-off-by: Rajesh Girada <rgirada@vmware.com>
10 months agotests: munet: update to version 0.14.9
Christian Hopps [Thu, 6 Jun 2024 08:50:05 +0000 (08:50 +0000)]
tests: munet: update to version 0.14.9

Topotest relevant changes:

    - add support for `timeout` arg to `cmd_*()`
    - handle invalid regexp in CLI commands
    - fix long interface name support

Full munet changelog:

    munet: 0.14.9: add support for `timeout` arg to `cmd_*()`
    munet: 0.14.8: cleanup the cleanup (kill) on launch options
    munet: 0.14.7: allow multiple extra commands for shell console init
    munet: 0.14.6:
      - qemu: gather gcda files where munet can find them
      - handle invalid regexp in CLI commands
    munet: 0.14.5:
      - (podman) pull missing images for containers
      - fix long interface name support
      - add another router example
    munet: 0.14.4: mutest: add color to PASS/FAIL indicators on tty consoles
    munet: 0.14.3: Add hostnet node that runs it's commands in the host network namespace.
    munet: 0.14.2:
      - always fail mutest tests on bad json inputs
      - improve ssh-remote for common use-case of connecting to host connected devices
      - fix ready-cmd for python v3.11+
    munet: 0.14.1: Improved host interface support.

Signed-off-by: Christian Hopps <chopps@labn.net>
10 months agoMerge pull request #16170 from LabNConsulting/dleroy/nhrpd-shortcut-cleanup
Donald Sharp [Wed, 5 Jun 2024 18:39:14 +0000 (14:39 -0400)]
Merge pull request #16170 from LabNConsulting/dleroy/nhrpd-shortcut-cleanup

nhrpd: cleans up shortcut cache entries on termination

10 months agozebra: fix incoming FPM message length validation
Mark Stapp [Wed, 5 Jun 2024 18:37:41 +0000 (14:37 -0400)]
zebra: fix incoming FPM message length validation

Validate incoming message length against correct
(struct rtmsg) len, not top-level netlink message header size.

Signed-off-by: Mark Stapp <mjs@cisco.com>
10 months agonhrpd: cleans up shortcut cache entries on termination
Dave LeRoy [Wed, 5 Jun 2024 17:22:57 +0000 (10:22 -0700)]
nhrpd: cleans up shortcut cache entries on termination

nhrp_shortcut_terminate() previously was just freeing the associated AFI shortcut
RIBs and not addressing existing shortcut cache entries. This cause a use after
free issue in vrf_terminate() later in the terminate sequence

NHRP: Received signal 7 at 1717516286 (si_addr 0x1955d, PC 0x7098786912c0); aborting...
NHRP: zlog_signal+0xf5                   709878ad1255     7fff3d992eb0 /usr/lib/frr/libfrr.so.0 (mapped at 0x709878a00000)
NHRP: core_handler+0xb5                  709878b0db85     7fff3d992ff0 /usr/lib/frr/libfrr.so.0 (mapped at 0x709878a00000)
NHRP: __sigaction+0x50                   709878642520     7fff3d993140 /lib/x86_64-linux-gnu/libc.so.6 (mapped at 0x709878600000)
NHRP:     ---- signal ----
NHRP: __lll_lock_wait_private+0x90       7098786912c0     7fff3d9936d8 /lib/x86_64-linux-gnu/libc.so.6 (mapped at 0x709878600000)
NHRP: pthread_mutex_lock+0x112           709878698002     7fff3d9936e0 /lib/x86_64-linux-gnu/libc.so.6 (mapped at 0x709878600000)
NHRP: _event_add_read_write+0x63         709878b1f423     7fff3d993700 /usr/lib/frr/libfrr.so.0 (mapped at 0x709878a00000)
NHRP: zclient_send_message+0xd4          709878b37614     7fff3d993770 /usr/lib/frr/libfrr.so.0 (mapped at 0x709878a00000)
NHRP: nhrp_route_announce+0x1ad          5ab34d63d39d     7fff3d993790 /usr/lib/frr/nhrpd (mapped at 0x5ab34d621000)
NHRP: nhrp_shortcut_cache_notify+0xd8     5ab34d63e758     7fff3d99d4e0 /usr/lib/frr/nhrpd (mapped at 0x5ab34d621000)
NHRP: nhrp_cache_free+0x165              5ab34d632f25     7fff3d99d510 /usr/lib/frr/nhrpd (mapped at 0x5ab34d621000)
NHRP: hash_iterate+0x4d                  709878ab949d     7fff3d99d540 /usr/lib/frr/libfrr.so.0 (mapped at 0x709878a00000)
NHRP: nhrp_cache_interface_del+0x37      5ab34d633eb7     7fff3d99d580 /usr/lib/frr/nhrpd (mapped at 0x5ab34d621000)
NHRP: nhrp_if_delete_hook+0x26           5ab34d6350d6     7fff3d99d5a0 /usr/lib/frr/nhrpd (mapped at 0x5ab34d621000)
NHRP: if_delete_retain+0x3d              709878abcd1d     7fff3d99d5c0 /usr/lib/frr/libfrr.so.0 (mapped at 0x709878a00000)
NHRP: if_delete+0x4c                     709878abd87c     7fff3d99d600 /usr/lib/frr/libfrr.so.0 (mapped at 0x709878a00000)
NHRP: if_terminate+0x53                  709878abda83     7fff3d99d630 /usr/lib/frr/libfrr.so.0 (mapped at 0x709878a00000)
NHRP: vrf_terminate_single+0x24          709878b23c74     7fff3d99d670 /usr/lib/frr/libfrr.so.0 (mapped at 0x709878a00000)
NHRP: nhrp_request_stop+0x34             5ab34d636844     7fff3d99d690 /usr/lib/frr/nhrpd (mapped at 0x5ab34d621000)
NHRP: frr_sigevent_process+0x53          709878b0df53     7fff3d99d6a0 /usr/lib/frr/libfrr.so.0 (mapped at 0x709878a00000)
NHRP: event_fetch+0x6c5                  709878b20405     7fff3d99d6c0 /usr/lib/frr/libfrr.so.0 (mapped at 0x709878a00000)
NHRP: frr_run+0xd3                       709878ac8163     7fff3d99d840 /usr/lib/frr/libfrr.so.0 (mapped at 0x709878a00000)
NHRP: main+0x195                         5ab34d631915     7fff3d99d960 /usr/lib/frr/nhrpd (mapped at 0x5ab34d621000)
NHRP: __libc_init_first+0x90             709878629d90     7fff3d99d980 /lib/x86_64-linux-gnu/libc.so.6 (mapped at 0x709878600000)
NHRP: __libc_start_main+0x80             709878629e40     7fff3d99da20 /lib/x86_64-linux-gnu/libc.so.6 (mapped at 0x709878600000)
NHRP: _start+0x25                        5ab34d631b65     7fff3d99da70 /usr/lib/frr/nhrpd (mapped at 0x5ab34d621000)

Signed-off-by: Dave LeRoy <dleroy@labn.net>
10 months agoMerge pull request #16164 from opensourcerouting/fix/doc_clear_bgp_by_asn
Donald Sharp [Wed, 5 Jun 2024 17:07:04 +0000 (13:07 -0400)]
Merge pull request #16164 from opensourcerouting/fix/doc_clear_bgp_by_asn

doc: Add missing `clear bgp ASNUM` command

10 months agoMerge pull request #16159 from opensourcerouting/fix/ignore_auto_created_vrf_bgp_inst...
Donald Sharp [Wed, 5 Jun 2024 13:51:09 +0000 (09:51 -0400)]
Merge pull request #16159 from opensourcerouting/fix/ignore_auto_created_vrf_bgp_instances

bgpd: Ignore auto created VRF BGP instances

10 months agoMerge pull request #16163 from LabNConsulting/aceelindem/ospfv3-auth-sa-id-checking
Donald Sharp [Wed, 5 Jun 2024 13:48:45 +0000 (09:48 -0400)]
Merge pull request #16163 from LabNConsulting/aceelindem/ospfv3-auth-sa-id-checking

 ospf6d: OSPFv3 manual key authentication neglects checking the SA ID.

10 months agoMerge pull request #16155 from httpstorm/gcc-14-compatibility
Donald Sharp [Wed, 5 Jun 2024 13:47:44 +0000 (09:47 -0400)]
Merge pull request #16155 from httpstorm/gcc-14-compatibility

zebra: fix compilation with GCC14

10 months agobgpd: fix label in adj-rib-out
Philippe Guibert [Thu, 23 Feb 2023 14:38:11 +0000 (15:38 +0100)]
bgpd: fix label in adj-rib-out

After modifying the "label vpn export value", the vpn label information
of the VRF is not updated to the peers.

For example, the 192.168.0.0/24 prefix is announced to the peer with a
label value of 222.

> router bgp 65500
> [..]
>  neighbor 192.0.2.2 remote-as 65501
>  address-family ipv4-vpn
>   neighbor 192.0.2.2 activate
>  exit-address-family
> exit
> router bgp 65500 vrf vrf2
>  address-family ipv4 unicast
>   network 192.168.0.0/24
>   label vpn export 222
>   rd vpn export 444:444
>   rt vpn both 53:100
>   export vpn
>   import vpn
>  exit-address-family

Changing the label with "label vpn export" does not update the label
value to the peer unless the BGP sessions is re-established.

No labels are stored are stored struct bgp_adj_out so that it is
impossible to compare the current value with the previous value
in adj-RIB-out.

Reference the bgp_labels pointer in struct bgp_adj_out and compare the
values when updating adj-RIB-out.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
10 months agobgpd: fix labels in adj-rib-in
Philippe Guibert [Fri, 13 Jan 2023 14:59:52 +0000 (15:59 +0100)]
bgpd: fix labels in adj-rib-in

In a BGP L3VPN context using ADJ-RIB-IN (ie. enabled with
'soft-reconfiguration inbound'), after applying a deny route-map and
removing it, the remote MPLS label information is lost. As a result, BGP
is unable to re-install the related routes in the RIB.

For example,

> router bgp 65500
> [..]
>  neighbor 192.0.2.2 remote-as 65501
>  address-family ipv4 vpn
>   neighbor 192.0.2.2 activate
>   neighbor 192.0.2.2 soft-reconfiguration inbound

The 192.168.0.0/24 prefix has a remote label value of 102 in the BGP
RIB.

> # show bgp ipv4 vpn 192.168.0.0/24
>  BGP routing table entry for 444:1:192.168.0.0/24, version 2
>  [..]
>      192.168.0.0 from 192.0.2.2
>        Origin incomplete, metric 0, valid, external, best (First path received)
>        Extended Community: RT:52:100
>        Remote label: 102

A route-map now filter all incoming BGP updates:

> route-map rmap deny 1
> router bgp 65500
>  address-family ipv4 vpn
>   neighbor 192.0.2.2 route-map rmap in

The prefix is now filtered:

> # show bgp ipv4 vpn 192.168.0.0/24
> #

The route-map is detached:

> router bgp 65500
>  address-family ipv4 vpn
>   no neighbor 192.168.0.1 route-map rmap in

The BGP RIB entry is present but the remote label is lost:

> # show bgp ipv4 vpn 192.168.0.0/24
>  BGP routing table entry for 444:1:192.168.0.0/24, version 2
>  [..]
>      192.168.0.0 from 192.0.2.2
>        Origin incomplete, metric 0, valid, external, best (First path received)
>        Extended Community: RT:52:100

The reason for the loose is that labels are stored within struct attr ->
struct extra -> struct bgp_labels but not in the struct bgp_adj_in.

Reference the bgp_labels pointer in struct bgp_adj_in and use its values
when doing a soft reconfiguration of the BGP table.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
10 months agobgpd: get rid of has_valid_label in bgp_update()
Louis Scalbert [Mon, 26 Feb 2024 15:55:11 +0000 (16:55 +0100)]
bgpd: get rid of has_valid_label in bgp_update()

Get rid of has_valid_label in bgp_update() to prepare the next commits.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
10 months agobgpd: move labels from extra to extra->labels
Louis Scalbert [Mon, 26 Feb 2024 17:23:11 +0000 (18:23 +0100)]
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>
10 months agobgpd: add bgp_labels hash
Louis Scalbert [Fri, 23 Feb 2024 14:18:03 +0000 (15:18 +0100)]
bgpd: add bgp_labels hash

Add bgp_labels type and hash list.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
10 months agotopotests: add bgp test to check the ADJ-RIB-IN label value
Philippe Guibert [Fri, 24 Feb 2023 10:53:46 +0000 (11:53 +0100)]
topotests: add bgp test to check the ADJ-RIB-IN label value

The test is done on r2. A BGP update is received on r2, and is
filtered on r2. The RIB of r2 does not have the BGP update stored,
but the ADJ-RIB-IN is yet present. To demonstrate this, if the
inbound route-map is removed, then the BGP update should be copied
from the the ADJ-RIB-IN and added to the RIB with the label
value.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
10 months agotopotests: add bgp test to check the ADJ-RIB-OUT label value
Philippe Guibert [Fri, 24 Feb 2023 10:22:14 +0000 (11:22 +0100)]
topotests: add bgp test to check the ADJ-RIB-OUT label value

This test ensures that when r1 changes the label value, then
the new value is automatically propagated to remote peer.
This demonstrates that the ADJ-RIB-OUT to r2 has been correctly
updated.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
10 months agotopotests: clarify bgp_vpnv4_ebgp
Louis Scalbert [Tue, 23 Jan 2024 13:24:08 +0000 (14:24 +0100)]
topotests: clarify bgp_vpnv4_ebgp

Clarify bgp_vpnv4_ebgp

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
10 months agobgpd: store number of labels with 8 bits
Louis Scalbert [Mon, 26 Feb 2024 17:11:09 +0000 (18:11 +0100)]
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>
10 months agobgpd: fix too leading tabs in vnc_import_bgp
Louis Scalbert [Wed, 5 Jun 2024 09:27:15 +0000 (11:27 +0200)]
bgpd: fix too leading tabs in vnc_import_bgp

Small rework to fix the following checkpatch warning:

> < WARNING: Too many leading tabs - consider code refactoring
> < #2142: FILE: /tmp/f1-1616988/vnc_import_bgp.c:2142:

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
10 months agobgpd: add bgp_path_info_num_labels()
Louis Scalbert [Mon, 26 Feb 2024 09:42:42 +0000 (10:42 +0100)]
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>
10 months agobgpd: rework vni printing in route_vty_out_detail()
Louis Scalbert [Mon, 26 Feb 2024 10:04:18 +0000 (11:04 +0100)]
bgpd: rework vni printing in route_vty_out_detail()

In route_vty_out_detail(), tag_buf stores a string representation of
the VNI label.

Rename tag_buf to vni_buf for clarity and rework the code a little bit
to prepare the following commits.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
10 months agobgpd: num_labels cannot be greater than BGP_MAX_LABELS
Louis Scalbert [Mon, 26 Feb 2024 13:13:25 +0000 (14:13 +0100)]
bgpd: num_labels cannot be greater than BGP_MAX_LABELS

num_labels cannot be greater than BGP_MAX_LABELS by design.

Remove the check and the override.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
10 months agobgpd: add bgp_path_info_labels_same()
Louis Scalbert [Mon, 26 Feb 2024 11:10:16 +0000 (12:10 +0100)]
bgpd: add bgp_path_info_labels_same()

Add bgp_path_info_labels_same() to compare labels with labels from
path_info. Remove labels_same() that was used for mplsvpn only.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
10 months agobgpd: optimize label copy for new path_info
Louis Scalbert [Mon, 26 Feb 2024 11:16:16 +0000 (12:16 +0100)]
bgpd: optimize label copy for new path_info

In bgp_update(), path_info *new has just been created and has void
labels. bgp_labels_same() is always false.

Do not compare previous labels before setting them.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
10 months agobgpd: do not init labels in extra
Louis Scalbert [Mon, 5 Feb 2024 16:11:47 +0000 (17:11 +0100)]
bgpd: do not init labels in extra

No need to init labels at extra allocation. num_labels is the number
of set labels in label[] and is initialized to 0 by default.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
10 months agobgpd: add bgp_path_info_has_valid_label()
Louis Scalbert [Wed, 14 Feb 2024 16:32:06 +0000 (17:32 +0100)]
bgpd: add bgp_path_info_has_valid_label()

Add bgp_path_has_valid_label to check that a path_info has a valid
label.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
10 months agobgpd: check and set extra num_labels
Louis Scalbert [Mon, 5 Feb 2024 16:05:20 +0000 (17:05 +0100)]
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>
10 months agodoc: Add missing `clear bgp ASNUM` command
Donatas Abraitis [Wed, 5 Jun 2024 05:35:34 +0000 (08:35 +0300)]
doc: Add missing `clear bgp ASNUM` command

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months ago ospf6d: OSPFv3 manual key authentication neglects checking the SA ID.
Acee Lindem [Tue, 4 Jun 2024 21:24:46 +0000 (21:24 +0000)]
 ospf6d: OSPFv3 manual key authentication neglects checking the SA ID.

    Also, add topotest variation to verify checking.

    This corrects https://github.com/FRRouting/frr/issues/16100.

Signed-off-by: Acee Lindem <acee@lindem.com>
10 months agobgpd: Ignore auto created VRF BGP instances
Donatas Abraitis [Tue, 4 Jun 2024 12:30:27 +0000 (15:30 +0300)]
bgpd: Ignore auto created VRF BGP instances

Configuration:

```
vtysh <<EOF
configure

vrf vrf100
 vni 10100
exit-vrf

router bgp 50
 address-family l2vpn evpn
  advertise-all-vni
 exit-address-family
exit

router bgp 100 vrf vrf100
exit
EOF
```

TL;DR; When we configure `advertise-all-vni` (in this case), a new BGP instance
is created with the name vrf100, and ASN 50. Next, when we create
`router bgp 100 vrf vrf100`, we look for the BGP instance with the same name
and we found it, but ASNs are different 50 vs. 100.

Every such a new auto created instance is flagged with BGP_VRF_AUTO.

After the fix:

```
router bgp 50
 !
 address-family l2vpn evpn
  advertise-all-vni
 exit-address-family
exit
!
router bgp 100 vrf vrf100
exit
!
end
donatas.net(config)# router bgp 51
BGP is already running; AS is 50
donatas.net(config)# router bgp 50
donatas.net(config-router)# router bgp 101 vrf vrf100
BGP is already running; AS is 100
donatas.net(config)# router bgp 100 vrf vrf100
donatas.net(config-router)#
```

Fixes: https://github.com/FRRouting/frr/issues/16152
Fixes: https://github.com/FRRouting/frr/issues/9537
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agoMerge pull request #16160 from opensourcerouting/fix/revert_39e27b840e5ddc2087c0b20cf...
Russ White [Tue, 4 Jun 2024 14:56:33 +0000 (10:56 -0400)]
Merge pull request #16160 from opensourcerouting/fix/revert_39e27b840e5ddc2087c0b20cfcf379745b3baa79

Revert "isisd: When the metric-type is configured as "wide", the IS-I…