srv6-mobile
[vpp.git] / src / plugins / srv6-as / as.c
index e771cb4..cb95991 100644 (file)
@@ -36,6 +36,7 @@ unsigned char def_str[] =
 unsigned char params_str[] =
   "nh <next-hop> oif <iface-out> iif <iface-in> src <src-addr> next <sid> [next <sid> ...]";
 
+srv6_as_main_t srv6_as_main;
 
 static inline u8 *
 prepare_rewrite (ip6_address_t src_addr, ip6_address_t * sid_list,
@@ -63,7 +64,7 @@ prepare_rewrite (ip6_address_t src_addr, ip6_address_t * sid_list,
   iph->src_address = src_addr;
   iph->dst_address = sid_list[0];
   iph->payload_length = sr_hdr_len;
-  iph->hop_limit = IPv6_DEFAULT_HOP_LIMIT;
+  iph->hop_limit = sr_get_hop_limit ();
 
   if (num_sids > 1)
     {
@@ -76,13 +77,13 @@ prepare_rewrite (ip6_address_t src_addr, ip6_address_t * sid_list,
       srh->length = sr_hdr_len / 8 - 1;
       srh->type = ROUTING_HEADER_TYPE_SR;
       srh->segments_left = num_sids - 1;
-      srh->first_segment = num_sids - 1;
+      srh->last_entry = num_sids - 1;
       srh->flags = 0x00;
-      srh->reserved = 0x00;
+      srh->tag = 0x0000;
 
       /* Fill segment list */
       ip6_address_t *this_address;
-      ip6_address_t *addrp = srh->segments + srh->first_segment;
+      ip6_address_t *addrp = srh->segments + srh->last_entry;
       vec_foreach (this_address, sid_list)
       {
        *addrp = *this_address;
@@ -462,7 +463,7 @@ unformat_srv6_as_localsid (unformat_input_t * input, va_list * args)
 
   /* Allocate and initialize memory block for local SID parameters */
   ls_mem = clib_mem_alloc_aligned_at_offset (sizeof *ls_mem, 0, 0, 1);
-  memset (ls_mem, 0, sizeof *ls_mem);
+  clib_memset (ls_mem, 0, sizeof *ls_mem);
   *plugin_mem_p = ls_mem;
 
   /* Set local SID parameters */
@@ -534,6 +535,7 @@ srv6_as_init (vlib_main_t * vm)
                                      keyword_str,
                                      def_str,
                                      params_str,
+                                     128,
                                      &sm->srv6_as_dpo_type,
                                      format_srv6_as_localsid,
                                      unformat_srv6_as_localsid,
@@ -573,7 +575,7 @@ VLIB_INIT_FUNCTION (srv6_as_init);
 
 VLIB_PLUGIN_REGISTER () = {
   .version = VPP_BUILD_VER,
-  .description = "Static SRv6 proxy",
+  .description = "Static Segment Routing for IPv6 (SRv6) Proxy",
 };
 /* *INDENT-ON* */