Commit Graph

145 Commits

Author SHA1 Message Date
Donald Sharp
2bf051a577 *: Remove Crypto openSSL define from zebra.h
Only a couple of places use this.  Move these to a better
spot.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-01-04 14:02:34 -05: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
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
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
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
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
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
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
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
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
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
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
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