summaryrefslogtreecommitdiff
path: root/lib/srv6.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/srv6.h')
-rw-r--r--lib/srv6.h29
1 files changed, 24 insertions, 5 deletions
diff --git a/lib/srv6.h b/lib/srv6.h
index 7c8c6b4a65..fb34f861c8 100644
--- a/lib/srv6.h
+++ b/lib/srv6.h
@@ -14,8 +14,11 @@
#include <arpa/inet.h>
#include <netinet/in.h>
-#define SRV6_MAX_SIDS 16
+#define SRV6_MAX_SIDS 16
+#define SRV6_MAX_SEGS 8
#define SRV6_LOCNAME_SIZE 256
+#define SRH_BASE_HEADER_LENGTH 8
+#define SRH_SEGMENT_LENGTH 16
#ifdef __cplusplus
extern "C" {
@@ -74,6 +77,8 @@ enum seg6local_flavor_op {
ZEBRA_SEG6_LOCAL_FLV_OP_NEXT_CSID = 4,
};
+#define SRV6_SEG_STRLEN 1024
+
struct seg6_segs {
size_t num_segs;
struct in6_addr segs[256];
@@ -89,6 +94,11 @@ struct seg6local_flavors_info {
uint8_t lcnode_func_len;
};
+struct seg6_seg_stack {
+ uint8_t num_segs;
+ struct in6_addr seg[0]; /* 1 or more segs */
+};
+
struct seg6local_context {
struct in_addr nh4;
struct in6_addr nh6;
@@ -170,7 +180,7 @@ struct nexthop_srv6 {
struct seg6local_context seg6local_ctx;
/* SRv6 Headend-behaviour */
- struct in6_addr seg6_segs;
+ struct seg6_seg_stack *seg6_segs;
};
static inline const char *seg6_mode2str(enum seg6_mode_t mode)
@@ -206,12 +216,21 @@ static inline bool sid_diff(
return !sid_same(a, b);
}
-static inline bool sid_zero(
- const struct in6_addr *a)
+
+static inline bool sid_zero(const struct seg6_seg_stack *a)
+{
+ struct in6_addr zero = {};
+
+ assert(a);
+
+ return sid_same(&a->seg[0], &zero);
+}
+
+static inline bool sid_zero_ipv6(const struct in6_addr *a)
{
struct in6_addr zero = {};
- return sid_same(a, &zero);
+ return sid_same(&a[0], &zero);
}
static inline void *sid_copy(struct in6_addr *dst,