]> git.puffer.fish Git - matthieu/frr.git/log
matthieu/frr.git
10 months agodoc: improve table-of-contents organization
Quentin Young [Tue, 25 Jun 2024 17:48:33 +0000 (13:48 -0400)]
doc: improve table-of-contents organization

The current TOC organization is not really following Sphinx best
practices and is resulting in a jumble of articles showing up in the
sidebar.

This change primarily organizes existing articles into three major
sections:

* Introduction
  - Contains system requirements, architecture & design, installation,
    basic setup
* Basics
  - Covers basic commands, concepts, and some random things that don't
    fit elsewhere
* Protocols
  - Contains all protocol documentation, and other miscellaneous daemon
    docs such as those on Zebra, watchfrr, mgmtd, etc.

The appendix has been left as is, but the TOC now has a caption which
has the effect of adding a section separator in the nav sidebar.

In order to make the new structure make sense:

* Some content has been lifted up from the "Overview" page into the
  index page
* Most content has been pushed down from the "Overview" page into the
  "About" page (new)
* BFD's page is now titled "BFD" for consistencty; it was the only one
  that had the full protocol name written out in the title

And a couple drivebys:
* BFD's intro description paragraph was rewritten to make more sense
* Old language stating that we publish platform packages on the Github
  releases page was removed
* References to source building instructions were consolidated into that
  section

Signed-off-by: Quentin Young <qlyoung@qlyoung.net>
10 months agoMerge pull request #16214 from opensourcerouting/fix/attr_encap_handling
Russ White [Tue, 25 Jun 2024 11:26:38 +0000 (07:26 -0400)]
Merge pull request #16214 from opensourcerouting/fix/attr_encap_handling

bgpd: A couple more fixes for Tunnel encapsulation handling

10 months agoMerge pull request #16273 from opensourcerouting/fix/bgpd_oad_rfc8212
Russ White [Tue, 25 Jun 2024 11:24:42 +0000 (07:24 -0400)]
Merge pull request #16273 from opensourcerouting/fix/bgpd_oad_rfc8212

bgpd: Relax OAD (One-Administration-Domain) for RFC8212

10 months agoMerge pull request #16270 from cscarpitta/fix/fix-coverity-issues
Donatas Abraitis [Tue, 25 Jun 2024 05:53:13 +0000 (08:53 +0300)]
Merge pull request #16270 from cscarpitta/fix/fix-coverity-issues

zebra: Fix coverity issues

10 months agoMerge pull request #16261 from chiragshah6/evpn_dev4
Donatas Abraitis [Tue, 25 Jun 2024 05:07:17 +0000 (08:07 +0300)]
Merge pull request #16261 from chiragshah6/evpn_dev4

zebra: clear evpn dup-addr return error-msg when there is no vni

10 months agoMerge pull request #16267 from louis-6wind/fix-isis-srv6-json
Russ White [Mon, 24 Jun 2024 21:18:03 +0000 (17:18 -0400)]
Merge pull request #16267 from louis-6wind/fix-isis-srv6-json

isisd: fix crash in display srv6 sid structure in json

10 months agoMerge pull request #16222 from opensourcerouting/fix/docker_alpine_no_grpc
Russ White [Mon, 24 Jun 2024 21:16:51 +0000 (17:16 -0400)]
Merge pull request #16222 from opensourcerouting/fix/docker_alpine_no_grpc

docker: Adopt for Alpine Linux 3.20

10 months agoMerge pull request #15838 from fdumontet6WIND/fix_regexx_exclude
Russ White [Mon, 24 Jun 2024 21:08:17 +0000 (17:08 -0400)]
Merge pull request #15838 from fdumontet6WIND/fix_regexx_exclude

 bgpd: fix "bgp as-pah access-list" with "set aspath exclude" set/unset issue

10 months agoMerge pull request #16213 from opensourcerouting/fix/fqdn_capability_parsing_for_dyna...
Russ White [Mon, 24 Jun 2024 20:38:58 +0000 (16:38 -0400)]
Merge pull request #16213 from opensourcerouting/fix/fqdn_capability_parsing_for_dynamic_capability

bgpd: Check if we have really enough data before doing memcpy for FQDN capability

10 months agoMerge pull request #16211 from opensourcerouting/fix/dynamic_software_version_sanity_...
Russ White [Mon, 24 Jun 2024 20:38:50 +0000 (16:38 -0400)]
Merge pull request #16211 from opensourcerouting/fix/dynamic_software_version_sanity_check

bgpd: Check if we have really enough data before doing memcpy for software version

10 months agoMerge pull request #16242 from opensourcerouting/fix/shutdown_peer_last_reset
Russ White [Mon, 24 Jun 2024 19:40:49 +0000 (15:40 -0400)]
Merge pull request #16242 from opensourcerouting/fix/shutdown_peer_last_reset

bgpd: Set last reset reason to admin shutdown if it was manually

10 months agobgpd: Relax OAD (One-Administration-Domain) for RFC8212
Donatas Abraitis [Mon, 24 Jun 2024 17:16:16 +0000 (20:16 +0300)]
bgpd: Relax OAD (One-Administration-Domain) for RFC8212

RFC 8212 defines leak prevention for eBGP peers, but BGP-OAD defines a new
peering type One Administrative Domain (OAD), where multiple ASNs could be used
inside a single administrative domain. OAD allows sending non-transitive attributes,
so this prevention should be relaxed too.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agoMerge pull request #16259 from opensourcerouting/pim-20240620-cand-rp-bsr-prep
Jafar Al-Gharaibeh [Mon, 24 Jun 2024 15:39:41 +0000 (11:39 -0400)]
Merge pull request #16259 from opensourcerouting/pim-20240620-cand-rp-bsr-prep

pimd: Candidate RP/BSR preparation

10 months agoisisd: fix srv6 endx sid key name
Louis Scalbert [Mon, 24 Jun 2024 11:38:37 +0000 (13:38 +0200)]
isisd: fix srv6 endx sid key name

srv6EndSID is actually srv6EndXSID.

Fixes: d5879267aa ("isisd: fix show database json format")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
10 months agoisisd: fix neighbor id json key
Louis Scalbert [Fri, 21 Jun 2024 09:18:59 +0000 (11:18 +0200)]
isisd: fix neighbor id json key

d5879267aa ("isisd: fix show database json format") renamed JSON keys to
a standard format but forgot to rename the neighbor-id key.

Fixes: d5879267aa ("isisd: fix show database json format")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
10 months agoisisd: remane flags_json variable
Louis Scalbert [Fri, 21 Jun 2024 09:17:32 +0000 (11:17 +0200)]
isisd: remane flags_json variable

The variable flags_json was incorrectly named, leading to confusion and
causing the bug fixed in the previous commit.

Rename the variable to refer to SRv6 End SID instead. Cosmetic change.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
10 months agoMerge pull request #16128 from LabNConsulting/aceelindem/ospf-ls-retrans-improve
Russ White [Mon, 24 Jun 2024 11:17:27 +0000 (07:17 -0400)]
Merge pull request #16128 from LabNConsulting/aceelindem/ospf-ls-retrans-improve

ospfd: Improve OSPF neighbor retransmission list granularity and pacing

10 months agozebra: Fix NULL pointer dereference
Carmine Scarpitta [Fri, 21 Jun 2024 15:47:46 +0000 (17:47 +0200)]
zebra: Fix NULL pointer dereference

The `locator` pointer is dereferenced before ensuring it is not NULL.
Fix the issue by checking that the pointer is not NULL before
dereferencing it.

Fixes 1594013

** CID 1594013:  Null pointer dereferences  (REVERSE_INULL)
/zebra/zebra_srv6.c: 961 in zebra_srv6_sid_compose()

________________________________________________________________________________________________________
*** CID 1594013:  Null pointer dereferences  (REVERSE_INULL)
/zebra/zebra_srv6.c: 961 in zebra_srv6_sid_compose()
955         struct srv6_locator *locator,
956         uint32_t sid_func)
957     {
958      uint8_t offset, func_len;
959      struct srv6_sid_format *format = locator->sid_format;
960
     CID 1594013:  Null pointer dereferences  (REVERSE_INULL)
     Null-checking "locator" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
961      if (!sid_value || !locator)
962      return false;
963
964      if (format) {
965      offset = format->block_len + format->node_len;
966      func_len = format->function_len;

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agozebra: Fix wrong variable used in `for` loop
Carmine Scarpitta [Fri, 21 Jun 2024 15:41:34 +0000 (17:41 +0200)]
zebra: Fix wrong variable used in `for` loop

The `for` loop starting at line 1848 searches the `func_allocated` array
for a pointer that points to a specific `sid_wide_func` element.

The loop should iterate over all the elements of the `func_allocated`
array and dereference each element to see if it is the one we are
looking for.

Currently, the loop is using the wrong variable to iterate over the
array.

Let's fix this issue by using the correct variable in the loop.

Fixes CID 1594014
Fixes CID 1594016

** CID 1594014:  Null pointer dereferences  (FORWARD_NULL)
/zebra/zebra_srv6.c: 1860 in release_srv6_sid_func_explicit()

________________________________________________________________________________________________________
*** CID 1594014:  Null pointer dereferences  (FORWARD_NULL)
/zebra/zebra_srv6.c: 1860 in release_srv6_sid_func_explicit()
1854
1855      /* Lookup SID function in the functions allocated list of EWLIB range */
1856      for (ALL_LIST_ELEMENTS_RO(block->u.usid
1857        .wide_lib[sid_func]
1858        .func_allocated,
1859        node, sid_func_ptr))
     CID 1594014:  Null pointer dereferences  (FORWARD_NULL)
     Dereferencing null pointer "sid_wide_func_ptr".
1860      if (*sid_wide_func_ptr == sid_wide_func)
1861      break;
1862
1863      /* Ensure that the SID function is allocated */
1864      if (!sid_wide_func_ptr) {
1865      zlog_warn("%s: failed to release wide SID function %u, function is not allocated",

** CID 1594016:  Possible Control flow issues  (DEADCODE)
/zebra/zebra_srv6.c: 1871 in release_srv6_sid_func_explicit()

________________________________________________________________________________________________________
*** CID 1594016:  Possible Control flow issues  (DEADCODE)
/zebra/zebra_srv6.c: 1871 in release_srv6_sid_func_explicit()
1865      zlog_warn("%s: failed to release wide SID function %u, function is not allocated",
1866        __func__, sid_wide_func);
1867      return -1;
1868      }
1869
1870      /* Release the SID function from the EWLIB range */
     CID 1594016:  Possible Control flow issues  (DEADCODE)
     Execution cannot reach this statement: "listnode_delete(block->u.us...".
1871      listnode_delete(block->u.usid.wide_lib[sid_func]
1872      .func_allocated,
1873      sid_wide_func_ptr);
1874      zebra_srv6_sid_func_free(sid_wide_func_ptr);
1875      } else {
1876      zlog_warn("%s: function %u is outside ELIB [%u/%u] and EWLIB alloc ranges [%u/%u]",

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agozebra: Remove dead SRv6 code
Carmine Scarpitta [Fri, 21 Jun 2024 15:01:49 +0000 (17:01 +0200)]
zebra: Remove dead SRv6 code

At line 1736, `alloc_mode` is set to `SRV6_SID_ALLOC_MODE_EXPLICIT` or
`SRV6_SID_ALLOC_MODE_DYNAMIC` depending on the `sid_value` variable.

There will never be a case where alloc_mode will be `SRV6_SID_ALLOC_MODE_MAX`
or `SRV6_SID_ALLOC_MODE_UNSPEC`.

Let's replace the `switch(alloc_mode) {...}` with an if-else.

Fixes CID 1594015.

** CID 1594015:    (DEADCODE)
/zebra/zebra_srv6.c: 1782 in get_srv6_sid()
/zebra/zebra_srv6.c: 1781 in get_srv6_sid()

________________________________________________________________________________________________________
*** CID 1594015:    (DEADCODE)
/zebra/zebra_srv6.c: 1782 in get_srv6_sid()
1776      }
1777
1778      ret = get_srv6_sid_dynamic(sid, ctx, locator);
1779
1780      break;
1781      case SRV6_SID_ALLOC_MODE_MAX:
     CID 1594015:    (DEADCODE)
     Execution cannot reach this statement: "case SRV6_SID_ALLOC_MODE_UN...".
1782      case SRV6_SID_ALLOC_MODE_UNSPEC:
1783      default:
1784      flog_err(EC_ZEBRA_SM_CANNOT_ASSIGN_SID,
1785       "%s: SRv6 Manager: Unrecognized alloc mode %u",
1786       __func__, alloc_mode);
1787      /* We should never arrive here */
/zebra/zebra_srv6.c: 1781 in get_srv6_sid()
1775      return -1;
1776      }
1777
1778      ret = get_srv6_sid_dynamic(sid, ctx, locator);
1779
1780      break;
     CID 1594015:    (DEADCODE)
     Execution cannot reach this statement: "case SRV6_SID_ALLOC_MODE_MAX:".
1781      case SRV6_SID_ALLOC_MODE_MAX:
1782      case SRV6_SID_ALLOC_MODE_UNSPEC:
1783      default:
1784      flog_err(EC_ZEBRA_SM_CANNOT_ASSIGN_SID,
1785       "%s: SRv6 Manager: Unrecognized alloc mode %u",
1786       __func__, alloc_mode);

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agoisisd: fix display crash srv6 sid structure in json
Louis Scalbert [Fri, 21 Jun 2024 08:59:43 +0000 (10:59 +0200)]
isisd: fix display crash srv6 sid structure in json

Fix a crash when doing "show isis database detail json" in
isis_srv6_topo1 topotest.

> #0  raise (sig=<optimized out>) at ../sysdeps/unix/sysv/linux/raise.c:50
> #1  0x00007fad89524e2c in core_handler (signo=6, siginfo=0x7ffe86a4b8b0, context=0x7ffe86a4b780) at lib/sigevent.c:258
> #2  <signal handler called>
> #3  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
> #4  0x00007fad8904e537 in __GI_abort () at abort.c:79
> #5  0x00007fad8904e40f in __assert_fail_base (fmt=0x7fad891c5688 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x7fad8a3e70e8 "json_object_get_type(jso) == json_type_object",
>     file=0x7fad8a3e7064 "./json_object.c", line=590, function=<optimized out>) at assert.c:92
> #6  0x00007fad8905d662 in __GI___assert_fail (assertion=0x7fad8a3e70e8 "json_object_get_type(jso) == json_type_object", file=0x7fad8a3e7064 "./json_object.c", line=590,
>     function=0x7fad8a3e7440 "json_object_object_add_ex") at assert.c:101
> #7  0x00007fad8a3dfe93 in json_object_object_add_ex () from /lib/x86_64-linux-gnu/libjson-c.so.5
> #8  0x000055708e3f8f7f in format_subsubtlv_srv6_sid_structure (sid_struct=0x602000172b70, buf=0x0, json=0x6040000a21d0, indent=6) at isisd/isis_tlvs.c:2880
> #9  0x000055708e3f9acb in isis_format_subsubtlvs (subsubtlvs=0x602000172b50, buf=0x0, json=0x6040000a21d0, indent=6) at isisd/isis_tlvs.c:3022
> #10 0x000055708e3eefb0 in format_item_ext_subtlvs (exts=0x614000047440, buf=0x0, json=0x6040000a2190, indent=2, mtid=2) at isisd/isis_tlvs.c:1313
> #11 0x000055708e3fd599 in format_item_extended_reach (mtid=2, i=0x60300015aed0, buf=0x0, json=0x6040000a1bd0, indent=0) at isisd/isis_tlvs.c:3763
> #12 0x000055708e40d46a in format_item (mtid=2, context=ISIS_CONTEXT_LSP, type=ISIS_TLV_MT_REACH, i=0x60300015aed0, buf=0x0, json=0x6040000a1bd0, indent=0) at isisd/isis_tlvs.c:6789
> #13 0x000055708e40d4fc in format_items_ (mtid=2, context=ISIS_CONTEXT_LSP, type=ISIS_TLV_MT_REACH, items=0x60600021d160, buf=0x0, json=0x6040000a1bd0, indent=0) at isisd/isis_tlvs.c:6804
> #14 0x000055708e40edbc in format_mt_items (context=ISIS_CONTEXT_LSP, type=ISIS_TLV_MT_REACH, m=0x6180000845d8, buf=0x0, json=0x6040000a1bd0, indent=0) at isisd/isis_tlvs.c:7147
> #15 0x000055708e4111e9 in format_tlvs (tlvs=0x618000084480, buf=0x0, json=0x6040000a1bd0, indent=0) at isisd/isis_tlvs.c:7572
> #16 0x000055708e4114ce in isis_format_tlvs (tlvs=0x618000084480, json=0x6040000a1bd0) at isisd/isis_tlvs.c:7613
> #17 0x000055708e36f167 in lsp_print_detail (lsp=0x612000058b40, vty=0x0, json=0x6040000a1bd0, dynhost=1 '\001', isis=0x60d00001f800) at isisd/isis_lsp.c:785
> #18 0x000055708e36f31f in lsp_print_all (vty=0x0, json=0x6040000a0490, head=0x61f000005488, detail=1 '\001', dynhost=1 '\001', isis=0x60d00001f800) at isisd/isis_lsp.c:820
> #19 0x000055708e4379fc in show_isis_database_lspdb_json (json=0x6040000a0450, area=0x61f000005480, level=0, lspdb=0x61f000005488, sysid_str=0x0, ui_level=1) at isisd/isisd.c:2683
> #20 0x000055708e437ef9 in show_isis_database_json (json=0x6040000a0310, sysid_str=0x0, ui_level=1, isis=0x60d00001f800) at isisd/isisd.c:2754
> #21 0x000055708e438357 in show_isis_database_common (vty=0x62e000060400, json=0x6040000a0310, sysid_str=0x0, ui_level=1, isis=0x60d00001f800) at isisd/isisd.c:2788
> #22 0x000055708e438591 in show_isis_database (vty=0x62e000060400, json=0x6040000a0310, sysid_str=0x0, ui_level=1, vrf_name=0x7fad89806300 <vrf_default_name> "default", all_vrf=false)
>     at isisd/isisd.c:2825
> #23 0x000055708e43891d in show_database (self=0x55708e5519c0 <show_database_cmd>, vty=0x62e000060400, argc=5, argv=0x6040000a02d0) at isisd/isisd.c:2855
> #24 0x00007fad893a9767 in cmd_execute_command_real (vline=0x60300015f220, vty=0x62e000060400, cmd=0x0, up_level=0) at lib/command.c:1002
> #25 0x00007fad893a9adc in cmd_execute_command (vline=0x60300015f220, vty=0x62e000060400, cmd=0x0, vtysh=0) at lib/command.c:1061
> #26 0x00007fad893aa728 in cmd_execute (vty=0x62e000060400, cmd=0x621000025900 "show isis database detail json ", matched=0x0, vtysh=0) at lib/command.c:1227

Note that prior to 2e670cd779, there was no crash but only the last
"srv6-sid-structure" was displayed. A "srv6-sid-structure" should be
displayed for each "sid". This commit also fix this.

Was:

> "srv6-lan-endx-sid": [
>   {
>     "sid": "fc00:0:1:1::",
>     "weight": 0,
>     "algorithm": "SPF",
>     "neighbor-id": "0000.0000.0002"
>   },
>   {
>     "sid": "fc00:0:1:2::",
>     "weight": 0,
>     "algorithm": "SPF",
>     "neighbor-id": "0000.0000.0003"
>   }
> ],
> "srv6-sid-structure": {
>   "loc-block-len": 32,
>   "loc-node-len": 16,
>   "func-len": 16,
>   "arg-len": 0
> },

Now (srv6-sid-structure are identical but they are not always):

> "srv6-lan-endx-sid": [
>   {
>     "sid": "fc00:0:1:1::",
>     "algorithm": "SPF",
>     "neighbor-id": "0000.0000.0002",
>     "srv6-sid-structure": {
>       "loc-block-len": 32,
>       "loc-node-len": 16,
>       "func-len": 8,
>       "arg-len": 0
>     },
>   },
>   {
>     "sid": "fc00:0:1:2::",
>     "algorithm": "SPF",
>     "neighbor-id": "0000.0000.0003",
>     "srv6-sid-structure": {
>       "loc-block-len": 32,
>       "loc-node-len": 16,
>       "func-len": 16,
>       "arg-len": 0
>     },
>   }
> ],

Fixes: 2e670cd779 ("isisd: fix display of srv6 subsubtlvs")
Fixes: 648a158802 ("isisd: Add SRv6 End.X SID to Sub-TLV format func")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
10 months agotools/checkpatch: accept pim_* typedefs
David Lamparter [Fri, 21 Jun 2024 09:32:05 +0000 (11:32 +0200)]
tools/checkpatch: accept pim_* typedefs

pimd uses "v4/v6 dispatch" typedefs.  Don't complain about those in
checkpatch.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
10 months agoMerge pull request #16252 from chiragshah6/evpn_dev1
Donatas Abraitis [Fri, 21 Jun 2024 06:46:07 +0000 (09:46 +0300)]
Merge pull request #16252 from chiragshah6/evpn_dev1

zebra: fix evpn mh bond member proto reinstall

10 months agoMerge pull request #16260 from pguibert6WIND/no_backup_nexthop_for_now
Donatas Abraitis [Fri, 21 Jun 2024 06:43:40 +0000 (09:43 +0300)]
Merge pull request #16260 from pguibert6WIND/no_backup_nexthop_for_now

bgpd: fix do not use api.backup_nexthop in ZAPI message

10 months agozebra: clear evpn dup-addr return error-msg when there is no vni
Sindhu Parvathi Gopinathan [Wed, 19 Jun 2024 14:35:31 +0000 (07:35 -0700)]
zebra: clear evpn dup-addr return error-msg when there is no vni

clear evpn dup-addr cli returns error-msg for below conditions,

 - If evpn is not enabled &
 - If there is no VNI exists.

supported command:

```
clear evpn dup-addr vni <vni-id>
```

Ticket: #3495573

Testing:

bharat# clear evpn dup-addr vni all
Error type: validation
Error description: % EVPN not enabled

bharat# clear evpn dup-addr vni 20
Error type: validation
Error description: % VNI 20 does not exist

Signed-off-by: Sindhu Parvathi Gopinathan's <sgopinathan@nvidia.com>
Signed-off-by: Chirag Shah <chirag@nvidia.com>
10 months agobgpd: fix do not use api.backup_nexthop in ZAPI message
Philippe Guibert [Thu, 20 Jun 2024 16:02:26 +0000 (18:02 +0200)]
bgpd: fix do not use api.backup_nexthop in ZAPI message

The backup_nexthop entry list has been populated by mistake,
and should not. Fix this by reverting the introduced behavior.

Fixes: 237ebf8d4503 ("bgpd: rework bgp_zebra_announce() function, separate nexthop handling")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
10 months agozebra: fix evpn mh bond member proto reinstall
Chirag Shah [Wed, 19 Jun 2024 00:21:49 +0000 (17:21 -0700)]
zebra: fix evpn mh bond member proto reinstall

In case of EVPN MH bond, a member port going in
protodown state due to external reason (one case being linkflap),
frr updates the state correctly but upon manually
clearing external reason trigger FRR to reinstate
protodown without any reason code.

Fix is to ensure if the protodown reason was external
and new state is to have protodown 'off' then do no reinstate
protodown.

Ticket: #3947432
Testing:
switch:#ip link show swp1
4: swp1: <NO-CARRIER,BROADCAST,MULTICAST,SLAVE,UP> mtu 9216 qdisc
   pfifo_fast master bond1 state DOWN mode DEFAULT group default qlen
   1000
       link/ether 1c:34:da:2c:aa:68 brd ff:ff:ff:ff:ff:ff protodown on
       protodown_reason <linkflap>

switch:#ip link set swp1 protodown off protodown_reason linkflap off
switch:#ip link show swp1
 4: swp1: <NO-CARRIER,BROADCAST,MULTICAST,SLAVE,UP> mtu 9216 qdisc
    pfifo_fast master bond1 state DOWN mode DEFAULT group default qlen
    1000
        link/ether 1c:34:da:2c:aa:68 brd ff:ff:ff:ff:ff:ff

Signed-off-by: Chirag Shah <chirag@nvidia.com>
10 months agoospfd: Improve OSPF neighbor retransmission list granularity and precision
Acee Lindem [Fri, 31 May 2024 14:08:04 +0000 (14:08 +0000)]
ospfd: Improve OSPF neighbor retransmission list granularity and precision

The current OSPF neighbor retransmission operates on a single per-neighbor
periodic timer that sends all LSAs on the list when it expires.
Additionally, since it skips the first retransmission of received LSAs so
that at least the retransmission interval (resulting in a delay of between
the retransmission interval and twice the interval. In environments where
the links are lossy on P2MP networks with "delay-reflood" configured (which
relies on neighbor retransmission in partial meshs), the implementation
is sub-optimal (to say the least).

This commit reimplements OSPF neighbor retransmission as follows:

   1. A new data structure making use the application managed
      typesafe.h doubly linked list implements an OSPF LSA
      list where each node includes a timestamp.
   2. The existing neighbor LS retransmission LSDB data structure
      is augmented with a pointer to the list node on the LSA
      list to faciliate O(1) removal when the LSA is acknowledged.
   3. The neighbor LS retransmission timer is set to the expiration
      timer of the LSA at the top of the list.
   4. When the timer expires, LSAs are retransmitted that within
      the window of the current time and a small delta (50 milli-secs
      default). The LSAs that are retransmited are given an updated
      retransmission time and moved to the end of the LSA list.
   5. Configuration is added to set the "retransmission-window" to a
      value other than 50 milliseconds.
   6. Neighbor and interface LSA retransmission counters are added
      to provide insight into the lossiness of the links. However,
      these will increment quickly on non-fully meshed P2MP networks
      with "delay-reflood" configured.
   7. Added a topotest to exercise the implementation on a non-fully
      meshed P2MP network with "delay-reflood" configured. The
      alternative was to use existing mechanisms to instroduce loss
      but these seem less determistic in a topotest.

Signed-off-by: Acee Lindem <acee@lindem.com>
10 months agopimd: prepare NHT for tracking BSM C-RPs
David Lamparter [Fri, 25 Jun 2021 09:42:38 +0000 (11:42 +0200)]
pimd: prepare NHT for tracking BSM C-RPs

For BSMs, we should track which of the RP candidates in the BSM message
are actually available, before trying to use them (which also puts them
in NHT for that).  This applies for both BSRs as well as BSM receivers.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
10 months agopimd: allow sending packets without pinned iface
David Lamparter [Sat, 9 Jul 2022 16:47:43 +0000 (18:47 +0200)]
pimd: allow sending packets without pinned iface

The upcoming Candidate-RP code needs to send PIM packets that go through
normal unicast routing, without forcing a specific output interface.
Allow passing in NULL ifp to do that.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
10 months agopimd: add prefix_* and IANA_AFI v4/v6 defines
David Lamparter [Wed, 8 May 2024 17:25:55 +0000 (19:25 +0200)]
pimd: add prefix_* and IANA_AFI v4/v6 defines

The Candidate-RP code is about to use these.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
10 months agopimd: add debugs for i-am-RP state
David Lamparter [Mon, 11 Jul 2022 19:58:27 +0000 (21:58 +0200)]
pimd: add debugs for i-am-RP state

This proved helpful in debugging the Candidate-RP code.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
10 months agopimd: make clang-format slightly less annoying
David Lamparter [Wed, 8 May 2024 17:27:22 +0000 (19:27 +0200)]
pimd: make clang-format slightly less annoying

The YANG module list is really better as 1-item-per-line.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
10 months agoMerge pull request #16059 from kacpekwasny/kkwasny/CLIC-139-4
Donatas Abraitis [Thu, 20 Jun 2024 07:51:06 +0000 (10:51 +0300)]
Merge pull request #16059 from kacpekwasny/kkwasny/CLIC-139-4

bgpd: fixed failing to remove VRF if there is a stale l3vni

10 months agoMerge pull request #16243 from donaldsharp/ubsan_documentation
Donatas Abraitis [Thu, 20 Jun 2024 05:08:30 +0000 (08:08 +0300)]
Merge pull request #16243 from donaldsharp/ubsan_documentation

doc: Document the usage of --enable-undefined-sanitizer

10 months agoMerge pull request #16234 from chiragshah6/fdev2
Donatas Abraitis [Thu, 20 Jun 2024 05:03:42 +0000 (08:03 +0300)]
Merge pull request #16234 from chiragshah6/fdev2

bgpd: backpressure - fix evpn route sync to zebra

10 months agodoc: Document the usage of --enable-undefined-sanitizer
Donald Sharp [Wed, 19 Jun 2024 12:01:16 +0000 (08:01 -0400)]
doc: Document the usage of --enable-undefined-sanitizer

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
10 months agobgpd: Remove redundant whitespace before printing the reason of the failed peer
Donatas Abraitis [Wed, 19 Jun 2024 11:32:16 +0000 (14:32 +0300)]
bgpd: Remove redundant whitespace before printing the reason of the failed peer

Before:

```
Neighbor        EstdCnt DropCnt ResetTime Reason
127.0.0.1             0       0     never  Waiting for peer OPEN (n/a)
```

After:

```
Neighbor        EstdCnt DropCnt ResetTime Reason
127.0.0.1             0       0     never Waiting for peer OPEN (n/a)
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agobgpd: Set last reset reason to admin shutdown if it was manually
Donatas Abraitis [Wed, 19 Jun 2024 11:09:00 +0000 (14:09 +0300)]
bgpd: Set last reset reason to admin shutdown if it was manually

Before this patch, we always printed the last reason "Waiting for OPEN", but
if it's a manual shutdown, then we technically are not waiting for OPEN.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agoMerge pull request #16224 from donaldsharp/zebra_dplane_event_loop_starvation
Donatas Abraitis [Wed, 19 Jun 2024 07:22:36 +0000 (10:22 +0300)]
Merge pull request #16224 from donaldsharp/zebra_dplane_event_loop_starvation

zebra: Prevent starvation in dplane_thread_loop

10 months agoMerge pull request #16223 from donaldsharp/bgp_vrf_name
Donatas Abraitis [Wed, 19 Jun 2024 07:22:16 +0000 (10:22 +0300)]
Merge pull request #16223 from donaldsharp/bgp_vrf_name

bgpd: Convert over to using vrf name instead of id

10 months agobgpd: backpressure - fix evpn route sync to zebra
Chirag Shah [Mon, 17 Jun 2024 20:58:03 +0000 (13:58 -0700)]
bgpd: backpressure - fix evpn route sync to zebra

In scaled EVPN + ipv4/ipv6 uni route sync to zebra,
some of the ipv4/ipv6 routes skipped reinstallation
due to incorrect local variable's stale value.

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

Ticket: #3948828

Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
Signed-off-by: Chirag Shah <chirag@nvidia.com>
10 months agobgpd: Convert over to using vrf name instead of id
Donald Sharp [Fri, 14 Jun 2024 15:32:06 +0000 (11:32 -0400)]
bgpd: Convert over to using vrf name instead of id

Use the name for when putting out debugs in bgp_zebra.c.
Additionally add an evpn flag for announce_route_actual.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
10 months agoMerge pull request #16227 from y-bharath14/srib-topotest-e
Donald Sharp [Tue, 18 Jun 2024 19:52:38 +0000 (15:52 -0400)]
Merge pull request #16227 from y-bharath14/srib-topotest-e

tests: Avoid importing unused modules

10 months agoMerge pull request #16237 from pguibert6WIND/json_ttable_caml_format
Donald Sharp [Tue, 18 Jun 2024 19:26:00 +0000 (15:26 -0400)]
Merge pull request #16237 from pguibert6WIND/json_ttable_caml_format

lib: add json API to dump and override row naming convention

10 months agoMerge pull request #15604 from cscarpitta/srv6-sid-manager
Russ White [Tue, 18 Jun 2024 16:16:24 +0000 (12:16 -0400)]
Merge pull request #15604 from cscarpitta/srv6-sid-manager

Add support for SRv6 SID Manager

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 agolib: add json API to dump and override row naming convention
Philippe Guibert [Tue, 18 Jun 2024 10:11:44 +0000 (12:11 +0200)]
lib: add json API to dump and override row naming convention

The following table is not compliant with caml format when displayed in
json:

>                 ttable_add_row(
>                         tt,
>                         "Vertex|Type|Metric|Next-Hop|Interface|Parent");
>
>                 ttable_json(tt, "ssdsss");

output observed:

> [..]
>        {
>          "Vertex":"r1",
>          "Type":"",
>          "Metric":0,
>          "Next-Hop":"",
>          "Interface":"",
>          "Parent":""
>        }

output expected:

> [..]
>        {
>          "vertex":"r1",
>          "type":"",
>          "metric":0,
>          "nextHop":"",
>          "interface":"",
>          "parent":""
>        }

Override the ttable_json() function with a new function which has an
extra paramter: this parameter will redefine the initial row value for
json:

> ttable_json_with_json_text(tt,
> "vertex|type|metric|nextHop|interface|parent");

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
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 agozebra, lib: add locator name in sid notify messages
Philippe Guibert [Sat, 8 Jun 2024 05:15:47 +0000 (07:15 +0200)]
zebra, lib: add locator name in sid notify messages

In the near future, some daemons may only register SIDs. This may be
the case for the pathd daemon when creating SRv6 binding SIDs.

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

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

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agotests: Avoid importing unused modules
Y Bharath [Sat, 15 Jun 2024 17:06:32 +0000 (22:36 +0530)]
tests: Avoid importing unused modules

Signed-off-by: y-bharath14 <y.bharath@samsung.com>
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 agozebra: Prevent starvation in dplane_thread_loop
Donald Sharp [Fri, 14 Jun 2024 17:36:51 +0000 (13:36 -0400)]
zebra: Prevent starvation in dplane_thread_loop

When removing a large number of routes, the linux kernel can take the
cpu for an extended amount of time, leaving a situation where FRR
detects a starvation event.

r1# sharp install routes 10.0.0.0 nexthop 192.168.44.33 1000000 repeat 10
2024-06-14 12:55:49.365 [NTFY] sharpd: [M7Q4P-46WDR] vty[5]@# sharp install routes 10.0.0.0 nexthop 192.168.44.33 1000000 repeat 10
2024-06-14 12:55:49.365 [DEBG] sharpd: [YP4TQ-01TYK] Inserting 1000000 routes
2024-06-14 12:55:57.256 [DEBG] sharpd: [TPHKD-3NYSB] Installed All Items 7.890085
2024-06-14 12:55:57.256 [DEBG] sharpd: [YJ486-NX5R1] Removing 1000000 routes
2024-06-14 12:56:07.802 [WARN] zebra: [QH9AB-Y4XMZ][EC 100663314] STARVATION: task dplane_thread_loop (634377bc8f9e) ran for 7078ms (cpu time 220ms)
2024-06-14 12:56:25.039 [DEBG] sharpd: [WTN53-GK9Y5] Removed all Items 27.783668
2024-06-14 12:56:25.039 [DEBG] sharpd: [YP4TQ-01TYK] Inserting 1000000 routes
2024-06-14 12:56:32.783 [DEBG] sharpd: [TPHKD-3NYSB] Installed All Items 7.743524
2024-06-14 12:56:32.783 [DEBG] sharpd: [YJ486-NX5R1] Removing 1000000 routes
2024-06-14 12:56:41.447 [WARN] zebra: [QH9AB-Y4XMZ][EC 100663314] STARVATION: task dplane_thread_loop (634377bc8f9e) ran for 5175ms (cpu time 179ms)

Let's modify the loop in dplane_thread_loop such that after a provider
has been run, check to see if the event should yield, if so, stop
and reschedule this for the future.

Signed-off-by: Donald Sharp <sharpd@nvidia.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 agodocker: Set ABUILD_APK_INDEX_OPTS for frr build
Donatas Abraitis [Fri, 14 Jun 2024 13:33:32 +0000 (16:33 +0300)]
docker: Set ABUILD_APK_INDEX_OPTS for frr build

In build() stage of abuild, it does `apk index ...` where frr* packages
are unsigned. We don't sign them here, and thus we need to specify `--allow-untrusted`.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agodocker: Set ABUILD_APK_INDEX_OPTS for libyang
Donatas Abraitis [Fri, 14 Jun 2024 08:37:23 +0000 (11:37 +0300)]
docker: Set ABUILD_APK_INDEX_OPTS for libyang

In build() stage of abuild, it does `apk index ...` where libyang* packages
are unsigned. We don't sign them here, and thus we need to specify `--allow-untrusted`.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agodocker: Do not require checks for libyang Alpine Linux package build
Donatas Abraitis [Fri, 14 Jun 2024 07:35:27 +0000 (10:35 +0300)]
docker: Do not require checks for libyang Alpine Linux package build

Since Alpine Linux 3.20, we get this:

>>> WARNING: libyang: APKBUILD does not run any tests!
    Alpine policy will soon require that packages have any relevant testsuites run during the build process.
    To fix, either define a check() function, or declare !check in $options to indicate the package does not have a testsuite.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agodocker: Use Alpine Linux 3.20
Donatas Abraitis [Fri, 14 Jun 2024 07:30:31 +0000 (10:30 +0300)]
docker: Use Alpine Linux 3.20

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
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 agozebra: fix sid allocation should be different with 2 isis instances
Philippe Guibert [Tue, 11 Jun 2024 16:14:58 +0000 (18:14 +0200)]
zebra: fix sid allocation should be different with 2 isis instances

With 2 ISIS SRv6 instances, the second ISIS instance always gets
the same End SID as the first one.

> router isis 1
> segment-routing srv6
> locator loc1
> exit
> exit
> router isis 2
> segment-routing srv6
> locator loc2
> end
> segment-routing
> srv6
> locators
> locator loc1
> prefix 2001::1/64
> exit
> locator loc2
> prefix 3001::1/64
>

output:
> 2024/06/11 17:30:15 ISIS: [N6PCR-FQ5ZA] SRv6 locator (locator loc1, prefix 2001::1/64) set for IS-IS area 1
> 2024/06/11 17:30:15 ISIS: [V4RBG-TYW5S] Requesting SRv6 SIDs for IS-IS area 1
> 2024/06/11 17:30:15 ISIS: [ZRHYM-6RMYK] isis_zebra_srv6_sid_notify: received SRv6 SID notify: ctx End USP sid_value 2001::1 sid_func 0 note ZAPI_SRV6_SID_ALLOCATED
> [..]
> 2024/06/11 17:36:49 ISIS: [N6PCR-FQ5ZA] SRv6 locator (locator loc2, prefix 3001::1/64) set for IS-IS area 2
> 2024/06/11 17:36:49 ISIS: [V4RBG-TYW5S] Requesting SRv6 SIDs for IS-IS area 2
> 2024/06/11 17:36:49 ISIS: [ZRHYM-6RMYK] isis_zebra_srv6_sid_notify: received SRv6 SID notify: ctx End USP sid_value 2001::1 sid_func 0 note ZAPI_SRV6_SID_ALLOCATED

Actually, at the second request, ZEBRA always gives an existing dynamic
SID of the first available locator, because the locator name is never
checked.

> 2024/06/11 17:36:49 ZEBRA: [XMBTQ-GE6EY] get_srv6_sid: received SRv6 SID alloc request: SID ctx End USP ((null)), mode=dynamic
> 2024/06/11 17:36:49 ZEBRA: [R61Q3-QWR23] get_srv6_sid_dynamic: returning existing SID End USP 2001::1
> 2024/06/11 17:36:49 ZEBRA: [J1GMY-B6CAK] srv6_manager_get_sid_internal: got existing SRv6 SID for ctx End USP: sid_value=2001::1 (func=0) (proto=9, instance=0, sessionId=0), notify client

Fix this by checking the locator of the existing SID.

Fixes: b771bf8ce687 ("zebra: Add functions to alloc/release SRv6 SIDs")
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
10 months agozebra: fix display explicit sid refused
Philippe Guibert [Fri, 7 Jun 2024 13:46:53 +0000 (15:46 +0200)]
zebra: fix display explicit sid refused

> 2024/06/07 15:09:43 ZEBRA: [MZYPC-GBDGR] srv6_manager_get_sid_internal: getting SRv6 SID for ctx End.DT4 vrf vrf1, sid_value=1003::4, locator_name=
> [..]
> 2024/06/07 15:09:43 ZEBRA: [QGJBT-YJ11W] zsend_srv6_sid_notify: notifying ZEBRA_SRV6_SID_NOTIFY ctx End.DT4 vrf vrf2, sid (null) note ZAPI_SRV6_SID_FAIL_ALLOC (proto=30, instance=0, sessionId=0)

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
10 months agozebra: fix display srv6 address only for explicit-sid
Philippe Guibert [Fri, 7 Jun 2024 13:46:20 +0000 (15:46 +0200)]
zebra: fix display srv6 address only for explicit-sid

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
10 months agozebra: Fix checkpatch warning
Carmine Scarpitta [Fri, 3 May 2024 17:31:56 +0000 (19:31 +0200)]
zebra: Fix checkpatch warning

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agodoc: Add documentation for SRv6 SID formats CLI
Carmine Scarpitta [Thu, 2 May 2024 15:08:15 +0000 (17:08 +0200)]
doc: Add documentation for SRv6 SID formats CLI

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agozebra: Notify all daemons about locator delete
Carmine Scarpitta [Thu, 2 May 2024 21:50:38 +0000 (23:50 +0200)]
zebra: Notify all daemons about locator delete

Currently, when a locator is deleted in zebra, zebra notifies only the
zclient that owns the locator.

With the introduction of SID Manager, the locator is no longer owned by
any client. Instead, the locator is owned by Zebra, and clients can
allocate and release SIDs from the locator using the ZAPI
ZEBRA_SRV6_MANAGER_GET_SID and ZEBRA_SRV6_MANAGER_RELEASE_SID.

Therefore, when a locator is removed in Zebra, we need to notify all
daemons so that they can release/uninstall the SIDs allocated by that
locator.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agozebra: Notify daemons about SIDs
Carmine Scarpitta [Thu, 2 May 2024 11:39:49 +0000 (13:39 +0200)]
zebra: Notify daemons about SIDs

Send asynchronous notifications to zclients when an SRv6 SID is
allocated/released and when a SID alloc/release operation fails.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agolib: Add ZAPI command `ZEBRA_SRV6_SID_NOTIFY`
Carmine Scarpitta [Mon, 6 May 2024 15:53:18 +0000 (17:53 +0200)]
lib: Add ZAPI command `ZEBRA_SRV6_SID_NOTIFY`

Add a new ZAPI command `ZEBRA_SRV6_SID_NOTIFY` used by zebra to send
asynchronous SRv6 SIDs notifications to zclients.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agozebra: Alloc/Release SIDs to daemons upon request
Carmine Scarpitta [Sat, 23 Mar 2024 16:25:39 +0000 (17:25 +0100)]
zebra: Alloc/Release SIDs to daemons upon request

Previous commits introduced two new ZAPI operations,
`ZEBRA_SRV6_MANAGER_GET_SRV6_SID` and
`ZEBRA_SRV6_MANAGER_RELEASE_SRV6_SID`. These operations allow a daemon
to interact with the SRv6 SID Manager to get and release an SRv6 SID,
respectively.

This commit extends the SID Manager by adding logic to process the
requests `ZEBRA_SRV6_MANAGER_GET_SRV6_SID` and
`ZEBRA_SRV6_MANAGER_RELEASE_SRV6_SID`, and allocate/release SIDs to
requesting daemons.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agozebra: Add functions to alloc/release SRv6 SIDs
Carmine Scarpitta [Sat, 23 Mar 2024 15:30:58 +0000 (16:30 +0100)]
zebra: Add functions to alloc/release SRv6 SIDs

Add functions to allocate/release SRv6 SIDs. SIDs can be allocated
either explicitly (allocate a specific SID) or dynamically (allocate any
available SID).

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agozebra: Repond to `GET_LOCATOR` ZAPI request
Carmine Scarpitta [Sat, 23 Mar 2024 14:50:24 +0000 (15:50 +0100)]
zebra: Repond to `GET_LOCATOR` ZAPI request

The previous commits introduced a new operation,
`ZEBRA_SRV6_MANAGER_GET_LOCATOR`, allowing a daemon to request
information about a specific SRv6 locator from the SRv6 SID Manager.

This commit extends the SID Manager to respond to a
`ZEBRA_SRV6_MANAGER_GET_LOCATOR` request and provide the requested
locator information.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agolib: Add missing info to locator encode/decode
Carmine Scarpitta [Mon, 6 May 2024 15:46:44 +0000 (17:46 +0200)]
lib: Add missing info to locator encode/decode

Include block/node/function/argument lengthi when
encoding/decoding an SRv6 locator.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agolib: Add ZAPI operations to get/release SRv6 SIDs
Carmine Scarpitta [Sat, 23 Mar 2024 17:31:12 +0000 (18:31 +0100)]
lib: Add ZAPI operations to get/release SRv6 SIDs

Add two new ZAPI operations: `ZEBRA_SRV6_MANAGER_GET_SRV6_SID` and
`ZEBRA_SRV6_MANAGER_RELEASE_SRV6_SID`. These APIs allow a daemon to get and
release an SRv6 SID, respectively.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agolib: Add ZAPI operation get SRv6 locator
Carmine Scarpitta [Sat, 23 Mar 2024 14:49:43 +0000 (15:49 +0100)]
lib: Add ZAPI operation get SRv6 locator

Add a new ZAPI operation, ZEBRA_SRV6_MANAGER_GET_LOCATOR, which allows a
daemon to request information about a specific locator from the SRv6 SID
Manager.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agozebra: Add support for SRv6 SIDs
Carmine Scarpitta [Sat, 23 Mar 2024 12:42:19 +0000 (13:42 +0100)]
zebra: Add support for SRv6 SIDs

Add a data structure to represent an SRv6 SID context and the related
management functions (allocate/free).

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agolib: Add support for SRv6 SIDs
Carmine Scarpitta [Mon, 6 May 2024 15:44:18 +0000 (17:44 +0200)]
lib: Add support for SRv6 SIDs

Add a data structure to represent an SRv6 SID context and the related
management functions (allocate/free).

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agozebra: CLI to specify format of an SRv6 locator
Carmine Scarpitta [Fri, 22 Mar 2024 18:31:01 +0000 (19:31 +0100)]
zebra: CLI to specify format of an SRv6 locator

Add the CLI to choose the SID format of a locator. When the SID format
of a locator is changed, the SIDs allocated from that locator might no
longer be valid (for example, because the new format might involve a
different SID allocation schema). In such a case, it is necessary to
notify all the zclients so that they can withdraw/uninstall the old SIDs
that use the previous format and allocate/install/advertise the new SIDs
based on the new format.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agolib: Add function to copy an SRv6 locator
Carmine Scarpitta [Wed, 8 May 2024 14:41:05 +0000 (16:41 +0200)]
lib: Add function to copy an SRv6 locator

Add a new function to copy an SRv6 locator.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agozebra: Add support for SRv6 SID blocks
Carmine Scarpitta [Fri, 22 Mar 2024 17:19:36 +0000 (18:19 +0100)]
zebra: Add support for SRv6 SID blocks

An SRv6 block is an IPv6 prefix from which SIDs are allocated. This
commit adds support for SRv6 SID blocks. Specifically, it adds a data
structure to store information about an SRv6 block (e.g., its occupancy
status, which SIDs have been allocated and which are available, which
SID format is used for that block, etc.). It also adds some functions to
manage the block (allocate / free / lookup).

These functions will be used in the next commits to support the
allocation of SIDs from a block in the SID Manager.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agozebra: CLI to override default SID format config
Carmine Scarpitta [Tue, 26 Mar 2024 07:53:55 +0000 (08:53 +0100)]
zebra: CLI to override default SID format config

Add CLI commands to support overriding default configuration of the SID
format.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agovtysh: CLI to override default SID format config
Carmine Scarpitta [Tue, 26 Mar 2024 07:53:17 +0000 (08:53 +0100)]
vtysh: CLI to override default SID format config

Add CLI commands to support overriding default configuration of the SID
format.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agolib: Add CLI nodes to support SRv6 SID format
Carmine Scarpitta [Fri, 22 Mar 2024 14:56:15 +0000 (15:56 +0100)]
lib: Add CLI nodes to support SRv6 SID format

Add CLI commands to support overriding default configuration of the SID
format.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agozebra: Add support for SRv6 SID formats
Carmine Scarpitta [Thu, 6 Jun 2024 15:23:11 +0000 (17:23 +0200)]
zebra: Add support for SRv6 SID formats

Add functionalities to manage SRv6 SID formats (register / unregister /
lookup) and create two SID formats upon SRv6 Manager initialization:
`uncompressed-f4024` and `usid-f3216`.

In future commits, we will add the CLI to allow the user to choose
between the two formats.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agolib: Add support for SRv6 SID formats
Carmine Scarpitta [Fri, 22 Mar 2024 14:13:00 +0000 (15:13 +0100)]
lib: Add support for SRv6 SID formats

Add functionalities to manage SRv6 SID formats (allocate / free).

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
10 months agobgpd: Check if we have real stream data for tunnel encapsulation sub-tlvs
Donatas Abraitis [Thu, 13 Jun 2024 06:00:21 +0000 (09:00 +0300)]
bgpd: Check if we have real stream data for tunnel encapsulation sub-tlvs

When the packet is malformed it can use whatever values it wants. Let's check
what the real data we have in a stream instead of relying on malformed values.

Reported-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
10 months agobgpd: Adjust the length of tunnel encap sub-tlv by sub-tlv type
Donatas Abraitis [Thu, 13 Jun 2024 05:43:21 +0000 (08:43 +0300)]
bgpd: Adjust the length of tunnel encap sub-tlv by sub-tlv type

Fixes: 79563af564ad0fe5b9c8d95bf080d570f87b1859 ("bgpd: Get 1 or 2 octets for Sub-TLV length (Tunnel Encap attr)")
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
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 agobgpd: Check if we have really enough data before doing memcpy for FQDN capability
Donatas Abraitis [Thu, 13 Jun 2024 05:12:10 +0000 (08:12 +0300)]
bgpd: Check if we have really enough data before doing memcpy for FQDN capability

We advance data pointer (data++), but we do memcpy() with the length that is 1-byte
over, which is technically heap overflow.

```
==411461==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x50600011da1a at pc 0xc4f45a9786f0 bp 0xffffed1e2740 sp 0xffffed1e1f30
READ of size 4 at 0x50600011da1a thread T0
    0 0xc4f45a9786ec in __asan_memcpy (/home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/.libs/bgpd+0x3586ec) (BuildId: e794c5f796eee20c8973d7efb9bf5735e54d44cd)
    1 0xc4f45abf15f8 in bgp_dynamic_capability_fqdn /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_packet.c:3457:4
    2 0xc4f45abdd408 in bgp_capability_msg_parse /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_packet.c:3911:4
    3 0xc4f45abdbeb4 in bgp_capability_receive /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_packet.c:3980:9
    4 0xc4f45abde2cc in bgp_process_packet /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_packet.c:4109:11
    5 0xc4f45a9b6110 in LLVMFuzzerTestOneInput /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_main.c:582:3
```

Found by fuzzing.

Reported-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>