aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/sr
diff options
context:
space:
mode:
authorShwetha Bhandari <shwethab@cisco.com>2017-01-18 12:43:54 +0530
committerDamjan Marion <dmarion.lists@gmail.com>2017-03-06 20:00:14 +0000
commit78372a9a55098ad43c4d6d941b640cce4ff24226 (patch)
tree62235b442f7806fc129d5a68eb6f17d53de05da8 /src/vnet/sr
parentb16bfe3f94739821c7382bd0849630b21e03a8b7 (diff)
ioam: manycast using iOAM and SR (VPP-628)
Change-Id: I6d2afda991d771fb4a89fc3f6544f8e940a9b9f0 Signed-off-by: Shwetha Bhandari <shwethab@cisco.com>
Diffstat (limited to 'src/vnet/sr')
-rwxr-xr-xsrc/vnet/sr/sr.h40
1 files changed, 39 insertions, 1 deletions
diff --git a/src/vnet/sr/sr.h b/src/vnet/sr/sr.h
index eb781e4bcee..1545a84f38b 100755
--- a/src/vnet/sr/sr.h
+++ b/src/vnet/sr/sr.h
@@ -83,7 +83,6 @@ typedef struct
ip6_address_t bsid; /**< BindingSID (key) */
u8 type; /**< Type (default is 0) */
-
/* SR Policy specific DPO */
/* IF Type = DEFAULT Then Load Balancer DPO among SID lists */
/* IF Type = SPRAY then Spray DPO with all SID lists */
@@ -290,6 +289,45 @@ sr_steering_policy (int is_del, ip6_address_t * bsid, u32 sr_policy_index,
u32 table_id, ip46_address_t * prefix, u32 mask_width,
u32 sw_if_index, u8 traffic_type);
+/**
+ * @brief SR rewrite string computation for SRH insertion (inline)
+ *
+ * @param sl is a vector of IPv6 addresses composing the Segment List
+ *
+ * @return precomputed rewrite string for SRH insertion
+ */
+static inline u8 *
+ip6_compute_rewrite_string_insert (ip6_address_t * sl)
+{
+ ip6_sr_header_t *srh;
+ ip6_address_t *addrp, *this_address;
+ u32 header_length = 0;
+ u8 *rs = NULL;
+
+ header_length = 0;
+ header_length += sizeof (ip6_sr_header_t);
+ header_length += (vec_len (sl) + 1) * sizeof (ip6_address_t);
+
+ vec_validate (rs, header_length - 1);
+
+ srh = (ip6_sr_header_t *) rs;
+ srh->type = ROUTING_HEADER_TYPE_SR;
+ srh->segments_left = vec_len (sl);
+ srh->first_segment = vec_len (sl);
+ srh->length = ((sizeof (ip6_sr_header_t) +
+ ((vec_len (sl) + 1) * sizeof (ip6_address_t))) / 8) - 1;
+ srh->flags = 0x00;
+ srh->reserved = 0x0000;
+ addrp = srh->segments + vec_len (sl);
+ vec_foreach (this_address, sl)
+ {
+ clib_memcpy (addrp->as_u8, this_address->as_u8, sizeof (ip6_address_t));
+ addrp--;
+ }
+ return rs;
+}
+
+
#endif /* included_vnet_sr_h */
/*