summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2025-01-20 09:20:15 +0100
committerGitHub <noreply@github.com>2025-01-20 09:20:15 +0100
commit084ebc9473abb8845e575511e0aa2897f15234fc (patch)
tree8ea1bad51ce89177659815bb63b0021e8a724d38 /lib
parent979279510831bdecb5a1ad80a6c050b26e4f0b91 (diff)
parentf56a77359b475c67bb3ddc872f56cb04ec1cea45 (diff)
Merge pull request #16894 from wenwang00/project-phoenixwing-ysj
staticd: Add support for SRv6 Static SIDs
Diffstat (limited to 'lib')
-rw-r--r--lib/command.h1
-rw-r--r--lib/srv6.h38
2 files changed, 39 insertions, 0 deletions
diff --git a/lib/command.h b/lib/command.h
index c60751789f..dfd732893b 100644
--- a/lib/command.h
+++ b/lib/command.h
@@ -154,6 +154,7 @@ enum node_type {
PCEP_PCE_NODE, /* PCE configuration node */
PCEP_PCC_NODE, /* PCC configuration node */
SRV6_NODE, /* SRv6 node */
+ SRV6_SIDS_NODE, /* SRv6 SIDs node */
SRV6_LOCS_NODE, /* SRv6 locators node */
SRV6_LOC_NODE, /* SRv6 locator node */
SRV6_ENCAP_NODE, /* SRv6 encapsulation node */
diff --git a/lib/srv6.h b/lib/srv6.h
index 9a041e3d85..7e4fb97ad1 100644
--- a/lib/srv6.h
+++ b/lib/srv6.h
@@ -22,6 +22,8 @@
#define SRV6_SID_FORMAT_NAME_SIZE 512
+#define DEFAULT_SRV6_IFNAME "sr0"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -186,6 +188,42 @@ enum srv6_endpoint_behavior_codepoint {
SRV6_ENDPOINT_BEHAVIOR_OPAQUE = 0xFFFF,
};
+/*
+ * Convert SRv6 endpoint behavior codepoints to human-friendly string.
+ */
+static inline const char *
+srv6_endpoint_behavior_codepoint2str(enum srv6_endpoint_behavior_codepoint behavior)
+{
+ switch (behavior) {
+ case SRV6_ENDPOINT_BEHAVIOR_RESERVED:
+ return "Reserved";
+ case SRV6_ENDPOINT_BEHAVIOR_END:
+ return "End";
+ case SRV6_ENDPOINT_BEHAVIOR_END_X:
+ return "End.X";
+ case SRV6_ENDPOINT_BEHAVIOR_END_DT6:
+ return "End.DT6";
+ case SRV6_ENDPOINT_BEHAVIOR_END_DT4:
+ return "End.DT4";
+ case SRV6_ENDPOINT_BEHAVIOR_END_DT46:
+ return "End.DT46";
+ case SRV6_ENDPOINT_BEHAVIOR_END_NEXT_CSID:
+ return "uN";
+ case SRV6_ENDPOINT_BEHAVIOR_END_X_NEXT_CSID:
+ return "uA";
+ case SRV6_ENDPOINT_BEHAVIOR_END_DT6_USID:
+ return "uDT6";
+ case SRV6_ENDPOINT_BEHAVIOR_END_DT4_USID:
+ return "uDT4";
+ case SRV6_ENDPOINT_BEHAVIOR_END_DT46_USID:
+ return "uDT46";
+ case SRV6_ENDPOINT_BEHAVIOR_OPAQUE:
+ return "Opaque";
+ }
+
+ return "Unspec";
+}
+
struct nexthop_srv6 {
/* SRv6 localsid info for Endpoint-behaviour */
enum seg6local_action_t seg6local_action;