Commit Graph

33456 Commits

Author SHA1 Message Date
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
Carmine Scarpitta
ea7f533352 isisd: Add func to remove SRv6 SID from dplane
Add a function to remove an SRv6 SID from the data plane through
zebra.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:06 +02:00
Carmine Scarpitta
8b6d051c54 isisd: Add func to install SRv6 SID in dplane
Add a function to install an SRv6 SID in the data plane through
zebra.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:05 +02:00
Carmine Scarpitta
a239951dde isisd: Add function to send SRv6 SID to zebra
Add a function to install/remove an SRv6 SID in the forwarding plane
through Zebra.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:05 +02:00
Carmine Scarpitta
7064d8a727 isisd: Uninstall routes only if installed
In some cases, IS-IS may attempt to remove routes that have not been
installed before. We can prevent IS-IS from doing this by aborting
`isis_zebra_route_del_route` when the ISIS_ROUTE_FLAG_ZEBRA_SYNCED flag
is unset, meaning that the route is not installed in the kernel.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:04 +02:00
Carmine Scarpitta
d890515194 zebra: Encode SRv6 flavors in Netlink messages
Encode SRv6 flavors information when building a seg6local nexthop.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:04 +02:00
Carmine Scarpitta
2417b4add8 zebra: Resolve default values for SRv6 flavor attr
When zebra receives a Netlink message containing a seg6local nexthop,
let's use the default values for optional attributes `lcblock_len` and
`lcnode_fn_len`, if they are not specified.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:04 +02:00
Carmine Scarpitta
c9f0452a14 zebra: Resolve default values for SRv6 flavor attr
When zebra receives a Netlink message containing a seg6local nexthop,
let's use the default values for optional attributes `lcblock_len` and
`lcnode_fn_len`, if they are not specified.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:03 +02:00
Carmine Scarpitta
79e37f0ded lib: Define default values for SRv6 flavors attrs
When installing a local SID in the Linux kernel, `lcblock_len` and
`lcnode_fn_len` Netlink attributes are optional. When omitted, the
kernel uses the default values: lcblock_len=32 and lcnode_fn_len=16.
Let's use the same default values in FRR.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:03 +02:00
Carmine Scarpitta
f4d2d9ba0a zebra: Extend rt_netlink.c to parse SRv6 flavors
Extend the `parse_encap_seg6local` function to parse SRv6 flavors
information contained in the Netlink message.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:02 +02:00
Carmine Scarpitta
f26becb27a lib: Add SRv6 flavors manipulation macros
`struct seg6local_context` contains a `struct seg6local_flavors_info`
that carries SRv6 flavors information. The `seg6local_flavors_info`
data structure contains a field `flv_ops` that indicates which flavors
are enabled for the `seg6local` nexthop. `flv_ops` is a bit-map where
each bit indicates if a particular SRv6 flavor is enabled (bit set to
1) or not (bit set to 0).

This commit defines some macros that can be used to manipulate the SRv6
flavors bit-map:
* CHECK_SRV6_FLV_OP(OPS,OP) - check if a particular flavor is enabled;
* SET_SRV6_FLV_OP(OPS,OP) - enable a particular flavor (OP);
* UNSET_SRV6_FLV_OP(OPS,OP) - disable a particular flavor (OP);
* RESET_SRV6_FLV_OP(OPS) - disable all SRv6 flavors.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:02 +02:00
Carmine Scarpitta
164bcddab7 lib: Add SRv6 flavors info to seg6local nexthop
The RFC 8986 defines the SRv6 Network Programming concept and specifies
the base set of SRv6 behaviors that enables the creation of
interoperable overlays with underlay optimization. In addition, the RFC
8986 introduces the concept of "flavors", additional operations that can
modify or extend the existing SRv6 behaviors.

In the Linux kernel and in FRR, an SRv6 SID is implemented as a route
associated with a `seg6local` nexthop. A `seg6local` nexthop represents
an SRv6 behavior bound to a SID.

The Linux kernel already supports the ability to add a set of flavors
to a `seg6local` nexthop to modify or extend the associated behavior.

This commit aligns the `seg6local` nexthop implementation of FRR to the
Linux kernel. It extends the `seg6local` nexthop implementation by
adding a struct `seg6local_flavors_info` that encodes the SRv6
flavors information.

Currently, the `seg6local_flavors_info` data structure has three
members:
- `tlv_ops` indicates which flavors are enabled for the `seg6local`
  nexthop;
- `lcblock_len`is the length of the Locator-Block part of the SID;
- `lcnode_func_len` is the length of the combined Node and Function
  parts of the SID.

`lcblock_len` and `lcnode_func_len` define the SID structure. They are
required for some behaviors (e.g. NEXT-C-SID and REPLACE-C-SID). For
other flavors (e.g. PSP, USP, USD) these parameters are not required and
can be omitted.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:02 +02:00
Carmine Scarpitta
bf386acb93 lib: Add new enum for seg6local flavor operations
The RFC 8986 defines the SRv6 Network Programming concept and specifies
the base set of SRv6 behaviors that enables the creation of
interoperable overlays with underlay optimization. In addition, the RFC
8986 introduces the concept of "flavors", additional operations that can
modify or extend the existing SRv6 behaviors.

This commit adds a new enum type `seg6local_flavor_op` to represent the
SRv6 flavors operations. Currently we define the following flavor
operations:
- PSP (defined in RFC 8986 section #4.16.1)
- USP (defined in RFC 8986 section #4.16.2)
- USD (defined in RFC 8986 section #4.16.3)
- NEXT-C-SID (defined in draft-ietf-spring-srv6-srh-compression-03 #4.1)

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:01 +02:00
Carmine Scarpitta
7c27ab79ec include: Update seg6_local.h to last kernel
Update `seg6_local.h` to the last kernel version, required to support
SRv6 flavors.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:01 +02:00
Carmine Scarpitta
d48f265e15 lib: Add SRv6 behavior codepoints needed for IS-IS
Add more SRv6 endpoint behaviors that are required for implementing
IS-IS SRv6 extensions (RFC 9352).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:01 +02:00
Carmine Scarpitta
8d1af2a4b0 isisd: Add function to allocate an SRv6 SID
Add a function to allocate an SRv6 SID from an SRv6 locator chunk owned
by IS-IS. The chunk must be allocated by a previous call to
`isis_zebra_srv6_manager_get_locator_chunk()`.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:00 +02:00
Carmine Scarpitta
26d7806d20 isisd: Add SRv6 SIDs to SRv6 configuration
Add the list of SRv6 SIDs allocated by the IS-IS instance to the per-area
SRv6 configuration. The list is area-specific. Each IS-IS area has its
own SRv6 SIDs list. The list is initialized when an IS-IS area is
created and freed when an IS-IS area is destroyed.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:35:00 +02:00
Carmine Scarpitta
f6238e10b0 isisd: Add function to free an SRv6 SID
Add a function to free an SRv6 SID.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:34:59 +02:00
Carmine Scarpitta
acb78513a5 isisd: Add new memtype for IS-IS SRv6 SID
Define a new memtype `MTYPE_ISIS_SRV6_SID` used to allocate objects of
type `IS-IS SRv6 SID`.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:34:59 +02:00
Carmine Scarpitta
a933a4dd5d isisd: Add SRv6 SID structure to SRv6 SID
Add SRv6 SID structure as a member of the SRv6 SID to specify the format
of a specific SID (i.e., block/node/function/argument length).

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:34:58 +02:00
Carmine Scarpitta
057e9df2cc isisd: Add SRv6 SID structure data structure
Add `struct isis_srv6_sid_structure` data structure to represent an SRv6
SID structure (as defined in RFC 8986 section #3.1).

The struct has the following members:
* loc_block_len: locator block length
* loc_node_len: locator node length
* func_len: function length
* arg_len: argument length

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:34:58 +02:00
Carmine Scarpitta
e047b39dc1 isisd: Add SRv6 SID data structure
Add `struct isis_srv6_sid` data structure to represent an SRv6 SID.

The struct has the following members:
* next: pointer to the next SID, used to build linked lists of SRv6 SIDs
* flags: SID flags
* behavior: the behavior bound to the SRv6 SID (as defined in RFC 8986)
* value: the SID value (i.e., an IPv6 address)
* locator: a backpointer to the parent locator from which the SID has
been allocated.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:34:58 +02:00
Carmine Scarpitta
70fba45daf isisd: Add CLI command to unset SRv6 locator
Add a CLI command to unset a previously configured SRv6 locator for a
specific IS-IS instance.

Example:

r1# configure
r1(config)# router isis FOO
r1(config-router)# segment-routing srv6
r1(config-router-srv6)# no locator loc1

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:34:57 +02:00
Carmine Scarpitta
bdebc79d50 isisd: Add CLI command to configure SRv6 locator
Add a CLI command to configure an SRv6 locator for a specific IS-IS
instance.

Example:

r1# configure
r1(config)# router isis FOO
r1(config-router)# segment-routing srv6
r1(config-router-srv6)# locator loc1

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:34:57 +02:00
Carmine Scarpitta
7af35808f4 isisd: Add nb command to show SRv6 locator info
Add a northbound command to show information about the SRv6 locator
configured in IS-IS.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:34:56 +02:00
Carmine Scarpitta
31d76b1045 isisd: Add nb command to unset an SRv6 locator
Add a northbound command to unset an SRv6 locator for a specific
IS-IS area. This is a wrapper around `isis_srv6_locator_unset()`.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:34:56 +02:00
Carmine Scarpitta
95096e9585 isisd: Add nb command to configure an SRv6 locator
Add a northbound command to configure an SRv6 locator for a specific
IS-IS area.

After configuring a locator, `isis_zebra_srv6_manager_get_locator_chunk`
is called to ask zebra to allocate a chunk from the configured locator.
The allocated chunk will be owned by IS-IS. IS-IS can allocate SIDs from
its chunk.

Currently, we support only one locator per-area. Therefore, before
configuring a locator we unset the previously configured locator, if
there was any.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:34:55 +02:00
Carmine Scarpitta
6b881e41ae yang: Add SRv6 locator to the IS-IS YANG model
Add the `locator` leaf  to the IS-IS  YANG model under the
`segment-routing-srv6` container.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:34:55 +02:00
Carmine Scarpitta
f49937e340 isisd: Add func to unset the SRv6 locator
Add a function to unset the SRv6 locator for a specific IS-IS area.

This function calls `isis_zebra_srv6_manager_release_locator_chunk()` to
ask zebra to release the locator chunk owned by IS-IS and removes the
chunk from the area's chunks list.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:34:55 +02:00
Carmine Scarpitta
d223a8167e isisd: Add func to process a deleted SRv6 locator
Add a callback function `isis_zebra_process_srv6_locator_delete()` that
is called when an SRv6 locator is deleted in zebra.

When an existing SRv6 locator is deleted in zebra, zebra sends a
ZEBRA_SRV6_LOCATOR_DELETE notification to all daemons informing them of
the deleted locator.

In IS-IS, we register the new `isis_zebra_process_srv6_locator_delete()`
callback as the handler for ZEBRA_SRV6_LOCATOR_DELETE.

This callback iterates over all areas of the current IS-IS instance and
looks for an area for which the deleted locator was configured.
If a match is found, we remove
the locator's chunks from the area's chunks list and call
`lsp_regenerate_schedule` to remove the locator from the SRv6 Locator
TLV advertised in the LSPs and regenerate the LSPs.
If no match is found, we do nothing.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
2023-09-11 17:34:54 +02:00
Carmine Scarpitta
5b9c03b0d3 isisd: Add func to process a received SRv6 locator
Add a callback function `isis_zebra_process_srv6_locator_add()` that is
called upon receiving an SRv6 locator from zebra.

When a new SRv6 locator is created in zebra, zebra sends a
ZEBRA_SRV6_LOCATOR_ADD notification to all daemons informing them of the
new locator.

In IS-IS, we register the new `isis_zebra_process_srv6_locator_add()`
callback as the handler for ZEBRA_SRV6_LOCATOR_ADD.

This callback iterates over all areas of the current IS-IS instance and
looks for an area for which the new locator was configured.
If a match is found, we call
`isis_zebra_srv6_manager_get_locator_chunk()` to ask zebra a chunk from
the locator.
If no match is found, we do nothing.

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