From: Carmine Scarpitta Date: Mon, 20 Mar 2023 18:05:18 +0000 (+0100) Subject: lib: Add SRv6 flavors info to `seg6local` nexthop X-Git-Tag: base_9.1~88^2~109 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=164bcddab782fba52d57387799cfef5641bedbbf;p=mirror%2Ffrr.git 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 --- diff --git a/lib/srv6.h b/lib/srv6.h index 4f004bf5df..f5a9431896 100644 --- a/lib/srv6.h +++ b/lib/srv6.h @@ -69,10 +69,21 @@ struct seg6_segs { struct in6_addr segs[256]; }; +struct seg6local_flavors_info { + /* Flavor operations */ + uint32_t flv_ops; + + /* Locator-Block length, expressed in bits */ + uint8_t lcblock_len; + /* Locator-Node Function length, expressed in bits */ + uint8_t lcnode_func_len; +}; + struct seg6local_context { struct in_addr nh4; struct in6_addr nh6; uint32_t table; + struct seg6local_flavors_info flv; }; struct srv6_locator {