VPP-30 sr_replicate requires DPDK
[vpp.git] / vpp / api / api.c
index 4956a43..52616cc 100644 (file)
@@ -42,6 +42,7 @@
 #include <vppinfra/format.h>
 #include <vppinfra/error.h>
 
+#include <vnet/api_errno.h> // alagalah TODO : committers please pay note, is this ok?
 #include <vnet/vnet.h>
 #include <vnet/l2/l2_input.h>
 #include <vnet/l2/l2_bd.h>
@@ -64,6 +65,7 @@
 #include <vnet/classify/input_acl.h>
 #include <vnet/l2/l2_classify.h>
 #include <vnet/vxlan/vxlan.h>
+#include <vnet/gre/gre.h>
 #include <vnet/l2/l2_vtr.h>
 #include <vnet/nsh-gre/nsh_gre.h>
 #include <vnet/nsh-vxlan-gpe/nsh_vxlan_gpe.h>
@@ -272,6 +274,8 @@ _(L2TPV3_SET_LOOKUP_KEY, l2tpv3_set_lookup_key)                         \
 _(SW_IF_L2TPV3_TUNNEL_DUMP, sw_if_l2tpv3_tunnel_dump)                   \
 _(VXLAN_ADD_DEL_TUNNEL, vxlan_add_del_tunnel)                           \
 _(VXLAN_TUNNEL_DUMP, vxlan_tunnel_dump)                                 \
+_(GRE_ADD_DEL_TUNNEL, gre_add_del_tunnel)                               \
+_(GRE_TUNNEL_DUMP, gre_tunnel_dump)                                     \
 _(L2_FIB_CLEAR_TABLE, l2_fib_clear_table)                               \
 _(L2_INTERFACE_EFP_FILTER, l2_interface_efp_filter)                     \
 _(L2_INTERFACE_VLAN_TAG_REWRITE, l2_interface_vlan_tag_rewrite)         \
@@ -321,11 +325,13 @@ _(LISP_ADD_DEL_LOCATOR, lisp_add_del_locator)                           \
 _(LISP_ADD_DEL_LOCAL_EID, lisp_add_del_local_eid)                       \
 _(LISP_GPE_ADD_DEL_FWD_ENTRY, lisp_gpe_add_del_fwd_entry)               \
 _(LISP_ADD_DEL_MAP_RESOLVER, lisp_add_del_map_resolver)                 \
+_(LISP_GPE_ENABLE_DISABLE, lisp_gpe_enable_disable)                     \
 _(LISP_GPE_ADD_DEL_IFACE, lisp_gpe_add_del_iface)                       \
 _(LISP_LOCATOR_SET_DUMP, lisp_locator_set_dump)                         \
 _(LISP_LOCAL_EID_TABLE_DUMP, lisp_local_eid_table_dump)                 \
 _(LISP_GPE_TUNNEL_DUMP, lisp_gpe_tunnel_dump)                           \
-_(LISP_MAP_RESOLVER_DUMP, lisp_map_resolver_dump)
+_(LISP_MAP_RESOLVER_DUMP, lisp_map_resolver_dump)                       \
+_(SR_MULTICAST_MAP_ADD_DEL, sr_multicast_map_add_del)
 
 #define QUOTE_(x) #x
 #define QUOTE(x) QUOTE_(x)
@@ -2212,7 +2218,7 @@ vl_api_ip_neighbor_add_del_t_handler (vl_api_ip_neighbor_add_del_t *mp, vlib_mai
             rv = vnet_set_ip6_ethernet_neighbor 
                 (vm, ntohl(mp->sw_if_index),
                  (ip6_address_t *)(mp->dst_address), 
-                 mp->mac_address, sizeof (mp->mac_address));
+                 mp->mac_address, sizeof (mp->mac_address), mp->is_static);
         else
             rv = vnet_unset_ip6_ethernet_neighbor 
                 (vm, ntohl(mp->sw_if_index),
@@ -2427,7 +2433,8 @@ static void vl_api_sw_interface_clear_stats_t_handler (
 static void send_sw_interface_details (vpe_api_main_t * am,
                                        unix_shared_memory_queue_t *q,
                                        vnet_sw_interface_t * swif,
-                                       u8 * interface_name)
+                                       u8 * interface_name,
+                                       u32 context)
 {
     vl_api_sw_interface_details_t * mp;
     vnet_hw_interface_t * hi;
@@ -2448,6 +2455,7 @@ static void send_sw_interface_details (vpe_api_main_t * am,
     mp->link_speed = ((hi->flags & VNET_HW_INTERFACE_FLAG_SPEED_MASK) >>
                      VNET_HW_INTERFACE_FLAG_SPEED_SHIFT);
     mp->link_mtu = ntohs(hi->max_packet_bytes);
+    mp->context = context;
 
     strncpy ((char *) mp->interface_name, 
              (char *) interface_name, ARRAY_LEN(mp->interface_name)-1);
@@ -2567,7 +2575,7 @@ static void vl_api_sw_interface_dump_t_handler (
         if (mp->name_filter_valid == 0 ||
             strcasestr((char *) name_string, (char *) filter_string)) {
 
-            send_sw_interface_details (am, q, swif, name_string);
+            send_sw_interface_details (am, q, swif, name_string, mp->context);
             send_sw_interface_flags (am, q, swif);
         }
         _vec_len (name_string) = 0;
@@ -3383,7 +3391,15 @@ static void vl_api_sr_tunnel_add_del_t_handler
     a->is_del = (mp->is_add == 0);
     a->rx_table_id = ntohl(mp->outer_vrf_id);
     a->tx_table_id = ntohl(mp->inner_vrf_id);
-
+    
+    a->name = format(0, "%s", mp->name);
+    if (!(vec_len(a->name)))
+      a->name = 0;
+    
+    a->policy_name = format(0, "%s", mp->policy_name);
+    if (!(vec_len(a->policy_name)))
+      a->policy_name = 0;
+    
     /* Yank segments and tags out of the API message */
     this_address = (ip6_address_t *)mp->segs_and_tags;
     for (i = 0; i < mp->n_segments; i++) {
@@ -3408,6 +3424,101 @@ out:
 #endif
 }
 
+static void vl_api_sr_policy_add_del_t_handler
+(vl_api_sr_policy_add_del_t *mp)
+{
+#if IPV6SR == 0
+    clib_warning ("unimplemented");
+#else
+    ip6_sr_add_del_policy_args_t _a, *a=&_a;
+    int rv = 0;
+    vl_api_sr_policy_add_del_reply_t * rmp;
+    int i;
+
+    memset (a, 0, sizeof (*a));
+    a->is_del = (mp->is_add == 0);
+    
+    a->name = format(0, "%s", mp->name);
+    if (!(vec_len(a->name)))
+      {
+        rv = VNET_API_ERROR_NO_SUCH_NODE2;
+       goto out;
+      }      
+
+    if (!(mp->tunnel_names))
+      {
+        rv = VNET_API_ERROR_NO_SUCH_NODE2;
+       goto out;
+      }
+
+    // start deserializing tunnel_names
+    int num_tunnels = mp->tunnel_names[0]; //number of tunnels
+    u8 * deser_tun_names = mp->tunnel_names;
+    deser_tun_names += 1; //moving along
+
+    u8 * tun_name = 0;
+    int tun_name_len = 0;
+
+    for (i=0; i < num_tunnels; i++)
+      {
+       tun_name_len= *deser_tun_names;
+       deser_tun_names += 1;
+       vec_resize (tun_name, tun_name_len);
+       memcpy(tun_name, deser_tun_names, tun_name_len);
+       vec_add1 (a->tunnel_names, tun_name);
+       deser_tun_names += tun_name_len;
+       tun_name = 0;
+      }
+    
+    rv = ip6_sr_add_del_policy (a);
+
+out:
+
+    REPLY_MACRO(VL_API_SR_POLICY_ADD_DEL_REPLY);
+#endif
+}
+
+static void vl_api_sr_multicast_map_add_del_t_handler
+(vl_api_sr_multicast_map_add_del_t *mp)
+{
+#if IPV6SR == 0
+    clib_warning ("unimplemented");
+#else
+    ip6_sr_add_del_multicastmap_args_t _a, *a=&_a;
+    int rv = 0;
+    vl_api_sr_multicast_map_add_del_reply_t * rmp;
+
+    memset (a, 0, sizeof (*a));
+    a->is_del = (mp->is_add == 0);
+    
+    a->multicast_address = (ip6_address_t *)&mp->multicast_address;
+    a->policy_name = format(0, "%s", mp->policy_name);
+
+    if (a->multicast_address == 0)
+      {
+        rv = -1 ; 
+       goto out;
+      }      
+
+    if (!(a->policy_name))
+      {
+        rv = -2 ; 
+       goto out;
+      }
+
+#if DPDK > 0 /* Cannot call replicate without DPDK */
+    rv = ip6_sr_add_del_multicastmap (a);
+#else
+    clib_warning ("multicast replication without DPDK not implemented");
+    rv = VNET_API_ERROR_UNIMPLEMENTED;
+#endif /* DPDK */
+
+out:
+
+    REPLY_MACRO(VL_API_SR_MULTICAST_MAP_ADD_DEL_REPLY);
+#endif
+}
+
 #define foreach_classify_add_del_table_field    \
 _(table_index)                                  \
 _(nbuckets)                                     \
@@ -3689,7 +3800,8 @@ static void vl_api_sw_interface_vhost_user_details_t_handler (
 #if DPDK > 0
 static void send_sw_interface_vhost_user_details (vpe_api_main_t * am,
                                        unix_shared_memory_queue_t *q,
-                                       vhost_user_intf_details_t * vui)
+                                       vhost_user_intf_details_t * vui,
+                                       u32 context)
 {
     vl_api_sw_interface_vhost_user_details_t * mp;
 
@@ -3702,6 +3814,7 @@ static void send_sw_interface_vhost_user_details (vpe_api_main_t * am,
     mp->is_server = vui->is_server;
     mp->num_regions = ntohl(vui->num_regions);
     mp->sock_errno = ntohl(vui->sock_errno);
+    mp->context = context;
 
     strncpy ((char *) mp->sock_filename,
              (char *) vui->sock_filename, ARRAY_LEN(mp->sock_filename)-1);
@@ -3734,7 +3847,7 @@ vl_api_sw_interface_vhost_user_dump_t_handler (
         return;
 
     vec_foreach (vuid, ifaces) {
-        send_sw_interface_vhost_user_details (am, q, vuid);
+        send_sw_interface_vhost_user_details (am, q, vuid, mp->context);
     }
     vec_free(ifaces);
 #endif
@@ -3743,7 +3856,8 @@ vl_api_sw_interface_vhost_user_dump_t_handler (
 static void send_sw_if_l2tpv3_tunnel_details (vpe_api_main_t * am,
                                        unix_shared_memory_queue_t *q,
                                        l2t_session_t *s,
-                                       l2t_main_t * lm)
+                                       l2t_main_t * lm,
+                                       u32 context)
 {
     vl_api_sw_if_l2tpv3_tunnel_details_t * mp;
     u8 * if_name = NULL;
@@ -3768,6 +3882,7 @@ static void send_sw_if_l2tpv3_tunnel_details (vpe_api_main_t * am,
     clib_memcpy(mp->client_address, &s->client_address, sizeof(s->client_address));
     clib_memcpy(mp->our_address, &s->our_address, sizeof(s->our_address));
     mp->l2_sublayer_present = s->l2_sublayer_present;
+    mp->context = context;
 
     vl_msg_api_send_shmem (q, (u8 *)&mp);
 }
@@ -3865,7 +3980,7 @@ vl_api_sw_if_l2tpv3_tunnel_dump_t_handler (
 
     pool_foreach (session, lm->sessions, 
     ({
-        send_sw_if_l2tpv3_tunnel_details (am, q, session, lm);
+        send_sw_if_l2tpv3_tunnel_details (am, q, session, lm, mp->context);
     }));
 }
 
@@ -3951,7 +4066,8 @@ static void vl_api_l2_fib_table_entry_t_handler (
 static void send_l2fib_table_entry (vpe_api_main_t * am,
                                     unix_shared_memory_queue_t *q,
                                     l2fib_entry_key_t * l2fe_key,
-                                    l2fib_entry_result_t * l2fe_res)
+                                    l2fib_entry_result_t * l2fe_res,
+                                    u32 context)
 {
     vl_api_l2_fib_table_entry_t * mp;
 
@@ -3966,6 +4082,7 @@ static void send_l2fib_table_entry (vpe_api_main_t * am,
     mp->static_mac = l2fe_res->fields.static_mac;
     mp->filter_mac = l2fe_res->fields.filter;
     mp->bvi_mac = l2fe_res->fields.bvi;
+    mp->context = context;
 
     vl_msg_api_send_shmem (q, (u8 *)&mp);
 }
@@ -4001,7 +4118,7 @@ vl_api_l2_fib_table_dump_t_handler (vl_api_l2_fib_table_dump_t *mp)
 
     vec_foreach_index (ni, l2fe_key) {
         send_l2fib_table_entry (am, q, vec_elt_at_index(l2fe_key, ni),
-                                vec_elt_at_index(l2fe_res, ni));
+                                vec_elt_at_index(l2fe_res, ni), mp->context);
     }
     vec_free(l2fe_key);
     vec_free(l2fe_res);
@@ -4187,13 +4304,25 @@ static void vl_api_vxlan_add_del_tunnel_t_handler
     }
     encap_fib_index = p[0];
 
+    /* Check src & dst are different */
+    if ((a->is_ip6 && memcmp(mp->src_address, mp->dst_address, 16) == 0) ||
+       (!a->is_ip6 && memcmp(mp->src_address, mp->dst_address, 4) == 0)) {
+        rv = VNET_API_ERROR_SAME_SRC_DST;
+        goto out;
+    }
     memset (a, 0, sizeof (*a));
 
     a->is_add = mp->is_add;
+    a->is_ip6 = mp->is_ipv6;
 
     /* ip addresses sent in network byte order */
-    a->src.as_u32 = mp->src_address;
-    a->dst.as_u32 = mp->dst_address;
+    if (a->is_ip6) {
+        memcpy(&(a->src.ip6), mp->src_address, 16);
+        memcpy(&(a->dst.ip6), mp->dst_address, 16);
+    } else {
+        memcpy(&(a->src.ip4), mp->src_address, 4);
+        memcpy(&(a->dst.ip4), mp->dst_address, 4);
+    }
 
     a->encap_fib_index = encap_fib_index;
     a->decap_next_index = ntohl(mp->decap_next_index);
@@ -4211,17 +4340,26 @@ static void send_vxlan_tunnel_details
 (vxlan_tunnel_t * t, unix_shared_memory_queue_t * q)
 {
     vl_api_vxlan_tunnel_details_t * rmp;
-    ip4_main_t * im = &ip4_main;
+    ip4_main_t * im4 = &ip4_main;
+    ip6_main_t * im6 = &ip6_main;
+    u8 is_ipv6 = !(t->flags & VXLAN_TUNNEL_IS_IPV4);
 
     rmp = vl_msg_api_alloc (sizeof (*rmp));
     memset (rmp, 0, sizeof (*rmp));
     rmp->_vl_msg_id = ntohs(VL_API_VXLAN_TUNNEL_DETAILS);
-    rmp->src_address = t->src.data_u32;
-    rmp->dst_address = t->dst.data_u32;
-    rmp->encap_vrf_id = htonl(im->fibs[t->encap_fib_index].table_id);
+    if (is_ipv6) {
+        memcpy(rmp->src_address, &(t->src.ip6), 16);
+        memcpy(rmp->dst_address, &(t->dst.ip6), 16);
+        rmp->encap_vrf_id = htonl(im6->fibs[t->encap_fib_index].table_id);
+    } else {
+        memcpy(rmp->src_address, &(t->src.ip4), 4);
+        memcpy(rmp->dst_address, &(t->dst.ip4), 4);
+        rmp->encap_vrf_id = htonl(im4->fibs[t->encap_fib_index].table_id);
+    }
     rmp->vni = htonl(t->vni);
     rmp->decap_next_index = htonl(t->decap_next_index);
     rmp->sw_if_index = htonl(t->sw_if_index);
+    rmp->is_ipv6 = is_ipv6;
 
     vl_msg_api_send_shmem (q, (u8 *)&rmp);
 }
@@ -4256,6 +4394,95 @@ static void vl_api_vxlan_tunnel_dump_t_handler
     }
 }
 
+static void vl_api_gre_add_del_tunnel_t_handler
+(vl_api_gre_add_del_tunnel_t * mp)
+{
+    vl_api_gre_add_del_tunnel_reply_t * rmp;
+    int rv = 0;
+    vnet_gre_add_del_tunnel_args_t _a, *a = &_a;
+    u32 outer_table_id;
+    uword * p;
+    ip4_main_t * im = &ip4_main;
+    u32 sw_if_index = ~0;
+
+    p = hash_get (im->fib_index_by_table_id, ntohl(mp->outer_table_id));
+    if (! p) {
+        rv = VNET_API_ERROR_NO_SUCH_FIB;
+        goto out;
+    }
+    outer_table_id = p[0];
+
+    /* Check src & dst are different */
+    if (memcmp(&mp->src_address, &mp->dst_address, 4) == 0) {
+        rv = VNET_API_ERROR_SAME_SRC_DST;
+        goto out;
+    }
+
+    memset (a, 0, sizeof (*a));
+
+    a->is_add = mp->is_add;
+
+    /* ip addresses sent in network byte order */
+    a->src.as_u32 = mp->src_address;
+    a->dst.as_u32 = mp->dst_address;
+
+    a->outer_table_id = outer_table_id;
+    rv = vnet_gre_add_del_tunnel (a, &sw_if_index);
+
+out:
+    REPLY_MACRO2(VL_API_GRE_ADD_DEL_TUNNEL_REPLY,
+    ({
+        rmp->sw_if_index = ntohl (sw_if_index);
+    }));
+}
+
+static void send_gre_tunnel_details
+(gre_tunnel_t * t, unix_shared_memory_queue_t * q)
+{
+    vl_api_gre_tunnel_details_t * rmp;
+    ip4_main_t * im = &ip4_main;
+
+    rmp = vl_msg_api_alloc (sizeof (*rmp));
+    memset (rmp, 0, sizeof (*rmp));
+    rmp->_vl_msg_id = ntohs(VL_API_GRE_TUNNEL_DETAILS);
+    rmp->src_address = t->tunnel_src.data_u32;
+    rmp->dst_address = t->tunnel_dst.data_u32;
+    rmp->outer_table_id = htonl(im->fibs[t->outer_fib_index].table_id);
+    rmp->sw_if_index = htonl(t->sw_if_index);
+
+    vl_msg_api_send_shmem (q, (u8 *)&rmp);
+}
+
+static void vl_api_gre_tunnel_dump_t_handler
+(vl_api_gre_tunnel_dump_t * mp)
+{
+    unix_shared_memory_queue_t * q;
+    gre_main_t * gm = &gre_main;
+    gre_tunnel_t * t;
+    u32 sw_if_index;
+
+    q = vl_api_client_index_to_input_queue (mp->client_index);
+    if (q == 0) {
+        return;
+    }
+
+    sw_if_index = ntohl(mp->sw_if_index);
+
+    if (~0 == sw_if_index) {
+        pool_foreach (t, gm->tunnels,
+        ({
+            send_gre_tunnel_details(t, q);
+        }));
+    } else {
+        if ((sw_if_index >= vec_len(gm->tunnel_index_by_sw_if_index)) ||
+                (~0 == gm->tunnel_index_by_sw_if_index[sw_if_index])) {
+            return;
+        }
+        t = &gm->tunnels[gm->tunnel_index_by_sw_if_index[sw_if_index]];
+        send_gre_tunnel_details(t, q);
+    }
+}
+
 static void 
 vl_api_l2_patch_add_del_t_handler (vl_api_l2_patch_add_del_t *mp)
 {
@@ -4465,7 +4692,7 @@ vl_api_lisp_gpe_add_del_tunnel_t_handler
     a->ver_res = mp->ver_res;
     a->res = mp->res;
     a->next_protocol = mp->next_protocol;
-    a->iid = clib_net_to_host_u32 (mp->iid);
+    a->vni = clib_net_to_host_u32 (mp->iid);
 
     rv = vnet_lisp_gpe_add_del_tunnel (a, &sw_if_index);
     
@@ -4553,7 +4780,7 @@ vl_api_lisp_add_del_local_eid_t_handler(
 
     prefp = &gid_address_ippref(&eid);
     ip_eid = &ip_prefix_addr(prefp);
-    gid_address_type (&eid) = IP_PREFIX;
+    gid_address_type (&eid) = GID_ADDR_IP_PREFIX;
 
     if (mp->is_ipv6) {
         clib_memcpy(&ip_addr_v6(ip_eid), mp->ip_address,
@@ -4580,7 +4807,7 @@ vl_api_lisp_add_del_local_eid_t_handler(
     a->locator_set_index = locator_set_index;
     a->local = 1;
 
-    rv = vnet_lisp_add_del_mapping(a, &map_index);
+    rv = vnet_lisp_add_del_local_mapping(a, &map_index);
 
 out:
     vec_free(name);
@@ -4683,6 +4910,20 @@ vl_api_lisp_add_del_map_resolver_t_handler(
     REPLY_MACRO(VL_API_LISP_ADD_DEL_MAP_RESOLVER_REPLY);
 }
 
+static void
+vl_api_lisp_gpe_enable_disable_t_handler(
+    vl_api_lisp_gpe_enable_disable_t *mp)
+{
+    vl_api_lisp_gpe_enable_disable_reply_t *rmp;
+    int rv = 0;
+    vnet_lisp_gpe_enable_disable_args_t _a, * a = &_a;
+
+    a->is_en = mp->is_en;
+    vnet_lisp_gpe_enable_disable (a);
+
+    REPLY_MACRO(VL_API_LISP_GPE_ENABLE_DISABLE_REPLY);
+}
+
 static void
 vl_api_lisp_gpe_add_del_iface_t_handler(
     vl_api_lisp_gpe_add_del_iface_t *mp)
@@ -4692,6 +4933,8 @@ vl_api_lisp_gpe_add_del_iface_t_handler(
     vnet_lisp_gpe_add_del_iface_args_t _a, * a = &_a;
 
     a->is_add = mp->is_add;
+    a->table_id = mp->table_id;
+    a->vni = mp->vni;
     vnet_lisp_gpe_add_del_iface (a, 0);
 
     REPLY_MACRO(VL_API_LISP_GPE_ADD_DEL_IFACE_REPLY);
@@ -4756,7 +4999,7 @@ send_lisp_local_eid_table_details (mapping_t *mapit,
     gid = &mapit->eid;
     type = gid_address_type(gid);
 
-    if (type != IP_PREFIX) {
+    if (type != GID_ADDR_IP_PREFIX) {
         return;
     }
 
@@ -4814,7 +5057,6 @@ send_lisp_gpe_tunnel_details (lisp_gpe_tunnel_t *tunnel,
 {
     vl_api_lisp_gpe_tunnel_details_t *rmp;
     lisp_gpe_main_t * lgm = &lisp_gpe_main;
-    ip4_address_t *ip4 = NULL;
 
     rmp = vl_msg_api_alloc (sizeof (*rmp));
     memset (rmp, 0, sizeof (*rmp));
@@ -4822,12 +5064,9 @@ send_lisp_gpe_tunnel_details (lisp_gpe_tunnel_t *tunnel,
 
     rmp->tunnels = tunnel - lgm->tunnels;
 
-    /*list_gpe_tunnel now support only IPv4*/
-    rmp->is_ipv6 = 0;
-    ip4 = &tunnel->src;
-    clib_memcpy(rmp->source_ip, ip4, sizeof(*ip4));
-    ip4 = &tunnel->dst;
-    clib_memcpy(rmp->destination_ip, ip4, sizeof(*ip4));
+    rmp->is_ipv6 = ip_addr_version(&tunnel->src) == IP6 ? 1 : 0;
+    ip_address_copy_addr(rmp->source_ip, &tunnel->src);
+    ip_address_copy_addr(rmp->destination_ip, &tunnel->dst);
 
     rmp->encap_fib_id = htonl(tunnel->encap_fib_index);
     rmp->decap_fib_id = htonl(tunnel->decap_fib_index);
@@ -4837,7 +5076,7 @@ send_lisp_gpe_tunnel_details (lisp_gpe_tunnel_t *tunnel,
     rmp->flags = tunnel->flags;
     rmp->ver_res = tunnel->ver_res;
     rmp->res = tunnel->res;
-    rmp->iid = htonl(tunnel->iid);
+    rmp->iid = htonl(tunnel->vni);
 
     vl_msg_api_send_shmem (q, (u8 *)&rmp);
 }
@@ -5380,6 +5619,7 @@ vl_api_map_domain_dump_t_handler
     rmp->ip6_src_len = d->ip6_src_len;
     rmp->mtu = htons(d->mtu);
     rmp->is_translation = (d->flags & MAP_DOMAIN_TRANSLATION);
+    rmp->context = mp->context;
 
     vl_msg_api_send_shmem (q, (u8 *)&rmp);
   }));
@@ -5420,6 +5660,7 @@ vl_api_map_rule_dump_t_handler
     rmp->_vl_msg_id = ntohs(VL_API_MAP_RULE_DETAILS);
     rmp->psid = htons(i);
     clib_memcpy(rmp->ip6_dst, &dst, sizeof(rmp->ip6_dst));
+    rmp->context = mp->context;
     vl_msg_api_send_shmem(q, (u8 *)&rmp);
   }
 }
@@ -5691,6 +5932,19 @@ vpe_api_hookup (vlib_main_t *vm)
                              vl_api_sr_tunnel_add_del_t_print,
                              256, 1);
 
+
+    /* 
+     * Manually register the sr policy add del msg, so we trace
+     * enough bytes to capture a typical tunnel name list
+     */
+    vl_msg_api_set_handlers (VL_API_SR_POLICY_ADD_DEL, 
+                             "sr_policy_add_del",
+                             vl_api_sr_policy_add_del_t_handler,
+                             vl_noop_handler,
+                             vl_api_sr_policy_add_del_t_endian,
+                             vl_api_sr_policy_add_del_t_print,
+                             256, 1);
+
     /* 
      * Trace space for 8 MPLS encap labels, classifier mask+match
      */