From 9b7491e1fc04bf71842865906dbf9a36e62bdb28 Mon Sep 17 00:00:00 2001 From: Carmine Scarpitta Date: Thu, 27 Oct 2022 18:32:19 +0200 Subject: lib: Add support for flags to the SRv6 locator In this commit, we introduce the ability to specify flags for an SRv6 locator. Flags can be used to specify the properties of the locator. Signed-off-by: Carmine Scarpitta --- lib/srv6.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/srv6.h') diff --git a/lib/srv6.h b/lib/srv6.h index 6e0c3ce99d..a3575583ae 100644 --- a/lib/srv6.h +++ b/lib/srv6.h @@ -92,6 +92,8 @@ struct srv6_locator { bool status_up; struct list *chunks; + uint8_t flags; + QOBJ_FIELDS; }; DECLARE_QOBJ_TYPE(srv6_locator); @@ -116,6 +118,8 @@ struct srv6_locator_chunk { uint8_t proto; uint16_t instance; uint32_t session_id; + + uint8_t flags; }; struct nexthop_srv6 { -- cgit v1.2.3 From 02b1544a5c181b8ed24aa084982da1f986325927 Mon Sep 17 00:00:00 2001 From: Carmine Scarpitta Date: Thu, 27 Oct 2022 18:41:54 +0200 Subject: lib: Add `SRV6_LOCATOR_USID` flag to SRv6 locator In this commit, we add support for a new flag called `SRV6_LOCATOR_USID`. When the `SRV6_LOCATOR_USID` flag is set, the routing protocols will install SRv6 behaviors with the uSID in the dataplane. This flag is used to specify a locator as a uSID locator. When a locator is specified as a uSID locator, all the SRv6 SIDs allocated from the locator by the routing protocols (like BGP) are bound to the SRv6 uSID behaviors and use the SRv6 uSID codepoints in the BGP update message. We extend the SRv6 locator implementation to add support for a `usid` flag. When the `usid` flag is set, the bgpd will install SRv6 behaviors with the uSID in the dataplane and use the proper SRv6 Endpoint Behavior codepoint in the BGP advertisement. Signed-off-by: Carmine Scarpitta --- lib/srv6.h | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/srv6.h') diff --git a/lib/srv6.h b/lib/srv6.h index a3575583ae..c5fd40fa53 100644 --- a/lib/srv6.h +++ b/lib/srv6.h @@ -93,6 +93,7 @@ struct srv6_locator { struct list *chunks; uint8_t flags; +#define SRV6_LOCATOR_USID (1 << 0) /* The SRv6 Locator is a uSID Locator */ QOBJ_FIELDS; }; -- cgit v1.2.3 From 04947825547f00e5e2f3b894b372b3e4a8201db7 Mon Sep 17 00:00:00 2001 From: Carmine Scarpitta Date: Thu, 27 Oct 2022 19:31:34 +0200 Subject: lib: Add support for SRv6 Behavior codepoints In this commit, we introduce a new enumeration to encode the SRv6 Endpoint Behaviors codepoints defined in the IANA SRv6 Endpoint Behaviors Registry (https://www.iana.org/assignments/segment-routing/segment-routing.xhtml). Signed-off-by: Carmine Scarpitta --- lib/srv6.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib/srv6.h') diff --git a/lib/srv6.h b/lib/srv6.h index c5fd40fa53..f128b8b086 100644 --- a/lib/srv6.h +++ b/lib/srv6.h @@ -123,6 +123,21 @@ struct srv6_locator_chunk { uint8_t flags; }; +/* + * SRv6 Endpoint Behavior codepoints, as defined by IANA in + * https://www.iana.org/assignments/segment-routing/segment-routing.xhtml + */ +enum srv6_endpoint_behavior_codepoint { + SRV6_ENDPOINT_BEHAVIOR_RESERVED = 0x0000, + SRV6_ENDPOINT_BEHAVIOR_END_DT6 = 0x0012, + SRV6_ENDPOINT_BEHAVIOR_END_DT4 = 0x0013, + SRV6_ENDPOINT_BEHAVIOR_END_DT46 = 0x0014, + SRV6_ENDPOINT_BEHAVIOR_END_DT6_USID = 0x003E, + SRV6_ENDPOINT_BEHAVIOR_END_DT4_USID = 0x003F, + SRV6_ENDPOINT_BEHAVIOR_END_DT46_USID = 0x0040, + SRV6_ENDPOINT_BEHAVIOR_OPAQUE = 0xFFFF, +}; + struct nexthop_srv6 { /* SRv6 localsid info for Endpoint-behaviour */ enum seg6local_action_t seg6local_action; -- cgit v1.2.3