]> git.puffer.fish Git - mirror/frr.git/log
mirror/frr.git
11 months agoMerge pull request #16109 from donaldsharp/seg6_topotest_fix
Donatas Abraitis [Thu, 30 May 2024 10:59:06 +0000 (13:59 +0300)]
Merge pull request #16109 from donaldsharp/seg6_topotest_fix

tests: Fix zebra_seg6_route

11 months agoMerge pull request #16102 from lsang6WIND/relative_path
Donald Sharp [Wed, 29 May 2024 19:19:17 +0000 (15:19 -0400)]
Merge pull request #16102 from lsang6WIND/relative_path

yang: use relative path instead of absolute one for route-map

11 months agotests: Fix zebra_seg6_route 16109/head
Donald Sharp [Wed, 29 May 2024 18:52:44 +0000 (14:52 -0400)]
tests: Fix zebra_seg6_route

Locally this test would occassionally fail for me
because the connected route the sharp route being
installed has not fully come up yet due to heavy
load and start up slowness.  Add a bit of code
to look for the problem and make sure it doesn't
happen.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
11 months agoMerge pull request #16098 from LabNConsulting/aceelindem/ospfv3-route-asbr-change
Donald Sharp [Wed, 29 May 2024 12:58:42 +0000 (08:58 -0400)]
Merge pull request #16098 from LabNConsulting/aceelindem/ospfv3-route-asbr-change

ospf6d: OSPFv3 route change comparision fixed for ASBR-only change

11 months agoMerge pull request #16097 from opensourcerouting/fix/safety_check_for_extcommunities
Donald Sharp [Wed, 29 May 2024 12:55:08 +0000 (08:55 -0400)]
Merge pull request #16097 from opensourcerouting/fix/safety_check_for_extcommunities

bgpd: Make sure we have enough data to handle extended link bandwidth

11 months agoyang: use relative path instead of absolute one for route-map 16102/head
Loïc Sang [Tue, 28 May 2024 16:27:40 +0000 (18:27 +0200)]
yang: use relative path instead of absolute one for route-map

Using absolute xpath is not optimal for finding the target node. As the
route map configuration grows, the yang validation will take more time
to complete. Relative paths are much faster.

Tested with a config file that contains ~3k route map config lines.
- before:
time cat conf | vtysh
configure
log syslog errors
router bgp 65000
!
route-map RM:BGP:VPNV4:PEER:VRR9:IN10001 permit 101
 match community CL:HCC:PATH_PRIO1_EAST1
  set local-preference 15200
!
...
route-map RM:BGP:VPNV4:PEER:VRR9:IN10001 permit 1182
 match community CL:HCC:PATH_PRIO1_EAST1082
 set local-preference 16281
!

real    13m51.500s
user    0m0.522s
sys     0m4.854s

- after:
time cat conf | vtysh
...
real    0m48.390s
user    0m0.384s
sys     0m1.245s

Signed-off-by: Loïc Sang <loic.sang@6wind.com>
11 months agoMerge pull request #15082 from louis-6wind/fix-iff-lower-up
Igor Ryzhov [Tue, 28 May 2024 21:01:20 +0000 (00:01 +0300)]
Merge pull request #15082 from louis-6wind/fix-iff-lower-up

lib: take into account the Linux IFF_LOWER_UP flag

11 months agoospf6d: OSPFv3 route change comparision fixed for ASBR-only change 16098/head
Acee [Tue, 28 May 2024 14:02:27 +0000 (10:02 -0400)]
ospf6d: OSPFv3 route change comparision fixed for ASBR-only change

When a router route already exists in the area border routers table
as an ABR and it solely changes its ABR or ASBR status, the change
was missed and border route is not updated. This fixes the comparison
for the router_bits in the ospf6_path structure.

This fixes issue https://github.com/FRRouting/frr/issues/16053 although
the actual problem is not the computing router (r2) and not the OSPFv3
redistribution (r3).

Signed-off-by: Acee <aceelindem@gmail.com>
11 months agoMerge pull request #16055 from acooks-at-bda/cleanup-some-ospf6-lsa-macros
Donald Sharp [Tue, 28 May 2024 17:15:54 +0000 (13:15 -0400)]
Merge pull request #16055 from acooks-at-bda/cleanup-some-ospf6-lsa-macros

Cleanup some OSPF6_LSA_ macros

11 months agoMerge pull request #16075 from anlancs/ospfd/fix-cmd-instance
Donald Sharp [Tue, 28 May 2024 17:06:43 +0000 (13:06 -0400)]
Merge pull request #16075 from anlancs/ospfd/fix-cmd-instance

ospfd: add instance id for one command

11 months agoMerge pull request #15993 from zhou-run/202405091114
Russ White [Tue, 28 May 2024 15:23:32 +0000 (11:23 -0400)]
Merge pull request #15993 from zhou-run/202405091114

isisd: fix crash when deactivating ISIS adjacency on the interface.

11 months agoMerge pull request #16083 from opensourcerouting/fix/overflow_bgp_dynamic_capability
Russ White [Tue, 28 May 2024 14:31:42 +0000 (10:31 -0400)]
Merge pull request #16083 from opensourcerouting/fix/overflow_bgp_dynamic_capability

BGP dynamic capability some fixes

11 months agoMerge pull request #16023 from opensourcerouting/fix/rpki_show_stuff
Russ White [Tue, 28 May 2024 14:23:10 +0000 (10:23 -0400)]
Merge pull request #16023 from opensourcerouting/fix/rpki_show_stuff

bgpd: Split `rpki cache` command into separate per SSH/TCP

11 months agoMerge pull request #16091 from y-bharath14/srib-topotests-commits
Donald Sharp [Tue, 28 May 2024 14:07:12 +0000 (10:07 -0400)]
Merge pull request #16091 from y-bharath14/srib-topotests-commits

tests: Organizing variables using format method

11 months agoisisd: fix crash when deactivating ISIS adjacency on the interface. 15993/head
zhou-run [Sat, 11 May 2024 07:30:38 +0000 (15:30 +0800)]
isisd: fix crash when deactivating ISIS adjacency on the interface.

1. When the command "no <ip|ipv6> router isis WORD" is executed on the interface, it invokes list_delete_all_node to iterate and release the memory of all nodes in the cirtcuit->u.bc.adjdb[1] linked list. However, the nodes are not unlinked during this traversal process, leading to the call of *list->del to delete the data of the linked list nodes.

2. For ISIS, deleting the data of the linked list nodes is done by calling isis_delete_adj. Subsequently, isis_level2_adj_up will be called to iterate and query the cirtcuit->u.bc.adjdb[1] linked list. If there are many neighbors on this interface, accessing the memory of the released linked list nodes may occur.

3. Not limited to ISIS, if the linked list is not unlinked during the deletion of all nodes in process 1, *list->del should not be allowed to iterate through the list again.

The backtrace is as follows:

(gdb) bt
    at isisd/isis_csm.c:196
    context=<optimized out>) at lib/northbound.c:1131
    errmsg_len=errmsg_len@entry=8192) at lib/northbound.c:1356
    at lib/northbound.c:1473
    errmsg=errmsg@entry=0x7ffc0ced38d0 "", errmsg_len=errmsg_len@entry=8192) at lib/northbound.c:906
    comment=comment@entry=0x0, transaction_id=transaction_id@entry=0x0, errmsg=errmsg@entry=0x7ffc0ced38d0 "", errmsg_len=8192) at lib/northbound.c:938
    filter=FILTER_RELAXED) at lib/command.c:971
    at lib/command.c:1030
    vtysh=vtysh@entry=0) at lib/command.c:1198
    at isisd/isis_csm.c:196
    context=<optimized out>) at lib/northbound.c:1131
    errmsg_len=errmsg_len@entry=8192) at lib/northbound.c:1356
    at lib/northbound.c:1473
    errmsg=errmsg@entry=0x7ffc0ced38d0 "", errmsg_len=errmsg_len@entry=8192) at lib/northbound.c:906
    comment=comment@entry=0x0, transaction_id=transaction_id@entry=0x0, errmsg=errmsg@entry=0x7ffc0ced38d0 "", errmsg_len=8192) at lib/northbound.c:938
    filter=FILTER_RELAXED) at lib/command.c:971
    at lib/command.c:1030
    vtysh=vtysh@entry=0) at lib/command.c:1198
0  0x00007f7d6e541fe1 in raise () from /lib/x86_64-linux-gnu/libpthread.so.0
1  0x00007f7d6e63188c in core_handler (signo=11, siginfo=0x7ffc0ced2630, context=<optimized out>) at lib/sigevent.c:262
2  <signal handler called>
3  0x00005647f5b11568 in isis_level2_adj_up (area=area@entry=0x5647f7c89830) at isisd/isis_lsp.c:423
4  0x00005647f5b14073 in isis_reset_attach_bit (adj=0x5647f7cad690) at isisd/isis_lsp.c:474
5  lsp_handle_adj_state_change (adj=0x5647f7cad690) at isisd/isis_lsp.c:2162
6  0x00005647f5b53675 in hook_call_isis_adj_state_change_hook (adj=adj@entry=0x5647f7cad690) at isisd/isis_adjacency.c:152
7  0x00005647f5b536f3 in isis_delete_adj (arg=0x5647f7cad690) at isisd/isis_adjacency.c:167
8  0x00007f7d6e5fe003 in list_delete_all_node (list=0x5647f7c88060) at lib/linklist.c:316
9  0x00007f7d6e5fe069 in list_delete (list=list@entry=0x5647f7c84708) at lib/linklist.c:326
10 0x00005647f5b0872e in isis_circuit_down (circuit=0x5647f7c84620) at isisd/isis_circuit.c:835
11 0x00005647f5b09f81 in isis_csm_state_change (event=event@entry=IF_DOWN_FROM_Z, circuit=circuit@entry=0x5647f7c84620, arg=arg@entry=0x5647f7c7f7a0)
   at isisd/isis_csm.c:196
12 0x00005647f5b083b0 in isis_circuit_disable (circuit=0x5647f7c84620) at isisd/isis_circuit.c:100
13 isis_circuit_del (circuit=0x5647f7c84620) at isisd/isis_circuit.c:200
14 0x00005647f5b434f5 in lib_interface_isis_destroy (args=<optimized out>) at isisd/isis_nb_config.c:2612
15 0x00007f7d6e61347a in nb_callback_destroy (errmsg_len=2, errmsg=0x7ffc0ced38d0 "", dnode=0x5647f7c948f0, event=NB_EV_APPLY, nb_node=<optimized out>,
   context=<optimized out>) at lib/northbound.c:1131
16 nb_callback_configuration (context=<optimized out>, event=event@entry=NB_EV_APPLY, change=change@entry=0x5647f7cb6680, errmsg=errmsg@entry=0x7ffc0ced38d0 "",
   errmsg_len=errmsg_len@entry=8192) at lib/northbound.c:1356
17 0x00007f7d6e6138b7 in nb_transaction_process (errmsg_len=8192, errmsg=0x7ffc0ced38d0 "", transaction=0x5647f7c94080, event=NB_EV_APPLY)
   at lib/northbound.c:1473
18 nb_candidate_commit_apply (transaction=0x5647f7c94080, save_transaction=save_transaction@entry=true, transaction_id=transaction_id@entry=0x0,
   errmsg=errmsg@entry=0x7ffc0ced38d0 "", errmsg_len=errmsg_len@entry=8192) at lib/northbound.c:906
19 0x00007f7d6e61403d in nb_candidate_commit (context=context@entry=0x7ffc0ced38c0, candidate=<optimized out>, save_transaction=save_transaction@entry=true,
   comment=comment@entry=0x0, transaction_id=transaction_id@entry=0x0, errmsg=errmsg@entry=0x7ffc0ced38d0 "", errmsg_len=8192) at lib/northbound.c:938
20 0x00007f7d6e616ec9 in nb_cli_classic_commit (vty=0x5647f7cae160) at lib/northbound_cli.c:64
21 0x00007f7d6e6176a8 in nb_cli_apply_changes (vty=0x5647f7cae160, xpath_base_fmt=<optimized out>) at lib/northbound_cli.c:268
22 0x00007f7d6e5d918e in cmd_execute_command_real (vline=vline@entry=0x5647f7cae140, vty=vty@entry=0x5647f7cae160, cmd=cmd@entry=0x0, up_level=up_level@entry=0,
   filter=FILTER_RELAXED) at lib/command.c:971
23 0x00007f7d6e5d951d in cmd_execute_command (vline=vline@entry=0x5647f7cae140, vty=vty@entry=0x5647f7cae160, cmd=cmd@entry=0x0, vtysh=vtysh@entry=0)
   at lib/command.c:1030
24 0x00007f7d6e5d9770 in cmd_execute (vty=vty@entry=0x5647f7cae160, cmd=cmd@entry=0x5647f7cb48a0 "no ip router isis 10", matched=matched@entry=0x0,
   vtysh=vtysh@entry=0) at lib/command.c:1198
25 0x00007f7d6e6485e6 in vty_command (vty=vty@entry=0x5647f7cae160, buf=0x5647f7cb48a0 "no ip router isis 10") at lib/vty.c:483
26 0x00007f7d6e648d01 in vty_execute (vty=vty@entry=0x5647f7cae160) at lib/vty.c:1246
27 0x00007f7d6e64ba40 in vtysh_read (thread=<optimized out>) at lib/vty.c:2090
28 0x00007f7d6e64348d in thread_call (thread=thread@entry=0x7ffc0ced8310) at lib/thread.c:1958
29 0x00007f7d6e5fd4a8 in frr_run (master=0x5647f79a43d0) at lib/libfrr.c:1184
30 0x00005647f5b050f3 in main (argc=5, argv=<optimized out>, envp=<optimized out>) at isisd/isis_main.c:273
(gdb) f 3
423     isisd/isis_lsp.c: No such file or directory.
(gdb) p node
$1 = (struct listnode *) 0x110
(gdb) f 8
316     lib/linklist.c: No such file or directory.
(gdb) p list->head->data
$2 = (void *) 0x5647f7cabf20
(gdb) p list->head->next->data
$3 = (void *) 0x5647f7c9bb60
(gdb) p list->head->next->next->data
Cannot access memory at address 0x120
(gdb) p list->head->next->next
$4 = (struct listnode *) 0x110

The backtrace provided above pertains to version 8.2.2, but it seems that the same issue exists in the code of the master branch as well.

isis_reset_attach_bit() is useless because lsp_handle_adj_state_change() unconditionally calls lsp_regenerate_schedule.

Signed-off-by: zhou-run <166502045+zhou-run@users.noreply.github.com>
11 months agoospf6d: replace OSPF6_LSA_SIZE with ospf6_lsa_size 16055/head
Andrew Cooks [Tue, 28 May 2024 04:07:14 +0000 (14:07 +1000)]
ospf6d: replace OSPF6_LSA_SIZE with ospf6_lsa_size

Dropping the macro enables better compiler type checking.

The macro was not used consistently when reading the lsa size from the
header, so this change also aims to use the replacement inline function
consistently.

Keeping the inline function has (marginal) utility in that it ensures that
the endian conversion is consistently performed.

Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
11 months agoospf6d: replace OSPF6_LSA_END with ospf6_lsa_end
Andrew Cooks [Tue, 21 May 2024 00:39:47 +0000 (10:39 +1000)]
ospf6d: replace OSPF6_LSA_END with ospf6_lsa_end

Replacing the macro with an inline function enables better type
checking.

No functional change.

Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
11 months agoospf6d: replace OSPF6_LSA_HEADER_END macro
Andrew Cooks [Mon, 20 May 2024 23:47:20 +0000 (09:47 +1000)]
ospf6d: replace OSPF6_LSA_HEADER_END macro

Replacing the macro with an inline function allows the compiler to
check the parameter type.

Use the replacement function consistently to reduce the number of
open coded pointer cast plus offset calculations.

use tools/indent.py to reformat all occurences of its use.

Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
11 months agoMerge pull request #16089 from LabNConsulting/chopps/docfix
Donatas Abraitis [Mon, 27 May 2024 08:04:49 +0000 (11:04 +0300)]
Merge pull request #16089 from LabNConsulting/chopps/docfix

doc: add missing required newline in .rst formatting

11 months agotests: Organizing variables using format method 16091/head
Y Bharath [Mon, 27 May 2024 06:50:25 +0000 (12:20 +0530)]
tests: Organizing variables using format method

Using format method to look code more presentable and readable

Signed-off-by: y-bharath14 <y.bharath@samsung.com>
11 months agodoc: add missing required newline in .rst formatting 16089/head
Christian Hopps [Sun, 26 May 2024 22:12:28 +0000 (22:12 +0000)]
doc: add missing required newline in .rst formatting

Signed-off-by: Christian Hopps <chopps@labn.net>
11 months agobgpd: Make sure we have enough data to handle extended link bandwidth 16097/head
Donatas Abraitis [Sun, 26 May 2024 15:49:22 +0000 (18:49 +0300)]
bgpd: Make sure we have enough data to handle extended link bandwidth

Extended link bandwidth is encoded inside extended community as a ipv6-address
specific extended community, but with a malformed packet we should do the
sanity check here to have enough data. Especially before doing ptr_get_be64().

Reported-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
11 months agobgpd: Add a safety check for ecommunity_ecom2str
Donatas Abraitis [Sun, 26 May 2024 15:45:01 +0000 (18:45 +0300)]
bgpd: Add a safety check for ecommunity_ecom2str

Just in case we have enough data according to the community unit size. It
should be 8 or 20 (for now).

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
11 months agobgpd: Convert unk_ecom to boolean
Donatas Abraitis [Sun, 26 May 2024 15:43:43 +0000 (18:43 +0300)]
bgpd: Convert unk_ecom to boolean

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
11 months agoMerge pull request #16070 from Pdoijode/pdoijode/lcomm-not-found-fix
Donatas Abraitis [Sun, 26 May 2024 14:51:29 +0000 (17:51 +0300)]
Merge pull request #16070 from Pdoijode/pdoijode/lcomm-not-found-fix

bgpd: Return success if lcomm/comm/extcomm name or entry is not found

11 months agodoc: adjust one ospf command 16075/head
anlan_cs [Thu, 23 May 2024 14:08:28 +0000 (22:08 +0800)]
doc: adjust one ospf command

Signed-off-by: anlan_cs <anlan_cs@tom.com>
11 months agoospfd: add instance id for one command
anlan_cs [Thu, 23 May 2024 13:49:28 +0000 (21:49 +0800)]
ospfd: add instance id for one command

Add the specific instance id for the command:
```
show ip ospf [{(1-65535)$instance|vrf <NAME|all>}] graceful-restart helper [detail] [json]
```

Signed-off-by: anlan_cs <anlan_cs@tom.com>
11 months agoMerge pull request #15674 from Orange-OpenSource/ospfd-te
Jafar Al-Gharaibeh [Fri, 24 May 2024 19:30:39 +0000 (14:30 -0500)]
Merge pull request #15674 from Orange-OpenSource/ospfd-te

ospfd: Solved crash in RI parsing with OSPF TE

11 months agobgpd: Removed unused COMMUNITY_LIST_ERR_CANT_FIND_LIST 16070/head
Pooja Jagadeesh Doijode [Fri, 17 May 2024 19:37:24 +0000 (12:37 -0700)]
bgpd: Removed unused COMMUNITY_LIST_ERR_CANT_FIND_LIST

Removed the unused COMMUNITY_LIST_ERR_CANT_FIND_LIST

Ticket:#3900813
Testing Done: precommit

Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
11 months agobgpd: Return success if lcomm/comm/extcomm name or entry is not found
Pooja Jagadeesh Doijode [Fri, 17 May 2024 19:03:20 +0000 (12:03 -0700)]
bgpd: Return success if lcomm/comm/extcomm name or entry is not found

Problem:
Currently bgp prints `Can't find community-list` and returns CMD_WARNING_CONFIG_FAILED
error if name or an entry for community, large-community and ext-community is not found. This
causes frr-reload to fail.

Fix:
Return success if community, large-community and ext-community name or
an entry is not found.

Ticket:#3900813
Testing Done:

Before fix:
```
root@tor-4:mgmt:/var/home/cumulus# cat /etc/frr/frr.conf
<SNIP>
bgp large-community-list standard lc22 seq 10 permit 4200857911:011:01 4200857911:011:011555
no bgp large-community-list standard lc22 seq 10 permit 4200857911:011:01
<SNIP>

root@tor-4:mgmt:/var/home/cumulus# systemctl reload frr
Job for frr.service failed.
See "systemctl status frr.service" and "journalctl -xeu frr.service" for details.

Syslog:
<SNIP>
2024-05-21T21:02:51.525965+00:00 tor-4 frrinit.sh[2349145]: % Can't find community-list
2024-05-21T21:02:51.526487+00:00 tor-4 staticd[6167]: [VTVCM-Y2NW3] Configuration Read in Took: 00:00:00
2024-05-21T21:02:51.526595+00:00 tor-4 frrinit.sh[2349155]: [2349155|staticd] done
2024-05-21T21:02:51.526826+00:00 tor-4 frrinit.sh[2349145]: line 176: Failure to communicate[13] to bgpd, line: no bgp large-community-list standard lc22 seq 10 permit 4200857911:011:01
2024-05-21T21:02:51.527928+00:00 tor-4 frrinit.sh[2349153]: [2349153|watchfrr] done
2024-05-21T21:02:51.528382+00:00 tor-4 frrinit.sh[2349145]: [2349145|bgpd] Configuration file[/etc/frr/frr.conf] processing failure: 13
<SNIP>
```

After fix:
```
root@tor-4:mgmt:/var/home/cumulus# cat /etc/frr/frr.conf
<SNIP>
bgp large-community-list standard lc22 seq 10 permit 4200857911:011:01 4200857911:011:011555
no bgp large-community-list standard lc22 seq 10 permit 4200857911:011:01
<SNIP>

root@tor-4:mgmt:/var/home/cumulus# systemctl reload frr
root@tor-4:mgmt:/var/home/cumulus#

root@tor-4:mgmt:/var/home/cumulus# vtysh -c "show run" | grep lc22
bgp large-community-list standard lc22 seq 10 permit 4200857911:11:1 4200857911:11:11555
root@tor-4:mgmt:/var/home/cumulus#
```

Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
Signed-off-by: Chirag Shah <chirag@nvidia.com>
11 months agobgpd: Check if FQDN capability length is in valid ranges 16083/head
Donatas Abraitis [Fri, 24 May 2024 06:58:30 +0000 (09:58 +0300)]
bgpd: Check if FQDN capability length is in valid ranges

If FQDN capability comes as dynamic capability we should check if the encoding
is proper.

Before this patch we returned an error if the hostname/domainname length check
was > end. But technically, if the length is also == end, this is
a malformed capability, because we use the data incorrectly after we check the
length.

This causes heap overflow (when compiled with address-sanitizer).

Signed-off-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
11 months agobgpd: Send a notification if we receive CAPABILITY message if not exepected
Donatas Abraitis [Fri, 24 May 2024 05:50:49 +0000 (08:50 +0300)]
bgpd: Send a notification if we receive CAPABILITY message if not exepected

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
11 months agobgpd: Add sanity check for capability lengths before processing them
Donatas Abraitis [Thu, 23 May 2024 20:02:03 +0000 (23:02 +0300)]
bgpd: Add sanity check for capability lengths before processing them

This is for CAPABILITY messages, not for OPEN message capabilities.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
11 months agoMerge pull request #16044 from louis-6wind/fix-loopback-leak
Donatas Abraitis [Fri, 24 May 2024 07:13:01 +0000 (10:13 +0300)]
Merge pull request #16044 from louis-6wind/fix-loopback-leak

bgpd: fix route leaking from the default l3vrf

11 months agoMerge pull request #16021 from louis-6wind/debug-isis-psid-asan
Donatas Abraitis [Thu, 23 May 2024 20:07:07 +0000 (23:07 +0300)]
Merge pull request #16021 from louis-6wind/debug-isis-psid-asan

isisd: fix heap-after-free with prefix sid

11 months agoMerge pull request #16069 from louis-6wind/fix-show-isis-algo
Donatas Abraitis [Thu, 23 May 2024 10:38:02 +0000 (13:38 +0300)]
Merge pull request #16069 from louis-6wind/fix-show-isis-algo

isisd: fix show isis algorithm

11 months agoospfd: protect call to get_edge() in ospf_te.c 15674/head
Olivier Dugeon [Tue, 16 Apr 2024 14:42:06 +0000 (16:42 +0200)]
ospfd: protect call to get_edge() in ospf_te.c

During fuzzing, Iggy Frankovic discovered that get_edge() function in ospf_te.c
could return null pointer, in particular when the link_id or advertised router
IP addresses are fuzzed. As the null pointer returned by get_edge() function is
not handlei by calling functions, this could cause ospfd crash.

This patch introduces new verification of returned pointer by get_edge()
function and stop the processing in case of null pointer. In addition, link ID
and advertiser router ID are validated before calling ls_find_edge_by_key() to
avoid the creation of a new edge with an invalid key.

CVE-2024-34088

Co-authored-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
11 months agoospfd: Correct Opaque LSA Extended parser
Olivier Dugeon [Fri, 5 Apr 2024 10:57:11 +0000 (12:57 +0200)]
ospfd: Correct Opaque LSA Extended parser

Iggy Frankovic discovered another ospfd crash when performing fuzzing of OSPF
LSA packets. The crash occurs in ospf_te_parse_ext_link() function when
attemping to read Segment Routing Adjacency SID subTLVs. The original code
doesn't check if the size of the Extended Link TLVs and subTLVs have the correct
length. In presence of erronous LSA, this will cause a buffer overflow and ospfd
crashes.

This patch introduces new verification of the subTLVs size for Extended Link
TLVs and subTLVs. Similar check has been also introduced for the Extended
Prefix TLV.

Co-authored-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
11 months agoospfd: Solved crash in RI parsing with OSPF TE
Olivier Dugeon [Wed, 3 Apr 2024 14:28:23 +0000 (16:28 +0200)]
ospfd: Solved crash in RI parsing with OSPF TE

Iggy Frankovic discovered another ospfd crash when performing fuzzing of OSPF
LSA packets. The crash occurs in ospf_te_parse_ri() function when attemping to
read Segment Routing subTLVs. The original code doesn't check if the size of
the SR subTLVs have the correct length. In presence of erronous LSA, this will
cause a buffer overflow and ospfd crash.

This patch introduces new verification of the subTLVs size for Router
Information TLV.

Co-authored-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
11 months agozebra: Deny the routes if ip protocol CLI refers to an undefined rmap
Pooja Jagadeesh Doijode [Thu, 16 May 2024 23:36:18 +0000 (16:36 -0700)]
zebra: Deny the routes if ip protocol CLI refers to an undefined rmap

Currently zebra does not deny the routes if `ip protocol <proto> route-map
FOO`
commmand is configured with reference to an undefined route-map (FOO in
this case).
However, on FRR restart, in zebra_route_map_check() routes get denied
if route-map name is available but the route-map is not defined. This
change was introduced in fd303a4ba14c762550db972317e1e88528768005.

Fix:
When `ip protocol <proto> route-map FOO` CLI is configured with reference to an
undefined route-map FOO, let the processing in ip_protocol_rm_add() and
ip_protocol_rm_del() go through so that zebra can deny the routes instead
of simply returning. This will result in consistent behavior.

Testing Done:

Before fix:
```
spine-1# configure
spine-1(config)# ip protocol bgp route-map rmap7

root@spine-1:mgmt:/var/home/cumulus# vtysh -c "show run" | grep rmap7
ip protocol bgp route-map rmap7
root@spine-1:mgmt:/var/home/cumulus#

spine-1(config)# do show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, A - Babel, D - SHARP, F - PBR, f - OpenFabric,
       Z - FRR,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup
       t - trapped, o - offload failure

C>* 27.0.0.1/32 is directly connected, lo, 02:27:45
B>* 27.0.0.3/32 [20/0] via fe80::202:ff:fe00:21, downlink_1, weight 1, 02:27:35
B>* 27.0.0.4/32 [20/0] via fe80::202:ff:fe00:29, downlink_2, weight 1, 02:27:40
B>* 27.0.0.5/32 [20/0] via fe80::202:ff:fe00:31, downlink_3, weight 1, 02:27:40
B>* 27.0.0.6/32 [20/0] via fe80::202:ff:fe00:39, downlink_4, weight 1, 02:27:40
```

After fix:
```
spine-1(config)# ip protocol bgp route-map route-map67
spine-1(config)# do show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, A - Babel, D - SHARP, F - PBR, f - OpenFabric,
       Z - FRR,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup
       t - trapped, o - offload failure

C>* 27.0.0.1/32 is directly connected, lo, 00:35:03
B   27.0.0.3/32 [20/0] via fe80::202:ff:fe00:21, downlink_1 inactive, weight 1, 00:34:58
B   27.0.0.4/32 [20/0] via fe80::202:ff:fe00:29, downlink_2 inactive, weight 1, 00:34:57
B   27.0.0.5/32 [20/0] via fe80::202:ff:fe00:31, downlink_3 inactive, weight 1, 00:34:57
B   27.0.0.6/32 [20/0] via fe80::202:ff:fe00:39, downlink_4 inactive, weight 1, 00:34:58
spine-1(config)#

root@spine-1:mgmt:/var/home/cumulus# ip route show
root@spine-1:mgmt:/var/home/cumulus#
```

Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
11 months agoisisd: fix show isis segment-routing node algorithm 16069/head
Louis Scalbert [Wed, 22 May 2024 11:34:01 +0000 (13:34 +0200)]
isisd: fix show isis segment-routing node algorithm

Fix an issue where "show isis segment-routing node algorithm" displays
"IS-IS X SR-Nodes:" for absent flex-algorithms.

> IS-IS L2 SR-Nodes:
>
> IS-IS L2 SR-Nodes:
> [...]

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
11 months agoisisd: fix show isis topology display
Louis Scalbert [Wed, 22 May 2024 11:30:05 +0000 (13:30 +0200)]
isisd: fix show isis topology display

Fix "Area X:" display for fabricd

Fixes: f185005b2f ("isisd: fix the display topology command")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
11 months agoisisd: fix show isis route algorithm crash
Louis Scalbert [Wed, 22 May 2024 09:30:24 +0000 (11:30 +0200)]
isisd: fix show isis route algorithm crash

Fix crash with "show isis route algorithm X" command.

Fixes: 88e368b4dc ("isisd: make optional algorithm id in 'show isis route'")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
11 months agoisisd: fix heap-after-free with prefix sid 16021/head
Louis Scalbert [Thu, 16 May 2024 14:44:03 +0000 (16:44 +0200)]
isisd: fix heap-after-free with prefix sid

> ==2334217==ERROR: AddressSanitizer: heap-use-after-free on address 0x61000001d0a0 at pc 0x563828c8de6f bp 0x7fffbdaee560 sp 0x7fffbdaee558
> READ of size 1 at 0x61000001d0a0 thread T0
>     #0 0x563828c8de6e in prefix_sid_cmp isisd/isis_spf.c:187
>     #1 0x7f84b8204f71 in hash_get lib/hash.c:142
>     #2 0x7f84b82055ec in hash_lookup lib/hash.c:184
>     #3 0x563828c8e185 in isis_spf_prefix_sid_lookup isisd/isis_spf.c:209
>     #4 0x563828c90642 in isis_spf_add2tent isisd/isis_spf.c:598
>     #5 0x563828c91cd0 in process_N isisd/isis_spf.c:824
>     #6 0x563828c93852 in isis_spf_process_lsp isisd/isis_spf.c:1041
>     #7 0x563828c98dde in isis_spf_loop isisd/isis_spf.c:1821
>     #8 0x563828c998de in isis_run_spf isisd/isis_spf.c:1983
>     #9 0x563828c99c7b in isis_run_spf_with_protection isisd/isis_spf.c:2009
>     #10 0x563828c9a60d in isis_run_spf_cb isisd/isis_spf.c:2090
>     #11 0x7f84b835c72d in event_call lib/event.c:2011
>     #12 0x7f84b8236d93 in frr_run lib/libfrr.c:1217
>     #13 0x563828c21918 in main isisd/isis_main.c:346
>     #14 0x7f84b7e4fd09 in __libc_start_main ../csu/libc-start.c:308
>     #15 0x563828c20df9 in _start (/usr/lib/frr/isisd+0xf5df9)
>
> 0x61000001d0a0 is located 96 bytes inside of 184-byte region [0x61000001d040,0x61000001d0f8)
> freed by thread T0 here:
>     #0 0x7f84b88a9b6f in __interceptor_free ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:123
>     #1 0x7f84b8263bae in qfree lib/memory.c:130
>     #2 0x563828c8e433 in isis_vertex_del isisd/isis_spf.c:249
>     #3 0x563828c91c95 in process_N isisd/isis_spf.c:811
>     #4 0x563828c93852 in isis_spf_process_lsp isisd/isis_spf.c:1041
>     #5 0x563828c98dde in isis_spf_loop isisd/isis_spf.c:1821
>     #6 0x563828c998de in isis_run_spf isisd/isis_spf.c:1983
>     #7 0x563828c99c7b in isis_run_spf_with_protection isisd/isis_spf.c:2009
>     #8 0x563828c9a60d in isis_run_spf_cb isisd/isis_spf.c:2090
>     #9 0x7f84b835c72d in event_call lib/event.c:2011
>     #10 0x7f84b8236d93 in frr_run lib/libfrr.c:1217
>     #11 0x563828c21918 in main isisd/isis_main.c:346
>     #12 0x7f84b7e4fd09 in __libc_start_main ../csu/libc-start.c:308
>
> previously allocated by thread T0 here:
>     #0 0x7f84b88aa037 in __interceptor_calloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:154
>     #1 0x7f84b8263a6c in qcalloc lib/memory.c:105
>     #2 0x563828c8e262 in isis_vertex_new isisd/isis_spf.c:225
>     #3 0x563828c904db in isis_spf_add2tent isisd/isis_spf.c:588
>     #4 0x563828c91cd0 in process_N isisd/isis_spf.c:824
>     #5 0x563828c93852 in isis_spf_process_lsp isisd/isis_spf.c:1041
>     #6 0x563828c98dde in isis_spf_loop isisd/isis_spf.c:1821
>     #7 0x563828c998de in isis_run_spf isisd/isis_spf.c:1983
>     #8 0x563828c99c7b in isis_run_spf_with_protection isisd/isis_spf.c:2009
>     #9 0x563828c9a60d in isis_run_spf_cb isisd/isis_spf.c:2090
>     #10 0x7f84b835c72d in event_call lib/event.c:2011
>     #11 0x7f84b8236d93 in frr_run lib/libfrr.c:1217
>     #12 0x563828c21918 in main isisd/isis_main.c:346
>     #13 0x7f84b7e4fd09 in __libc_start_main ../csu/libc-start.c:308
>
> SUMMARY: AddressSanitizer: heap-use-after-free isisd/isis_spf.c:187 in prefix_sid_cmp
> Shadow bytes around the buggy address:
>   0x0c207fffb9c0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
>   0x0c207fffb9d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fa
>   0x0c207fffb9e0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
>   0x0c207fffb9f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fa
>   0x0c207fffba00: fa fa fa fa fa fa fa fa fd fd fd fd fd fd fd fd
> =>0x0c207fffba10: fd fd fd fd[fd]fd fd fd fd fd fd fd fd fd fd fa
>   0x0c207fffba20: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
>   0x0c207fffba30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fa
>   0x0c207fffba40: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
>   0x0c207fffba50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fa
>   0x0c207fffba60: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
> Shadow byte legend (one shadow byte represents 8 application bytes):
>   Addressable:           00
>   Partially addressable: 01 02 03 04 05 06 07
>   Heap left redzone:       fa
>   Freed heap region:       fd
>   Stack left redzone:      f1
>   Stack mid redzone:       f2
>   Stack right redzone:     f3
>   Stack after return:      f5
>   Stack use after scope:   f8
>   Global redzone:          f9
>   Global init order:       f6
>   Poisoned by user:        f7
>   Container overflow:      fc
>   Array cookie:            ac
>   Intra object redzone:    bb
>   ASan internal:           fe
>   Left alloca redzone:     ca
>   Right alloca redzone:    cb
>   Shadow gap:              cc
> ==2334217==ABORTING

Fixes: 2f7cc7bcd3 ("isisd: detect Prefix-SID collisions and handle them appropriately")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
11 months agoMerge pull request #16032 from Pdoijode/pdoijode/zebra-rt-deny-fix
Russ White [Tue, 21 May 2024 14:52:52 +0000 (10:52 -0400)]
Merge pull request #16032 from Pdoijode/pdoijode/zebra-rt-deny-fix

zebra: Deny the routes if ip protocol CLI refers to an undefined rmap

11 months agobgpd: Rename SERVER_PUBKEY to KNOWN_HOSTS_PATH 16023/head
Donatas Abraitis [Tue, 21 May 2024 06:00:24 +0000 (09:00 +0300)]
bgpd: Rename SERVER_PUBKEY to KNOWN_HOSTS_PATH

SERVER_PUBKEY is not the best name to describe what it really is.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
11 months agobgpd: Split `rpki cache` command into separate per SSH/TCP
Donatas Abraitis [Thu, 16 May 2024 20:27:34 +0000 (23:27 +0300)]
bgpd: Split `rpki cache` command into separate per SSH/TCP

Current command (bundled two into one) is absolutely wrong.

When you configure TCP session with the source, the command thinks, that
it's a SSH session with a username.

It's much better to split this into two separate commands where it's much
easier to do the changes in the future (if more options comes in).

Yes, this is a breaking change, but there is no other proper way to overcome
this.

Bonus note how it looks, which also can lead to crashes (due to port 0x0):

```
(gdb) p *cache->tr_config.ssh_config
$11 = {host = 0x5555562f9cd0 "1.1.1.1", port = 0, bindaddr = 0x0,
  username = 0x55555629ad00 "",
  server_hostkey_path = 0x7ffff53667a0 <rpki_create_socket> "Uf\017\357\300H\211\345AWAVAUATSH\201", <incomplete sequence \354\230>, client_privkey_path = 0x0,
  data = 0x0, new_socket = 0x51, connect_timeout = 4143762592,
  password = 0x7ffff6fccca0 <main_arena+96> "\300\"0VUU"}
(gdb) p *cache->tr_config.tcp_config
$12 = {host = 0x5555562f9cd0 "1.1.1.1", port = 0x0, bindaddr = 0x0,
  data = 0x55555629ad00, new_socket = 0x7ffff53667a0 <rpki_create_socket>,
  connect_timeout = 0}
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
11 months agoMerge pull request #16052 from donaldsharp/show_ip_route_summary
Russ White [Mon, 20 May 2024 21:39:21 +0000 (17:39 -0400)]
Merge pull request #16052 from donaldsharp/show_ip_route_summary

Show ip route summary

11 months agoMerge pull request #16037 from zhou-run/202405111552
Russ White [Mon, 20 May 2024 21:35:54 +0000 (17:35 -0400)]
Merge pull request #16037 from zhou-run/202405111552

isisd: fix crash when configuring the circuit type for the interface.

11 months agozebra: Deny the routes if ip protocol CLI refers to an undefined rmap 16032/head
Pooja Jagadeesh Doijode [Thu, 16 May 2024 23:36:18 +0000 (16:36 -0700)]
zebra: Deny the routes if ip protocol CLI refers to an undefined rmap

Currently zebra does not deny the routes if `ip protocol <proto> route-map
FOO`
commmand is configured with reference to an undefined route-map (FOO in
this case).
However, on FRR restart, in zebra_route_map_check() routes get denied
if route-map name is available but the route-map is not defined. This
change was introduced in fd303a4ba14c762550db972317e1e88528768005.

Fix:
When `ip protocol <proto> route-map FOO` CLI is configured with reference to an
undefined route-map FOO, let the processing in ip_protocol_rm_add() and
ip_protocol_rm_del() go through so that zebra can deny the routes instead
of simply returning. This will result in consistent behavior.

Testing Done:

Before fix:
```
spine-1# configure
spine-1(config)# ip protocol bgp route-map rmap7

root@spine-1:mgmt:/var/home/cumulus# vtysh -c "show run" | grep rmap7
ip protocol bgp route-map rmap7
root@spine-1:mgmt:/var/home/cumulus#

spine-1(config)# do show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, A - Babel, D - SHARP, F - PBR, f - OpenFabric,
       Z - FRR,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup
       t - trapped, o - offload failure

C>* 27.0.0.1/32 is directly connected, lo, 02:27:45
B>* 27.0.0.3/32 [20/0] via fe80::202:ff:fe00:21, downlink_1, weight 1, 02:27:35
B>* 27.0.0.4/32 [20/0] via fe80::202:ff:fe00:29, downlink_2, weight 1, 02:27:40
B>* 27.0.0.5/32 [20/0] via fe80::202:ff:fe00:31, downlink_3, weight 1, 02:27:40
B>* 27.0.0.6/32 [20/0] via fe80::202:ff:fe00:39, downlink_4, weight 1, 02:27:40
```

After fix:
```
spine-1(config)# ip protocol bgp route-map route-map67
spine-1(config)# do show ip route
Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, A - Babel, D - SHARP, F - PBR, f - OpenFabric,
       Z - FRR,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup
       t - trapped, o - offload failure

C>* 27.0.0.1/32 is directly connected, lo, 00:35:03
B   27.0.0.3/32 [20/0] via fe80::202:ff:fe00:21, downlink_1 inactive, weight 1, 00:34:58
B   27.0.0.4/32 [20/0] via fe80::202:ff:fe00:29, downlink_2 inactive, weight 1, 00:34:57
B   27.0.0.5/32 [20/0] via fe80::202:ff:fe00:31, downlink_3 inactive, weight 1, 00:34:57
B   27.0.0.6/32 [20/0] via fe80::202:ff:fe00:39, downlink_4 inactive, weight 1, 00:34:58
spine-1(config)#

root@spine-1:mgmt:/var/home/cumulus# ip route show
root@spine-1:mgmt:/var/home/cumulus#
```

Signed-off-by: Pooja Jagadeesh Doijode <pdoijode@nvidia.com>
11 months agodoc: Add missing `show ip route summ` command 16052/head
Donald Sharp [Mon, 20 May 2024 19:46:29 +0000 (15:46 -0400)]
doc: Add missing `show ip route summ` command

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
11 months agodoc: Fixup `show ip route` command doc
Donald Sharp [Mon, 20 May 2024 19:44:00 +0000 (15:44 -0400)]
doc: Fixup `show ip route` command doc

The documentation for this command is just... wrong.
Let's clean it up.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
11 months agoMerge pull request #15980 from donaldsharp/agentx_update
Donatas Abraitis [Mon, 20 May 2024 19:33:01 +0000 (22:33 +0300)]
Merge pull request #15980 from donaldsharp/agentx_update

*: Modify agentx to be allowed to be called

11 months agoMerge pull request #16022 from opensourcerouting/fix/match_peer
Donald Sharp [Mon, 20 May 2024 13:57:20 +0000 (09:57 -0400)]
Merge pull request #16022 from opensourcerouting/fix/match_peer

bgpd: Fix `match peer` when switching between IPv4/IPv6/interface

11 months agoMerge pull request #16033 from opensourcerouting/fix/typo_soft_version_capability
Donald Sharp [Mon, 20 May 2024 13:45:41 +0000 (09:45 -0400)]
Merge pull request #16033 from opensourcerouting/fix/typo_soft_version_capability

bgpd: Fix logging message when receiving a software version capability

11 months agobgpd, tests: fix route leaking from the default l3vrf 16044/head
Louis Scalbert [Fri, 17 May 2024 15:57:46 +0000 (17:57 +0200)]
bgpd, tests: fix route leaking from the default l3vrf

Leaked route from the l3VRF are installed with the loopback as the
nexthop interface instead of the real interface.

> B>* 10.0.0.0/30 [20/0] is directly connected, lo (vrf default), weight 1, 00:21:01

Routing of packet from a L3VRF to the default L3VRF destined to a leak
prefix fails because of the default routing rules on Linux.

> 0:      from all lookup local
> 1000:   from all lookup [l3mdev-table]
> 32766:  from all lookup main
> 32767:  from all lookup default

When the packet is received in the loopback interface, the local rules
are checked without match, then the l3mdev-table says to route to the
loopback. A routing loop occurs (TTL is decreasing).

> 12:26:27.928748 ens37 In  IP (tos 0x0, ttl 64, id 26402, offset 0, flags [DF], proto ICMP (1), length 84)
>     10.0.0.2 > 10.0.1.2: ICMP echo request, id 47463, seq 1, length 64
> 12:26:27.928784 red   Out IP (tos 0x0, ttl 63, id 26402, offset 0, flags [DF], proto ICMP (1), length 84)
>     10.0.0.2 > 10.0.1.2: ICMP echo request, id 47463, seq 1, length 64
> 12:26:27.928797 ens38 Out IP (tos 0x0, ttl 63, id 26402, offset 0, flags [DF], proto ICMP (1), length 84)
>     10.0.0.2 > 10.0.1.2: ICMP echo request, id 47463, seq 1, length 64

Do not set the lo interface as a nexthop interface. Keep the real
interface where possible.

Fixes: db7cf73a33 ("bgpd: fix interface on leaks from redistribute connected")
Fixes: 067fbab4e4 ("bgpd: fix interface on leaks from network statement")
Fixes: 8a02d9fe1e ("bgpd: Set nh ifindex to VRF's interface, not the real")
Fixes: https://github.com/FRRouting/frr/issues/15909
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
11 months agoMerge pull request #16035 from raja-rajasekar/rajasekarr/backpressure_infinite_loop
Donatas Abraitis [Mon, 20 May 2024 06:54:04 +0000 (09:54 +0300)]
Merge pull request #16035 from raja-rajasekar/rajasekarr/backpressure_infinite_loop

bgpd: backpressure - Fix to avoid CPU hog

11 months agoMerge pull request #16034 from raja-rajasekar/rajasekarr/backpressure_l3_evpn_fix
Donatas Abraitis [Mon, 20 May 2024 06:50:55 +0000 (09:50 +0300)]
Merge pull request #16034 from raja-rajasekar/rajasekarr/backpressure_l3_evpn_fix

bgpd: backpressure - Fix to withdraw evpn type-5 routes immediately

11 months agoMerge pull request #16019 from anlancs/ldpd/fix-cmd-1
Donatas Abraitis [Sat, 18 May 2024 13:11:39 +0000 (16:11 +0300)]
Merge pull request #16019 from anlancs/ldpd/fix-cmd-1

zebra: fix mpls command

11 months agoMerge pull request #16009 from anlancs/zebra/fix-fpm-nl
Donatas Abraitis [Sat, 18 May 2024 13:11:10 +0000 (16:11 +0300)]
Merge pull request #16009 from anlancs/zebra/fix-fpm-nl

zebra: fix wrong fpm packet header

11 months agoisisd: fix crash when configuring the circuit type for the interface. 16037/head
zhou-run [Sat, 18 May 2024 03:13:35 +0000 (11:13 +0800)]
isisd: fix crash when configuring the circuit type for the interface.

1. When both Router A and Router B are configured with "is-type level-1," the area->is_type will be assigned the value IS_LEVEL_1, and circuit->is_type will also be assigned the value IS_LEVEL_1.
2. Configuring the circuit type "isis circuit-type level-1-2" for the interface of Router A will inadvertently call lib_interface_isis_circuit_type_modify to assign circuit->is_type the value IS_LEVEL_1_AND_2. This causes the hello packets reception and transmission, as well as the reception of LSP/SNP packets, to check circuit->is_type, allowing the level-2 hello packets to be sent and received normally, and level-2 LSP/SNP packets to be received normally.
3. When Router B modifies the configuration to "is-type level-2," and Router A and Router B establish a level-2 neighbor relationship, Router B sends level-2 LSP packets to Router A. Upon receiving these, Router A calls isis_spf_schedule to calculate the level-2 SPT, which results in accessing a null pointer.
When defining the behavior of the ISIS router, the call to isis_area_is_type_set will check that area->is_type is not IS_LEVEL_1_AND_2, and it disallows circuit->is_type_config from overriding circuit->is_type. Therefore, when configuring the circuit type for the interface of Router A, it should also check that area->is_type is not IS_LEVEL_1_AND_2 and disallow circuit->is_type_config from overriding circuit->is_type.

Signed-off-by: zhou-run <166502045+zhou-run@users.noreply.github.com>
11 months agobgpd: backpressure - Fix to avoid CPU hog 16035/head
Rajasekar Raja [Fri, 17 May 2024 22:43:59 +0000 (15:43 -0700)]
bgpd: backpressure - Fix to avoid CPU hog

In case when bgp_evpn_free or bgp_delete is called and the announce_list
has few items where vpn/bgp does not match, we add the item back to the
list. Because of this the list count is always > 0 thereby hogging CPU or
infinite loop.

Ticket: #3905624

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
11 months agobgpd: backpressure - Fix to withdraw evpn type-5 routes immediately 16034/head
Rajasekar Raja [Fri, 17 May 2024 19:36:31 +0000 (12:36 -0700)]
bgpd: backpressure - Fix to withdraw evpn type-5 routes immediately

As part of backpressure changes, there is a bug where immediate withdraw
is to be sent for evpn imported type-5 prefix to clear the nh neigh and
RMAC entry.

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

Ticket: #3905571

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
11 months agobgpd: Fix logging message when receiving a software version capability 16033/head
Donatas Abraitis [Fri, 17 May 2024 19:04:40 +0000 (22:04 +0300)]
bgpd: Fix logging message when receiving a software version capability

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
11 months agoMerge pull request #16012 from LabNConsulting/chopps/improve-grpc-test
Donald Sharp [Fri, 17 May 2024 15:48:27 +0000 (11:48 -0400)]
Merge pull request #16012 from LabNConsulting/chopps/improve-grpc-test

tests: improve the grpc query client and topotest

11 months agoMerge pull request #16001 from EasyNetDev/dpdk->=22.11-API-fix
Donald Sharp [Fri, 17 May 2024 13:41:59 +0000 (09:41 -0400)]
Merge pull request #16001 from EasyNetDev/dpdk->=22.11-API-fix

zebra: Update Zebra DPDK >=22.11 API

11 months agoMerge pull request #16024 from LabNConsulting/chopps/grpc-unit-test-fix
Donald Sharp [Fri, 17 May 2024 11:23:39 +0000 (07:23 -0400)]
Merge pull request #16024 from LabNConsulting/chopps/grpc-unit-test-fix

tests: embed YANG in mgmtd unit-test bin

11 months agoMerge pull request #16020 from louis-6wind/fix-bgp-llgr
Donatas Abraitis [Fri, 17 May 2024 06:39:51 +0000 (09:39 +0300)]
Merge pull request #16020 from louis-6wind/fix-bgp-llgr

bgpd: fix dynamic peer graceful restart race condition

11 months agotests: embed YANG in mgmtd unit-test bin 16024/head
Christian Hopps [Fri, 17 May 2024 04:54:20 +0000 (00:54 -0400)]
tests: embed YANG in mgmtd unit-test bin

`make check` should run w/o installing FRR first. Thus we need to embed
the yang modules otherwise mgmtd unit-test fails.

Signed-off-by: Christian Hopps <chopps@labn.net>
11 months agobgpd: Fix `match peer` when switching between IPv4/IPv6/interface 16022/head
Donatas Abraitis [Thu, 16 May 2024 17:49:56 +0000 (20:49 +0300)]
bgpd: Fix `match peer` when switching between IPv4/IPv6/interface

Without this patch we MUST follow this sequence:

```
no match peer 10.0.0.1
match peer 2a01::1
```

Otherwise, both IPv4/IPv6 values are set/compiled, thus when printing the
configuration in show running, we see the first one (IPv4).

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
11 months agozebra: fix mpls command 16019/head
anlan_cs [Thu, 16 May 2024 08:44:45 +0000 (16:44 +0800)]
zebra: fix mpls command

Configured with "mpls label bind 1.1.1.1/32 explicit-null", the running
configuration is:
```
!
mpls label bind 1.1.1.1/32 IPv4 Explicit Null
!
```

After this commit, the running configuration is:
```
!
mpls label bind 1.1.1.1/32 explicit-null
!
```

And add the support for the "no" form:
```
anlan(config)# mpls label bind 1.1.1.1/32 explicit-null
anlan(config)# no mpls label bind 1.1.1.1/32 explicit-null
```

Signed-off-by: anlan_cs <anlan_cs@tom.com>
11 months agoMerge pull request #16014 from pguibert6WIND/nexthop_rework
Donatas Abraitis [Thu, 16 May 2024 15:10:46 +0000 (18:10 +0300)]
Merge pull request #16014 from pguibert6WIND/nexthop_rework

Nexthop display rework

11 months agobgpd: fix dynamic peer graceful restart race condition 16020/head
Louis Scalbert [Thu, 16 May 2024 13:08:09 +0000 (15:08 +0200)]
bgpd: fix dynamic peer graceful restart race condition

bgp_llgr topotest sometimes fails at step 8:

> topo: STEP 8: 'Check if we can see 172.16.1.2/32 after R4 (dynamic peer) was killed'

R4 neighbor is deleted on R2 because it fails to re-connect:

> 14:33:40.128048 BGP: [HKWM3-ZC5QP] 192.168.3.1 fd -1 went from Established to Clearing
> 14:33:40.128154 BGP: [MJ1TJ-HEE3V] 192.168.3.1(r4) graceful restart timer expired
> 14:33:40.128158 BGP: [ZTA2J-YRKGY] 192.168.3.1(r4) graceful restart stalepath timer stopped
> 14:33:40.128162 BGP: [H917J-25EWN] 192.168.3.1(r4) Long-lived stale timer (IPv4 Unicast) started for 20 sec
> 14:33:40.128168 BGP: [H5X66-NXP9S] 192.168.3.1(r4) Long-lived set stale community (LLGR_STALE) for: 172.16.1.2/32
> 14:33:40.128220 BGP: [H5X66-NXP9S] 192.168.3.1(r4) Long-lived set stale community (LLGR_STALE) for: 192.168.3.0/24
> [...]
> 14:33:41.138869 BGP: [RGGAC-RJ6WG] 192.168.3.1 [Event] Connect failed 111(Connection refused)
> 14:33:41.138906 BGP: [ZWCSR-M7FG9] 192.168.3.1 [FSM] TCP_connection_open_failed (Connect->Active), fd 23
> 14:33:41.138912 BGP: [JA9RP-HSD1K] 192.168.3.1 (dynamic neighbor) deleted (bgp_connect_fail)
> 14:33:41.139126 BGP: [P98A2-2RDFE] 192.168.3.1(r4) graceful restart stalepath timer stopped

af8496af08 ("bgpd: Do not delete BGP dynamic peers if graceful restart
kicks in") forgot to modify bgp_connect_fail()

Do not delete the peer in bgp_connect_fail() if Non-Stop-Forwarding is
in progress.

Fixes: af8496af08 ("bgpd: Do not delete BGP dynamic peers if graceful restart kicks in")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
11 months agozebra: Update Zebra for DPDK >=22.11 API 16001/head
EasyNetDev [Mon, 13 May 2024 14:30:45 +0000 (17:30 +0300)]
zebra: Update Zebra for DPDK >=22.11 API

* Starting from version DPDK 22.11 we have API changes:
The rte_driver and rte_device objects are now opaque and must be manipulated through added accessors.

We need to update Zebra DPDK sources to DPDK version >=22.11

* Fix clang-format

Signed-off-by: EasyNet <devel@easynet.dev>
11 months agozebra: fix dump SR-TE information if available 16014/head
Philippe Guibert [Wed, 15 May 2024 13:36:04 +0000 (15:36 +0200)]
zebra: fix dump SR-TE information if available

The SR-TE color of nexthop should be displayed in all situations.

Fixes: 553c8048460a ("zebra: fix JSON fields for 'show ip/ipv6 nht'")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
11 months agozebra, lib: move nexthop display helper to lib folder
Philippe Guibert [Wed, 3 Jan 2024 20:33:58 +0000 (21:33 +0100)]
zebra, lib: move nexthop display helper to lib folder

The zebra_nexthop_vty_helper() and zebra_nexthop_json_helper()
functions could be very helpful to display nexthop information
from whatever daemon.

Move the core function in the nexthop_vty_helper() and the
nexthop_json_helper() function. The zebra API call remains
unchanged.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
11 months agoMerge pull request #16008 from mjstapp/show_routemap_source
Russ White [Wed, 15 May 2024 10:18:41 +0000 (06:18 -0400)]
Merge pull request #16008 from mjstapp/show_routemap_source

zebra: include route source set by route-map in show output

11 months agotests: improve the grpc query client and topotest 16012/head
Christian Hopps [Wed, 15 May 2024 03:36:38 +0000 (23:36 -0400)]
tests: improve the grpc query client and topotest

- Add separate get, get-config, get-state operations to query command, as
well as switching default output to JSON.
- Add an `--xml` to change the output format.
- move printss to logging.debug so output is a machine parseable result.

Signed-off-by: Christian Hopps <chopps@labn.net>
11 months agoMerge pull request #16006 from pguibert6WIND/fix_colored_nexthop_2
Russ White [Tue, 14 May 2024 20:28:31 +0000 (16:28 -0400)]
Merge pull request #16006 from pguibert6WIND/fix_colored_nexthop_2

bgpd: fix colored routes not installed after a switchover

11 months agoMerge pull request #15876 from opensourcerouting/typesafe-expand
Mark Stapp [Tue, 14 May 2024 19:16:42 +0000 (15:16 -0400)]
Merge pull request #15876 from opensourcerouting/typesafe-expand

python: add tool to expand typesafe definitions

11 months agoMerge pull request #15973 from piotrsuchy/json_ip_access
Russ White [Tue, 14 May 2024 16:08:50 +0000 (12:08 -0400)]
Merge pull request #15973 from piotrsuchy/json_ip_access

lib, vtysh: fix 'show ip[v6] access-list ... json' formatting

11 months agoMerge pull request #16007 from pguibert6WIND/fix_bmp_experimental
Russ White [Tue, 14 May 2024 16:08:09 +0000 (12:08 -0400)]
Merge pull request #16007 from pguibert6WIND/fix_bmp_experimental

bgpd: fixes bmp stats send-experimental configuration

11 months agozebra: fix wrong fpm packet header 16009/head
anlan_cs [Tue, 14 May 2024 15:25:32 +0000 (23:25 +0800)]
zebra: fix wrong fpm packet header

Signed-off-by: anlan_cs <anlan_cs@tom.com>
11 months agozebra: include route source set by route-map in show output 16008/head
Mark Stapp [Tue, 14 May 2024 14:28:17 +0000 (10:28 -0400)]
zebra: include route source set by route-map in show output

Include the prefix source address when set by a route-map in
show output for routes, in various formats.
Add some debugs when encoding netlink route messages with
a source address.

Signed-off-by: Mark Stapp <mjs@cisco.com>
11 months agobgpd: fixes bmp stats send-experimental configuration 16007/head
Philippe Guibert [Tue, 14 May 2024 12:52:23 +0000 (14:52 +0200)]
bgpd: fixes bmp stats send-experimental configuration

Unconfiguring the send-experimental stats in BMP has no effect
on the current behavior.

Fixes this by swapping the configuration boolean.

Fixes: 7ba991cf963f ("bgpd: add 'bmp stat send-experimental' command")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
11 months agobgpd: fix colored routes not installed after a switchover 16006/head
Philippe Guibert [Tue, 14 May 2024 09:51:50 +0000 (11:51 +0200)]
bgpd: fix colored routes not installed after a switchover

On a multihomed setup with colored bgp updates, when the primary
PE goes offline, only a small subset of colored bgp routes are
not switching to the secondary pe.

When a switchover happens, due to a remote IP becoming unreachable,
some nexthop tracking down notifications are sent, but those messages
are completely ignored for colored bgp updates.

The original code has been thought for mounting up the SR-TE service,
when IP reachability is ok, but not when services goes offline.

Fix this by extending the down notification mechanism for colored routes
too.

Fixes: 545aeef1d13e ("bgpd: extend the NHT code to understand SR-TE colors")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
11 months agolib, vtysh, topotests: fix 'show ip[v6] access-list ... json' formatting 15973/head
Piotr Suchy [Wed, 8 May 2024 21:04:04 +0000 (21:04 +0000)]
lib, vtysh, topotests: fix 'show ip[v6] access-list ... json' formatting

Similarly to recently fixed 'show ip[v6] prefix-list ...' - PR#15750,
json output is not valid for 'show ip[v6] access-list ... json' commands,
as it goes through all the running daemons and for each one it calls
'filter_show' creating a new json object. To aggreagate the output
and create a valid json that can later be parsed, the commands were
moved to vtysh and formatted accordingly

Signed-off-by: Piotr Suchy <piotrsuchy@proton.me>
11 months agoMerge pull request #16003 from pguibert6WIND/fix_colored_nexthop
Russ White [Mon, 13 May 2024 19:31:44 +0000 (15:31 -0400)]
Merge pull request #16003 from pguibert6WIND/fix_colored_nexthop

bgpd: fix colored nexthops resolution

11 months agoMerge pull request #15911 from opensourcerouting/feature/bgpd_dampening_per_neighbor
Russ White [Mon, 13 May 2024 17:55:24 +0000 (13:55 -0400)]
Merge pull request #15911 from opensourcerouting/feature/bgpd_dampening_per_neighbor

bgpd: per-neighbor dampening support

11 months agobgpd: fix colored nexthops resolution 16003/head
Philippe Guibert [Mon, 13 May 2024 15:42:30 +0000 (17:42 +0200)]
bgpd: fix colored nexthops resolution

When the SR-TE service is off, colored BGP routes are not
selected if it is recursively resolved over routes that are
colored only.

Actually, a BGP nexthop context includes the color attribute;
when an update from ZEBRA is received, there is no color, and
the colored BGP nexthop contexts are parsed, only if there
is a non colored BGP nexthop context. The actual setup shows
this may not be the case every time.

Fix this by parsing all the colored BGP nexthop contexts.

Fixes: b8210849b8ac ("bgpd: Make bgp ready to remove distinction between 2 nh tracking types")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
11 months agoMerge pull request #15961 from opensourcerouting/fix/allow_using_match_tag_0
Donald Sharp [Mon, 13 May 2024 13:59:36 +0000 (09:59 -0400)]
Merge pull request #15961 from opensourcerouting/fix/allow_using_match_tag_0

lib: Allow doing match/set tag untagged

11 months agoMerge pull request #15655 from idryzhov/isis-fix-subtlv-bit
Donatas Abraitis [Mon, 13 May 2024 08:10:38 +0000 (11:10 +0300)]
Merge pull request #15655 from idryzhov/isis-fix-subtlv-bit

isisd: fix ip/ipv6 reachability tlvs

11 months agoMerge pull request #15968 from donaldsharp/parse_attr_problems
Donatas Abraitis [Sat, 11 May 2024 11:44:29 +0000 (14:44 +0300)]
Merge pull request #15968 from donaldsharp/parse_attr_problems

Parse attr problems

11 months agoMerge pull request #15614 from louis-6wind/fix-6pe-address
Donatas Abraitis [Fri, 10 May 2024 19:55:12 +0000 (22:55 +0300)]
Merge pull request #15614 from louis-6wind/fix-6pe-address

bgpd: fix ipv4-mapped ipv6 on non 6pe

11 months ago*: Modify agentx to be allowed to be called 15980/head
Donald Sharp [Thu, 9 May 2024 11:47:29 +0000 (07:47 -0400)]
*: Modify agentx to be allowed to be called

If you had a situation where an operator turned on
ospfd with snmp but not ospf6d and agentx was configured
then you get into a situation where ospf6d would complain
that the config for agentx did not exist.  Let's modify
the code to allow this situation to happen.

Fixes: #15896
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
11 months agoMerge pull request #15976 from opensourcerouting/build-more-xref-setup
Christian Hopps [Fri, 10 May 2024 14:14:44 +0000 (10:14 -0400)]
Merge pull request #15976 from opensourcerouting/build-more-xref-setup

build: throw in a few more `XREF_SETUP`

11 months agotests: Check if `set/match tag untagged` works 15961/head
Donatas Abraitis [Fri, 10 May 2024 07:21:54 +0000 (10:21 +0300)]
tests: Check if `set/match tag untagged` works

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
11 months agolib: Allow doing match/set tag untagged
Donatas Abraitis [Wed, 8 May 2024 19:25:38 +0000 (22:25 +0300)]
lib: Allow doing match/set tag untagged

In route-map: `match tag untagged`.

E.g. Cisco/Juniper allows that, but they use `match tag 0` instead.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
11 months agoMerge pull request #15986 from mjstapp/more_rtas
Jafar Al-Gharaibeh [Fri, 10 May 2024 06:22:27 +0000 (01:22 -0500)]
Merge pull request #15986 from mjstapp/more_rtas

zebra: add some more netlink RTA_ strings

11 months agozebra: add some more netlink RTA_ strings 15986/head
Mark Stapp [Thu, 9 May 2024 20:56:07 +0000 (16:56 -0400)]
zebra: add some more netlink RTA_ strings

Add a few more RTA_ attribute names to the netlink debug
output.

Signed-off-by: Mark Stapp <mjs@cisco.com>