Commit Graph

1602 Commits

Author SHA1 Message Date
Igor Ryzhov
6d8963f3e6 isisd: remove redundant northbound destroy callbacks
Fixes startup warnings:
```
ISIS: [ZKB8W-3S2Q4][EC 100663330] unneeded 'destroy' callback for '/frr-isisd:isis/instance/segment-routing-srv6/msd/node-msd/max-segs-left'
ISIS: [ZKB8W-3S2Q4][EC 100663330] unneeded 'destroy' callback for '/frr-isisd:isis/instance/segment-routing-srv6/msd/node-msd/max-end-pop'
ISIS: [ZKB8W-3S2Q4][EC 100663330] unneeded 'destroy' callback for '/frr-isisd:isis/instance/segment-routing-srv6/msd/node-msd/max-h-encaps'
ISIS: [ZKB8W-3S2Q4][EC 100663330] unneeded 'destroy' callback for '/frr-isisd:isis/instance/segment-routing-srv6/msd/node-msd/max-end-d'
```

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2023-10-06 17:37:41 +03:00
Carmine Scarpitta
46d1028a89 isisd: Fix SRv6 memory leaks
When isis_zebra_process_srv6_locator_chunk() returns prematurely
due to an error, do not forget to free memory allocated by
srv6_locator_chunk_alloc().

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2023-09-21 18:43:04 +02:00
Philippe Guibert
f4ac971fcc isisd: fix crash when configuring srv6 locator without isis instance
After the ISIS daemon is launched, the configuration of an srv6
locator in zebra triggers a crash:

> #4  0x00007f1f0ea980f3 in core_handler (signo=11, siginfo=0x7ffdb750de70, context=0x7ffdb750dd40)
>     at /build/make-pkg/output/_packages/cp-routing/src/lib/sigevent.c:262
> #5  <signal handler called>
> #6  0x00005651a05783ef in isis_zebra_process_srv6_locator_add (cmd=117, zclient=0x5651a21d9bd0, length=25, vrf_id=0)
>     at /build/make-pkg/output/_packages/cp-routing/src/isisd/isis_zebra.c:1258
> #7  0x00007f1f0ead5ac9 in zclient_read (thread=0x7ffdb750e750) at /build/make-pkg/output/_packages/cp-routing/src/lib/zclient.c:4246
> #8  0x00007f1f0eab19d4 in thread_call (thread=0x7ffdb750e750) at /build/make-pkg/output/_packages/cp-routing/src/lib/thread.c:1825
> #9  0x00007f1f0ea4862e in frr_run (master=0x5651a1f65a40) at /build/make-pkg/output/_packages/cp-routing/src/lib/libfrr.c:1155
> #10 0x00005651a051131a in main (argc=5, argv=0x7ffdb750e998, envp=0x7ffdb750e9c8)
>     at /build/make-pkg/output/_packages/cp-routing/src/isisd/isis_main.c:282
> (gdb) f 6
> #6  0x00005651a05783ef in isis_zebra_process_srv6_locator_add (cmd=117, zclient=0x5651a21d9bd0, length=25, vrf_id=0)
>     at /build/make-pkg/output/_packages/cp-routing/src/isisd/isis_zebra.c:1258
> (gdb) print isis
> $1 = (struct isis *) 0x0
> (gdb) print isis->area_list
> Cannot access memory at address 0x28

The isis pointer is NULL, because no instances have already been
configured on the ISIS instance.
Fix this by checking that there is any isis instance available when
zebra hooks related to srv6 are received.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-09-20 15:07:35 +02:00
Carmine Scarpitta
6ae2a525cf isisd: Fix CID 1568134 (Null pointer dereference)
Null check `isis` pointer before dereferencing it.

Fixes this coverity issue:

*** CID 1568134:  Null pointer dereferences  (NULL_RETURNS)
/isisd/isis_zebra.c: 1146 in isis_zebra_process_srv6_locator_chunk()
1140                    "prefix %pFX, block_len %u, node_len %u, func_len %u, arg_len %u",
1141                    chunk->locator_name, &chunk->prefix, chunk->block_bits_length,
1142                    chunk->node_bits_length, chunk->function_bits_length,
1143                    chunk->argument_bits_length);
1144
1145            /* Walk through all areas of the ISIS instance */
>>>     CID 1568134:  Null pointer dereferences  (NULL_RETURNS)
>>>     Dereferencing "isis", which is known to be "NULL".
1146            for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) {
1147                    if (strncmp(area->srv6db.config.srv6_locator_name,
1148                                chunk->locator_name,
1149                                sizeof(area->srv6db.config.srv6_locator_name)) != 0)
1150                            continue;
1151

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2023-09-15 17:42:04 +02:00
Carmine Scarpitta
9de5b3bf58 isisd: Fix CID 1568133 (Null pointer dereference)
Null checking the `sra` pointer after dereferencing it causes a
coverity issue. Let's perform the null check before dereferencing the
pointer.

Fixes this coverity issue:

*** CID 1568133:  Null pointer dereferences  (REVERSE_INULL)
/isisd/isis_zebra.c: 1077 in isis_zebra_srv6_adj_sid_uninstall()
1071            enum seg6local_action_t action = ZEBRA_SEG6_LOCAL_ACTION_UNSPEC;
1072            struct interface *ifp;
1073            uint16_t prefixlen = IPV6_MAX_BITLEN;
1074            struct isis_circuit *circuit = sra->adj->circuit;
1075            struct isis_area *area = circuit->area;
1076
>>>     CID 1568133:  Null pointer dereferences  (REVERSE_INULL)
>>>     Null-checking "sra" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
1077            if (!sra)
1078                    return;
1079
1080            switch (sra->behavior) {
1081            case SRV6_ENDPOINT_BEHAVIOR_END_X:
1082                    prefixlen = IPV6_MAX_BITLEN;

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2023-09-15 17:42:04 +02:00
Carmine Scarpitta
f3b4e6664f isisd: Fix CID 1568132 (Null pointer dereference)
Null checking the `sra` pointer after dereferencing it causes a
coverity issue. Let's perform the null check before dereferencing the
pointer.

Fixes this coverity issue:

*** CID 1568132:  Null pointer dereferences  (REVERSE_INULL)
/isisd/isis_zebra.c: 1023 in isis_zebra_srv6_adj_sid_install()
1017            struct seg6local_context ctx = {};
1018            uint16_t prefixlen = IPV6_MAX_BITLEN;
1019            struct interface *ifp;
1020            struct isis_circuit *circuit = sra->adj->circuit;
1021            struct isis_area *area = circuit->area;
1022
>>>     CID 1568132:  Null pointer dereferences  (REVERSE_INULL)
>>>     Null-checking "sra" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
1023            if (!sra)
1024                    return;
1025
1026            sr_debug("ISIS-SRv6 (%s): setting adjacency SID %pI6", area->area_tag,
1027                     &sra->sid);
1028

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2023-09-15 17:42:04 +02:00
Carmine Scarpitta
95eadb5068 isisd: Fix CID 1568129 (Null pointer dereference)
Fix this coverity issue:

*** CID 1568129:  Null pointer dereferences  (REVERSE_INULL)
/isisd/isis_tlvs.c: 2813 in unpack_item_srv6_end_sid()
2807                    sid->subsubtlvs = NULL;
2808            }
2809
2810            append_item(&subtlvs->srv6_end_sids, (struct isis_item *)sid);
2811            return 0;
2812     out:
>>>     CID 1568129:  Null pointer dereferences  (REVERSE_INULL)
>>>     Null-checking "sid" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
2813            if (sid)
2814                    free_item_srv6_end_sid((struct isis_item *)sid);
2815            return 1;
2816     }
2817
2818     /* Functions related to TLVs 1 Area Addresses */

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2023-09-15 12:39:45 +02:00
Mark Stapp
bf4e97c632
Merge pull request #14365 from opensourcerouting/typesafe-const-declutter
Revert "lib: add a frr_each_const macro"
2023-09-12 11:20:50 -04:00
Carmine Scarpitta
bfec26bc7a isisd: Make SRv6 interface configurable
Add CLI command and functions to configure the interface used for
installing SRv6 SIDs into Linux data plane

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:51 +02:00
Carmine Scarpitta
bdbbb26d55 isisd: Make SRv6 Node MSDs customizable
Add CLI commands to customize SRv6 Node MSD values.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:50 +02:00
Carmine Scarpitta
a1be1942f5 isisd: Remove SIDs when parent locator is deleted
Clean up SRv6 SIDs when the parent locator is deleted.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:49 +02:00
Carmine Scarpitta
71b8056d6d isisd: Initialize/free SRv6 adjacency SIDs list
Initialize/free SRv6 adjacency SIDs list when an IS-IS area is
created/destroyed.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:48 +02:00
Carmine Scarpitta
455aded931 isisd: Extend sid_exist to consider adj SIDs
The function `sid_exist` verifies if a given SRv6 SID has already been
allocated for a given IS-IS area. This commit extends `sid_exist` to
also consider adjacency SIDs when checking for the existence of the SID.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:48 +02:00
Carmine Scarpitta
ee57c710b1 isisd: Extend IS-IS adjacency with SRv6 adj SIDs
Initialize/remove SRv6 SIDs list when an IS-IS adjacency is
created/deleted.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:48 +02:00
Carmine Scarpitta
ecb2675f1e isisd: Add support for SRv6 Adjacency SIDs
An SRv6 adjacency SID is a SID that is associated with a particular
adjacency. Adjacency SIDs are advertised using the SRv6 End.X SID
Sub-TLV (RFC 9352 section #8.1) or SRv6 LAN End.X SID Sub-TLV (RFC 9352
section #8.2).

This commit defines the following Adj SIDs management functions:
* srv6_endx_sid_add_single: add a new SRv6 Adjacency SID
* srv6_endx_sid_del: delete an SRv6 Adjacency SID
* isis_srv6_endx_sid_find: lookup SRv6 End.X SID by type

It also attaches some callbacks to the hooks isis_adj_state_change_hook,
isis_adj_ip_enabled_hook, isis_adj_ip_disabled_hook, which are
responsible for installing/removing an SRv6 Adjacency SID automatically
when the state of an IS-IS adjacency changes.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:47 +02:00
Carmine Scarpitta
7db1a90475 isisd: Add functions to install/remove adj SIDs
Add two functions to install/remove Adjacency SIDs into the data plane
through zebra.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:47 +02:00
Carmine Scarpitta
2566656a6f isisd: Add data structure for SRv6 Adjacency SIDs
An SRv6 adjacency SID is a SID that is associated with a particular
adjacency. Adjacency SIDs are advertised using the SRv6 End.X SID
Sub-TLV (RFC 9352 section #8.1) or SRv6 LAN End.X SID Sub-TLV (RFC 9352
section #8.2).

This commit defines a data structure `srv6_adjacency` for storing
information about an SRv6 Adjacency SID. This data structure will be
used to support SRv6 Adjacency SIDs functionalities in future commits.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:46 +02:00
Carmine Scarpitta
df121f68e7 isisd: Make MTYPE_ISIS_SUBSUBTLV non-static
We need to allocate memory SRv6 SID Structure Sub-Sub-TLV in
isis_srv6.c. MTYPE_ISIS_SUBSUBTLV is statically defined in isis_tlvs.c
and therefore is not visible in isis_srv6.c. Let's make
MTYPE_ISIS_SUBSUBTLV non-static to provide visibility to the external
world..

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:46 +02:00
Carmine Scarpitta
d56c0d23b0 isisd: Unpack SRv6 (LAN) End.X SID Sub-TLV
Extend the Extended IS Reachability TLV unpack function to unpack the
SRv6 End.X SID Sub-TLV and SRv6 LAN End.X SID Sub-TLV, if present.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:45 +02:00
Carmine Scarpitta
8b6a73c306 isisd: Pack SRv6 (LAN) End.X SID Sub-TLV
Extend the Extended IS Reachability TLV pack function to pack the SRv6
End.X SID Sub-TLV and SRv6 LAN End.X SID Sub-TLV, if present.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:45 +02:00
Carmine Scarpitta
294c9c76bf isisd: Add SRv6 (LAN) End.X SID Sub-TLV codepoints
Add SRv6 End.X SID Sub-TLV and SRv6 LAN End.X SID Sub-TLV codepoints
(defined in "IS-IS Sub-TLVs for TLVs Advertising Neighbor Information"
IANA registry). These codepoints will be used in future commits to
pack/unpack corresponding Sub-TLVs.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:44 +02:00
Carmine Scarpitta
648a158802 isisd: Add SRv6 End.X SID to Sub-TLV format func
Extend the Extended IS Reachability TLV format function to show the SRv6
End.X SID Sub-TLV and SRv6 LAN End.X SID Sub-TLV, if present.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:44 +02:00
Carmine Scarpitta
eb16e0b0bc isisd: Add flags for SRv6 (LAN) End.X SID Sub-TLV
SRv6 End.X SID Sub-TLV (RFC 9352 section #8.1) and SRv6 LAN End.X SID
Sub-TLV (RFC 9352 section #8.2) contain a `flag` field. Currently, three
flags are defined:
* B-Flag: Backup flag
* S-Flag: Set flag
* P-Flag: Persistent flag

This commit defines three constants representing these flags.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:43 +02:00
Carmine Scarpitta
e083282e83 isisd: Add SRv6 End.X SID to Sub-TLV copy func
Extend the Extended IS Reachability TLV copy function to copy the SRv6
End.X SID Sub-TLV and SRv6 LAN End.X SID Sub-TLV, if present.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:43 +02:00
Carmine Scarpitta
3740efacfb isisd: Add SRv6 End.X SID to IS ext reach Sub-TLVs
Add SRv6 End.X SID Sub-TLV and SRv6 LAN End.X SID Sub-TLV to the
Extended IS Reachability Sub-TLVs data structure and perform proper
initialization/free when the Sub-TLVs data structure is
allocated/destroyed.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:42 +02:00
Carmine Scarpitta
f912df37de isisd: Add SRv6 LAN End.X SID Sub-TLV data struct
Add a data structure to represent an SRv6 LAN End.X SID Sub-TLV as per
RFC 9352 section #8.2.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:42 +02:00
Carmine Scarpitta
6b09d53cc1 isisd: Add SRv6 End.X SID Sub-TLV data structure
Add a data structure to represent an SRv6 End.X SID Sub-TLV as per
RFC 9352 section #8.1.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:42 +02:00
Carmine Scarpitta
65c4a84293 isisd: Update copyright info in isis_tlvs.[c,h]
Add copyright claim for "IS-IS Extensions to Support SRv6" (RFC 9352)
to isis_tlvs.c and isis_tlvs.h.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:41 +02:00
Carmine Scarpitta
604fcd30db isisd: Advertise SRv6 Locator in Prefix Reach TLV
According to RFC 9352 section #5, the SRv6 Locators associated with
algorithms 0 and 1 should be also advertised in a Prefix Reachability
TLV (236 or 237) to allow legacy routers (i.e., routers that do not
support SRv6) installing a forwarding entry for algorithms 0 and 1 SRv6
traffic.

This commits extend IS-IS to advertise SRv6 Locators in IPv6
Reachability TLV.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:41 +02:00
Carmine Scarpitta
48d1cd1748 isisd: Add SRv6 Locator TLV to the LSP
Add the SRv6 Locator TLV and its Sub-TLV and Sub-Sub-TLVs to the LSP.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:40 +02:00
Carmine Scarpitta
c682450894 isisd: Add structure when building End SID Sub-TLV
Encode SRv6 SID Structure Sub-Sub-TLV when building the SRv6 End SID
Sub-TLV.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:40 +02:00
Carmine Scarpitta
81579d7de2 isisd: Add func to build Sub-Sub-TLV from End SID
Add a function to build an SRv6 SID Structure Sub-Sub-TLV (RFC 9352
section #9) to advertise the structure of a specific SRv6 End SID passed
as an argument.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:39 +02:00
Carmine Scarpitta
cfc90fc490 isisd: Add End SID when building SRv6 Locator TLV
Encode SRv6 End SID Sub-TLVs when building the SRv6 Locator TLV.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:39 +02:00
Carmine Scarpitta
1804d70cbd isisd: Add func to build Sub-TLV from SRv6 End SID
Add a function to build an SRv6 End SID TLV (RFC 9352 section #7.2) to
advertise a specific SRv6 End SID passed as an argument.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:38 +02:00
Carmine Scarpitta
2aaa75a6f3 isisd: Add function to build TLV from SRv6 Locator
Add a function to build an SRv6 Locator TLV (RFC 9352 section #7.1) to
advertise a specific SRv6 Locator passed as an argument.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:38 +02:00
Carmine Scarpitta
7e340af13b isisd: Add func to fill in SID Struct Sub-Sub-TLV
Add a function to fill in an SRv6 SID Structure Sub-Sub-TLV with
information from an SRv6 SID (RFC 9352 section #9).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:37 +02:00
Carmine Scarpitta
43786ccfdc isisd: Add func to fill in an SRv6 End SID Sub-TLV
Add a function to fill in an SRv6 End SID Sub-TLV with information from
an SRv6 End SID (RFC 9352 section #7.2).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:37 +02:00
Carmine Scarpitta
6cd23c6d95 isisd: Add function to fill in an SRv6 Locator TLV
Add a function to fill in an SRv6 Locator TLV with information from an
SRv6 locator (RFC 9352 section #7.1).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:37 +02:00
Carmine Scarpitta
791ca51ecf isisd: Add SRv6 locator data structure
Add a data structure to represent an SRv6 locator (RFC 9352
section 7.1)

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:36 +02:00
Carmine Scarpitta
77a8c68df6 isisd: Bind SRv6 SID Struct ops to TLV type
General Sub-Sub-TLV processing functions (i.e., copy, format, free,
pack, and unpack) perform a lookup of the handler specific for a
Sub-Sub-TLV in the `tlv_table`, and then call the specific handler to
process the Sub-Sub-TLV.
This commit adds the handlers for the SRv6 Structure Sub-Sub-TLV (stored
in `subsubtlv_srv6_sid_structure_ops`) to the `tlv_table`.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:36 +02:00
Carmine Scarpitta
46a93507f3 isisd: Define TLV ops for SID Struct Sub-Sub-TLV
Use the SUBSUBTLV_OPS macro to define the TLV operations for the SRv6
SID Structure Sub-Sub-TLV (RFC 9352 section #9).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:35 +02:00
Carmine Scarpitta
5579ca40ef isisd: Add unpack func for SID Struct Sub-Sub-TLV
Add a function to unpack an SRv6 SID Structure Sub-Sub-TLV
(RFC 9352 section #9).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:35 +02:00
Carmine Scarpitta
8953be7a0c isisd: Pack SID Struct when packing Sub-Sub-TLVs
Extend generic Sub-Sub-TLVs pack function to pack SRv6 SID Structure
Sub-Sub-TLVs (RFC 9352 section FRRouting#9).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:34 +02:00
Carmine Scarpitta
2dfe8ef463 isisd: Add pack func for SID Structure Sub-Sub-TLV
Add a function to pack an SRv6 SID Structure Sub-Sub-TLV
(RFC 9352 section #9).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:34 +02:00
Carmine Scarpitta
b5cd8ab2b7 isisd: Free SID Struct when freeing Sub-Sub-TLVs
Extend generic Sub-Sub-TLVs free function to free SRv6 SID Structure
Sub-Sub-TLVs (RFC 9352 section #9).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:33 +02:00
Carmine Scarpitta
9f176ae0a6 isisd: Add free func for SID Structure Sub-Sub-TLV
Add a function to free an SRv6 SID Structure Sub-Sub-TLV
(RFC 9352 section #9).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:33 +02:00
Carmine Scarpitta
43072e0e39 isisd: Add SID Struct to Sub-Sub-TLVs format func
Extend generic Sub-Sub-TLVs format function to return information about
SRv6 SID Structure Sub-Sub-TLVs (RFC 9352 section #9).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:32 +02:00
Carmine Scarpitta
af4870f600 isisd: Add format func for SID Struct Sub-Sub-TLV
Add a function to return information about an SRv6 SID Structure
Sub-Sub-TLV (RFC 9352 section #9).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:32 +02:00
Carmine Scarpitta
2d8c968867 isisd: Copy SID Struct when copying Sub-Sub-TLVs
Extend generic Sub-Sub-TLVs copy function to copy SRv6 SID Structure
Sub-Sub-TLVs (RFC 9352 section #9).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:32 +02:00
Carmine Scarpitta
5ff2f97d00 isisd: Add copy func for SID Structure Sub-Sub-TLV
Add a function to copy an SRv6 SID Structure Sub-Sub-TLV
(RFC 9352 section #9).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:31 +02:00
Carmine Scarpitta
b46b6e9986 isisd: Add data struct for SID Struct Sub-Sub-TLV
Add a data structure representing the SRv6 SID Structure Sub-Sub-TLV
(RFC 9352 section #9).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:31 +02:00
Carmine Scarpitta
66c50ce22a isisd: Unpack Sub-Sub-TLVs of SRv6 End SID Sub-TLV
Extend SRv6 End SID Sub-TLV unpack function to unpack Sub-Sub-TLVs (RFC
9352 section #9).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:30 +02:00
Carmine Scarpitta
bc6e273046 isisd: Pack Sub-Sub-TLVs of SRv6 End SID Sub-TLV
Extend SRv6 End SID Sub-TLV pack function to pack Sub-Sub-TLVs (RFC 9352
section #9).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:30 +02:00
Carmine Scarpitta
422ea2d410 isisd: Free Sub-Sub-TLVs of SRv6 End SID Sub-TLV
Extend SRv6 End SID Sub-TLV free function to free Sub-Sub-TLVs (RFC 9352
section #9).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:29 +02:00
Carmine Scarpitta
584f41d8f3 isisd: Add Sub-Sub-TLVs to End SID format func
Extend SRv6 End SID Sub-TLV format function to return information about
Sub-Sub-TLVs (RFC 9352 section #7.2).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:29 +02:00
Carmine Scarpitta
0089b3b94a isisd: Copy Sub-Sub-TLVs of SRv6 End SID Sub-TLV
Extend SRv6 End SID Sub-TLV copy function to copy Sub-Sub-TLVs (RFC 9352
section #7.2).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:28 +02:00
Carmine Scarpitta
dce3e4515f isisd: Add pack func for Sub-Sub-TLVs in general
Add a function to pack all the Sub-Sub-TLVs passed as an argument.

At this time, this function does not pack any Sub-Sub-TLVs because no
Sub-Sub-TLVs have been defined yet. This function will be extended in
future commits to pack specific Sub-Sub-TLVs, as they become supported.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:28 +02:00
Carmine Scarpitta
ac62420870 isisd: Add free func for Sub-Sub-TLVs in general
Add a function to free all the Sub-Sub-TLVs and the `isis_subsubtlvs`
data structure passed as an argument.

At this time, this function only frees the `isis_subsubtlvs`. It does
not free any specific Sub-Sub-TLVs because no Sub-Sub-TLVs have been
defined yet. This function will be extended in future commits to free
specific Sub-Sub-TLVs, as they become supported.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:27 +02:00
Carmine Scarpitta
28354d6f38 isisd: Add format func for Sub-Sub-TLVs in general
Add a function to return information about all the Sub-Sub-TLVs passed
as an argument.

At this time, this function does nothing because no Sub-Sub-TLVs have
been defined yet. This function will be extended in
future commits to return information about specific Sub-Sub-TLVs,
as they become supported.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:27 +02:00
Carmine Scarpitta
ebf2734b7e isisd: Add copy func for Sub-Sub-TLVs in general
Add a function to copy all the Sub-Sub-TLVs passed as an argument.

At this time, this function does not copy any Sub-Sub-TLVs because no
Sub-Sub-TLVs have been defined yet. This function will be extended in
future commits to copy specific Sub-Sub-TLVs, as they become supported.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:27 +02:00
Carmine Scarpitta
ea22a01c5d isisd: Add alloc func for Sub-Sub-TLVs in general
Add a function to allocate memory for IS-IS Sub-Sub-TLVs.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:26 +02:00
Carmine Scarpitta
c54b8f99c1 isisd: Add struct to store Sub-Sub-TLVs info
Add a data structure to store IS-IS Sub-Sub-TLVs information. At this
time, does not contain any Sub-Sub-TLV information because no
Sub-Sub-TLVs have been defined yet. This data structure will be extended
in future commits to store specific Sub-Sub-TLVs, as they become
supported.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:26 +02:00
Carmine Scarpitta
0afeda742c isisd: Add new macros to define Sub-Sub-TLV ops
Add two macros `SUBSUBTLV_OPS` and `ITEM_SUBSUBTLV_OPS` that help the
developer to define the TLV operations for the IS-IS Sub-Sub-TLVs.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:25 +02:00
Carmine Scarpitta
b9547a0b70 isisd: Pack SRv6 End SID when packing Sub-TLVs
Extend generic Sub-TLVs pack function to pack SRv6 End SID Sub-TLVs
(RFC 9352 section #7.2).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:25 +02:00
Carmine Scarpitta
47dc349498 isisd: Free SRv6 End SID when freeing Sub-TLVs
Extend generic Sub-TLVs free function to free SRv6 End SID Sub-TLVs
(RFC 9352 section #7.2).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:24 +02:00
Carmine Scarpitta
64d3629bd4 isisd: Add SRv6 End SID to Sub-TLVs format func
Extend generic Sub-TLVs format function to return information about
SRv6 End SID Sub-TLVs (RFC 9352 section #7.2).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:24 +02:00
Carmine Scarpitta
fbc3637d50 isisd: Copy SRv6 End SID when copying Sub-TLVs
Extend generic Sub-TLVs copy function to copy SRv6 End SID Sub-TLVs
(RFC 9352 section #7.2).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:23 +02:00
Carmine Scarpitta
15ecf1a125 isisd: Bind SRv6 End SID Sub-TLV ops to TLV type
General Sub-TLV processing functions (i.e., copy, format, free, pack,
and unpack) perform a lookup of the specific handler for a Sub-TLV in
the `tlv_table`, and then call the specific handler to process the
Sub-TLV.
This commit adds the handlers for the SRv6 End SID Sub-TLV (stored in
`tlv_srv6_end_sid_ops`) to the `tlv_table`.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:23 +02:00
Carmine Scarpitta
dda911b30a isisd: Define TLV ops for SRv6 End SID Sub-TLV
Use the ITEM_SUBTLV_OPS macro to define the TLV operations for the SRv6
End SID Sub-TLV (RFC 9352 section #7.2).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:22 +02:00
Carmine Scarpitta
71b8756f80 isisd: Add unpack func for SRv6 End SID Sub-TLV
Add a function to unpack an SRv6 End SID Sub-TLV
(RFC 9352 section FRRouting#7.2).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 22:11:22 +02:00
Carmine Scarpitta
b38fed40a1 isisd: Add pack function for SRv6 End SID Sub-TLV
Add a function to pack an SRv6 End SID Sub-TLV
(RFC 9352 section #7.2).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:19 +02:00
Carmine Scarpitta
6605ccf09e isisd: Add free function for SRv6 End SID Sub-TLV
Add a function to free an SRv6 End SID Sub-TLV
(RFC 9352 section #7.2).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:19 +02:00
Carmine Scarpitta
2bacddcaec isisd: Add format func for SRv6 End SID Sub-TLV
Add a function to return information about an SRv6 End SID Sub-TLV
(RFC 9352 section #7.2).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:18 +02:00
Carmine Scarpitta
ee47a75047 isisd: Add copy function for SRv6 End SID Sub-TLV
Add a function to copy an SRv6 End SID Sub-TLV (RFC 9352 section #7.2).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:18 +02:00
Carmine Scarpitta
989138b99e isisd: Add context value for SRv6 End SID Sub-TLV
Add a new TLV context value for the SRv6 End SID Sub-TLV. It will be
needed to support unpacking of the Sub-Sub-TLVs of the SRv6 End SID
Sub-TLV in future commits.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:17 +02:00
Carmine Scarpitta
7f3e793619 isisd: Initialize SRv6 End SID Sub-TLVs list
Initialize the SRv6 End SID Sub-TLVs list in `isis_alloc_subtlvs()`.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:17 +02:00
Carmine Scarpitta
0caeda5a38 isisd: Add SRv6 End SID Sub-TLV data structure
Add a data structure to represent an SRv6 End SID Sub-TLV as per
RFC 9352 section #7.2.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:16 +02:00
Carmine Scarpitta
c40ab5f2a8 isisd: Initialize SRv6 Locator TLVs list
Initialize the SRv6 Locator TLVs list in `isis_alloc_tlvs()`.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:16 +02:00
Carmine Scarpitta
c43043e618 isisd: Decode MTID when unpacking SRv6 Locator TLV
The SRv6 Locator TLV (RFC 9352 section #7.1) starts with the MTID field.
Let's expect the MTID as the first field when we are unpacking an SRv6
Locator TLV.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:15 +02:00
Carmine Scarpitta
cb55a1bb9b isisd: Add MTID when packing SRv6 Locator TLV
The SRv6 Locator TLV (RFC 9352 section #7.1) starts with the MTID field.
Let's put the MTID as the first field when we are packing an SRv6
Locator TLV.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:15 +02:00
Carmine Scarpitta
f5466cc8f6 isisd: Add SRv6 Locator TLV to pack_order struct
Add the SRv6 Locator TLV to the `pack_order` data structure.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:15 +02:00
Carmine Scarpitta
12da71d9f8 isisd: Bind SRv6 Locator TLV ops to IS-IS TLV type
General TLV processing functions (i.e., copy, format, free, pack, and
unpack) perform a lookup of the specific handler for a TLV in the
`tlv_table`, and then call the specific handler to process the TLV.
This commit adds the handlers for the SRv6 Locator TLV (stored in
`tlv_srv6_locator_ops`) to the `tlv_table`.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:14 +02:00
Carmine Scarpitta
ed69638745 isisd: Define TLV ops for SRv6 Locator TLV
Use the ITEM_TLV_OPS macro to define the TLV operations for the SRv6
Locator TLV (RFC 9352 section #7.1).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:14 +02:00
Carmine Scarpitta
0225f908e8 isisd: Add unpack function for SRv6 Locator TLV
Add a function to unpack an SRv6 Locator TLV and all its Sub-TLVs
(RFC 9352 section #7.1).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:13 +02:00
Carmine Scarpitta
b2f0b7d0b0 isisd: Add pack function for SRv6 Locator TLV
Add a function to pack an SRv6 Locator TLV and all its Sub-TLVs
(RFC 9352 section #7.1).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:13 +02:00
Carmine Scarpitta
efb113b9ca isisd: Free SRv6 Locator TLV when freeing TLVs
Extend generic TLVs free function to free SRv6 Locator TLVs (RFC 9352
section #7.1).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:12 +02:00
Carmine Scarpitta
5a81a9bd59 isisd: Add free function for SRv6 Locator TLV
Add a function to free an SRv6 Locator TLV and all its Sub-TLVs
(RFC 9352 section #7.1).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:12 +02:00
Carmine Scarpitta
462a242999 isisd: Add SRv6 Locator TLV to TLVs format func
Extend generic TLVs format function to return information about SRv6
Locator TLVs (RFC 9352 section #7.1).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:11 +02:00
Carmine Scarpitta
a48d6a2049 isisd: Add format function for SRv6 Locator TLV
Add a function to return information about an SRv6 Locator TLV and all
its Sub-TLVs (RFC 9352 section #7.1).

Examples:

r1# show isis database detail
Area 1:
IS-IS Level-1 link-state database:
LSP ID                  PduLen  SeqNumber   Chksum  Holdtime  ATT/P/OL
r1.00-00             *    248   0x00000005  0xda6e     824    0/0/0
[...]
  SRv6 Locator: fc00:0:1::/48 (Metric: 0) standard
    Sub-TLVs:
[...]

r1# show isis database detail json
[...]
              "srv6-locator":{
                "mt-id":0,
                "prefix":"fc00:0:1::/48",
                "metric":0,
                "d-flag":"",
                "algorithm":0,
                "mt-name":"standard",
                "subtlvs":{

                }
              }
[...]

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:11 +02:00
Carmine Scarpitta
24c9374da1 isisd: Copy SRv6 Locator TLV when copying TLVs
Extend generic TLVs copy function to copy SRv6 Locator TLVs (RFC 9352
section #7.1).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:10 +02:00
Carmine Scarpitta
a2bd91e5b8 isisd: Add copy function for SRv6 Locator TLV
Add a function to copy an SRv6 Locator TLV (RFC 9352 section #7.1).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:10 +02:00
Carmine Scarpitta
f915c80606 isisd: Add SRv6 SID Struct Sub-Sub-TLV Codepoint
Add the `IS-IS SRv6 SID Structure Sub-Sub-TLV Codepoint` as defined in the
`IS-IS Sub-Sub-TLVs for SRv6 SID Sub-TLVs` IANA registry. This codepoint
will be used as the Sub-Sub-TLV Type to advertise the SRv6 SID Structure
Sub-Sub-TLV in the SRv6 End SID, SRv6 End.X SID, and SRv6 LAN End.X SID
Sub-TLVs.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:10 +02:00
Carmine Scarpitta
f9b476080f isisd: Add IS-IS SRv6 End SID Sub-TLV Codepoint
Add the `IS-IS SRv6 End SID Sub-TLV Codepoint` as defined in the
`IS-IS Sub-TLVs for TLVs Advertising Prefix Reachability` IANA registry.
This codepoint will be used as the Sub-TLV
Type to advertise the SRv6 End SID Sub-TLV in the SRv6 Locator TLV.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:09 +02:00
Carmine Scarpitta
f1152a9005 isisd: Extend SPF algo to process SRv6 locator
Extend SPF algorithm to process SRv6 locator.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:09 +02:00
Carmine Scarpitta
39cf995a82 isisd: Add SRv6 Cap to Router Cap TLV format func
Extend Router Capabilities TLV format function to return information
about SRv6 Capabilities Sub-TLVs (RFC 9352 section #2).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:08 +02:00
Carmine Scarpitta
ca787a12a4 isisd: Add context value for SRv6 Locator TLV
Add a new TLV context value for the SRv6 Locator TLV. It will be needed
to support unpacking of the Sub-TLVs of the SRv6 Locator TLV in future
commits.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:08 +02:00
Carmine Scarpitta
911ec6b474 isisd: Add SRv6 Locator TLV data structure
Add a data structure to represent an SRv6 Locator TLV as per RFC 9352
section #7.1.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:07 +02:00
Carmine Scarpitta
150d3d3a02 isisd: Add IS-IS SRv6 Locator TLV Codepoint
Add IS-IS SRv6 Locator TLV Codepoint as defined in the IANA registry
IS-IS Top-Level TLV Codepoints.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:07 +02:00
Carmine Scarpitta
95af6c11c8 isisd: Remove SRv6 End SIDs after locator unset
When an SRv6 locator is unset, remove all the SRv6 End SIDs allocated
from that locator.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:07 +02:00
Carmine Scarpitta
58d85ce965 isisd: Install SRv6 End SID automatically
When zebra assigns a chunk to IS-IS, zebra sends a
ZEBRA_SRV6_MANAGER_GET_LOCATOR_CHUNK notification to IS-IS.
IS-IS invokes the `isis_zebra_process_srv6_locator_chunk()` callback to
process the received notification.

Actually, `isis_zebra_process_srv6_locator_chunk()` iterates over all
areas of the current IS-IS instance and looks for an area for which the
received chunk was requested.
If a match is found, the new chunk is added to the area's chunk list and
`lsp_regenerate_schedule()` is called to regenerate the LSPs to
advertise the new SRv6 locator.

This commit extends the `isis_zebra_process_srv6_locator_chunk()`
function to automatically allocate an SRv6 End SID from the received
chunk and install it in the data plane.

The SRv6 End SID is the instantiation of a Prefix-SID (RFC 8986 section

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:06 +02:00