Add Vxlan-Gpe over IPv6
[vpp.git] / vpp / api / api.c
index 724bcf9..8b801e5 100644 (file)
 #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>
+#include <vnet/vxlan-gpe/vxlan_gpe.h>
 #include <vnet/lisp-gpe/lisp_gpe.h>
 #include <vnet/lisp-cp/control.h>
 #include <vnet/map/map.h>
 #include <vnet/cop/cop.h>
 #include <vnet/ip/ip6_hop_by_hop.h>
+#include <vnet/devices/af_packet/af_packet.h>
+#include <vnet/policer/policer.h>
+#include <vnet/devices/netmap/netmap.h>
 
 #undef BIHASH_TYPE
 #undef __included_bihash_template_h__
@@ -287,11 +289,9 @@ _(IP_ADDRESS_DUMP, ip_address_dump)                                     \
 _(IP_DUMP, ip_dump)                                                     \
 _(SW_INTERFACE_VHOST_USER_DETAILS, sw_interface_vhost_user_details)    \
 _(SHOW_VERSION, show_version)                                          \
-_(NSH_GRE_ADD_DEL_TUNNEL, nsh_gre_add_del_tunnel)                      \
 _(L2_FIB_TABLE_DUMP, l2_fib_table_dump)                                        \
 _(L2_FIB_TABLE_ENTRY, l2_fib_table_entry)                               \
-_(NSH_VXLAN_GPE_ADD_DEL_TUNNEL, nsh_vxlan_gpe_add_del_tunnel)           \
-_(LISP_GPE_ADD_DEL_TUNNEL, lisp_gpe_add_del_tunnel)                    \
+_(VXLAN_GPE_ADD_DEL_TUNNEL, vxlan_gpe_add_del_tunnel)                  \
 _(INTERFACE_NAME_RENUMBER, interface_name_renumber)                    \
 _(WANT_IP4_ARP_EVENTS, want_ip4_arp_events)                             \
 _(INPUT_ACL_SET_INTERFACE, input_acl_set_interface)                     \
@@ -326,12 +326,23 @@ _(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_ENABLE_DISABLE, lisp_enable_disable)                             \
 _(LISP_GPE_ADD_DEL_IFACE, lisp_gpe_add_del_iface)                       \
+_(LISP_ADD_DEL_REMOTE_MAPPING, lisp_add_del_remote_mapping)             \
+_(LISP_PITR_SET_LOCATOR_SET, lisp_pitr_set_locator_set)                 \
 _(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)                       \
-_(SR_MULTICAST_MAP_ADD_DEL, sr_multicast_map_add_del)
+_(LISP_ENABLE_DISABLE_STATUS_DUMP,                                      \
+  lisp_enable_disable_status_dump)                                      \
+_(SR_MULTICAST_MAP_ADD_DEL, sr_multicast_map_add_del)                   \
+_(AF_PACKET_CREATE, af_packet_create)                                   \
+_(AF_PACKET_DELETE, af_packet_delete)                                   \
+_(POLICER_ADD_DEL, policer_add_del)                                     \
+_(POLICER_DUMP, policer_dump)                                           \
+_(NETMAP_CREATE, netmap_create)                                         \
+_(NETMAP_DELETE, netmap_delete)
 
 #define QUOTE_(x) #x
 #define QUOTE(x) QUOTE_(x)
@@ -3449,7 +3460,7 @@ static void vl_api_sr_policy_add_del_t_handler
        goto out;
       }      
 
-    if (!(mp->tunnel_names))
+    if (!(mp->tunnel_names[0]))
       {
         rv = VNET_API_ERROR_NO_SUCH_NODE2;
        goto out;
@@ -3929,6 +3940,9 @@ vl_api_ip_address_dump_t_handler (vl_api_ip_address_dump_t *mp)
     ip_lookup_main_t * lm4 = &im4->lookup_main;
     ip_interface_address_t * ia = 0;
     u32 sw_if_index = ~0;
+    int rv __attribute__ ((unused)) = 0;
+
+    VALIDATE_SW_IF_INDEX(mp);
 
     sw_if_index = ntohl(mp->sw_if_index);
 
@@ -3954,6 +3968,7 @@ vl_api_ip_address_dump_t_handler (vl_api_ip_address_dump_t *mp)
             send_ip_address_details(am, q, (u8*)r4, prefix_length, 0, mp->context);
         }));
     }
+    BAD_SW_IF_INDEX_LABEL;
 }
 
 static void send_ip_details (vpe_api_main_t * am,
@@ -4519,19 +4534,18 @@ vl_api_l2_patch_add_del_t_handler (vl_api_l2_patch_add_del_t *mp)
 }
 
 static void
-vl_api_nsh_gre_add_del_tunnel_t_handler 
-(vl_api_nsh_gre_add_del_tunnel_t * mp)
+vl_api_vxlan_gpe_add_del_tunnel_t_handler 
+(vl_api_vxlan_gpe_add_del_tunnel_t * mp)
 {
-    vl_api_nsh_gre_add_del_tunnel_reply_t * rmp;
+    vl_api_vxlan_gpe_add_del_tunnel_reply_t * rmp;
     int rv = 0;
-    vnet_nsh_gre_add_del_tunnel_args_t _a, *a = &_a;
+    vnet_vxlan_gpe_add_del_tunnel_args_t _a, *a = &_a;
     u32 encap_fib_index, decap_fib_index;
-    u32 decap_next_index;
+    u8 protocol;
     uword * p;
     ip4_main_t * im = &ip4_main;
-    u32 * tlvs = 0;
     u32 sw_if_index = ~0;
-    int i;
+
 
     p = hash_get (im->fib_index_by_table_id, ntohl(mp->encap_vrf_id));
     if (! p) {
@@ -4540,10 +4554,10 @@ vl_api_nsh_gre_add_del_tunnel_t_handler
     }
     encap_fib_index = p[0];
 
-    decap_next_index = ntohl(mp->decap_next_index);
+    protocol = ntohl(mp->protocol);
 
     /* Interpret decap_vrf_id as an opaque if sending to other-than-ip4-input */
-    if (decap_next_index == NSH_INPUT_NEXT_IP4_INPUT) {
+    if (protocol == VXLAN_GPE_INPUT_NEXT_IP4_INPUT) {
         p = hash_get (im->fib_index_by_table_id, ntohl(mp->decap_vrf_id));
         if (! p) {
             rv = VNET_API_ERROR_NO_SUCH_INNER_FIB;
@@ -4554,162 +4568,32 @@ vl_api_nsh_gre_add_del_tunnel_t_handler
         decap_fib_index = ntohl(mp->decap_vrf_id);
     }
 
-    memset (a, 0, sizeof (*a));
-
-    a->is_add = mp->is_add;
-    /* ip addresses sent in network byte order */
-    a->src.as_u32 = ntohl(mp->src);
-    a->dst.as_u32 = ntohl(mp->dst);
-    a->encap_fib_index = encap_fib_index;
-    a->decap_fib_index = decap_fib_index;
-    a->decap_next_index = decap_next_index;
-    a->ver_o_c = mp->ver_o_c;
-    a->length = mp->length;
-    a->md_type = mp->md_type;
-    a->next_protocol = mp->next_protocol;
-    a->spi_si = ntohl(mp->spi_si);
-    a->c1 = ntohl(mp->c1);
-    a->c2 = ntohl(mp->c2);
-    a->c3 = ntohl(mp->c3);
-    a->c4 = ntohl(mp->c4);
-
-    for (i = 0; i < mp->tlv_len_in_words; i++)
-        vec_add1 (tlvs, ntohl(mp->tlvs[i]));
-
-    a->tlvs = tlvs;
-
-    rv = vnet_nsh_gre_add_del_tunnel (a, &sw_if_index);
-    
-out:
-    REPLY_MACRO2(VL_API_NSH_GRE_ADD_DEL_TUNNEL_REPLY,
-    ({
-        rmp->sw_if_index = ntohl (sw_if_index);
-    }));
-}
-
-static void
-vl_api_nsh_vxlan_gpe_add_del_tunnel_t_handler 
-(vl_api_nsh_vxlan_gpe_add_del_tunnel_t * mp)
-{
-    vl_api_nsh_vxlan_gpe_add_del_tunnel_reply_t * rmp;
-    int rv = 0;
-    vnet_nsh_vxlan_gpe_add_del_tunnel_args_t _a, *a = &_a;
-    u32 encap_fib_index, decap_fib_index;
-    u32 decap_next_index;
-    uword * p;
-    ip4_main_t * im = &ip4_main;
-    u32 * tlvs = 0;
-    u32 sw_if_index = ~0;
-    int i;
-
-    p = hash_get (im->fib_index_by_table_id, ntohl(mp->encap_vrf_id));
-    if (! p) {
-        rv = VNET_API_ERROR_NO_SUCH_FIB;
+    /* Check src & dst are different */
+    if ((a->is_ip6 && memcmp(mp->local, mp->remote, 16) == 0) ||
+       (!a->is_ip6 && memcmp(mp->local, mp->remote, 4) == 0)) {
+        rv = VNET_API_ERROR_SAME_SRC_DST;
         goto out;
     }
-    encap_fib_index = p[0];
-
-    decap_next_index = ntohl(mp->decap_next_index);
-
-    /* Interpret decap_vrf_id as an opaque if sending to other-than-ip4-input */
-    if (decap_next_index == NSH_INPUT_NEXT_IP4_INPUT) {
-        p = hash_get (im->fib_index_by_table_id, ntohl(mp->decap_vrf_id));
-        if (! p) {
-            rv = VNET_API_ERROR_NO_SUCH_INNER_FIB;
-            goto out;
-        }
-        decap_fib_index = p[0];
-    } else {
-        decap_fib_index = ntohl(mp->decap_vrf_id);
-    }
-
     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 = ntohl(mp->src);
-    a->dst.as_u32 = ntohl(mp->dst);
-    a->encap_fib_index = encap_fib_index;
-    a->decap_fib_index = decap_fib_index;
-    a->decap_next_index = decap_next_index;
-    a->vni = ntohl(mp->vni);
-    a->ver_o_c = mp->ver_o_c;
-    a->length = mp->length;
-    a->md_type = mp->md_type;
-    a->next_protocol = mp->next_protocol;
-    a->spi_si = ntohl(mp->spi_si);
-    a->c1 = ntohl(mp->c1);
-    a->c2 = ntohl(mp->c2);
-    a->c3 = ntohl(mp->c3);
-    a->c4 = ntohl(mp->c4);
-
-    for (i = 0; i < mp->tlv_len_in_words; i++)
-        vec_add1 (tlvs, ntohl(mp->tlvs[i]));
-
-    a->tlvs = tlvs;
-
-    rv = vnet_nsh_vxlan_gpe_add_del_tunnel (a, &sw_if_index);
-    
-out:
-    REPLY_MACRO2(VL_API_NSH_VXLAN_GPE_ADD_DEL_TUNNEL_REPLY,
-    ({
-        rmp->sw_if_index = ntohl (sw_if_index);
-    }));
-}
-
-static void
-vl_api_lisp_gpe_add_del_tunnel_t_handler 
-(vl_api_lisp_gpe_add_del_tunnel_t * mp)
-{
-    vl_api_lisp_gpe_add_del_tunnel_reply_t * rmp;
-    int rv = 0;
-    vnet_lisp_gpe_add_del_tunnel_args_t _a, *a = &_a;
-    u32 encap_fib_index, decap_fib_index;
-    u32 decap_next_index;
-    uword * p;
-    ip4_main_t * im = &ip4_main;
-    u32 sw_if_index = ~0;
-
-    p = hash_get (im->fib_index_by_table_id, ntohl(mp->encap_vrf_id));
-    if (! p) {
-        rv = VNET_API_ERROR_NO_SUCH_FIB;
-        goto out;
-    }
-    encap_fib_index = p[0];
-
-    decap_next_index = ntohl(mp->decap_next_index);
-
-    /* Interpret decap_vrf_id as an opaque if sending to other-than-ip4-input */
-    if (decap_next_index == NSH_INPUT_NEXT_IP4_INPUT) {
-        p = hash_get (im->fib_index_by_table_id, ntohl(mp->decap_vrf_id));
-        if (! p) {
-            rv = VNET_API_ERROR_NO_SUCH_INNER_FIB;
-            goto out;
-        }
-        decap_fib_index = p[0];
+    if (a->is_ip6) {
+      clib_memcpy(&(a->local.ip6), mp->local, 16);
+      clib_memcpy(&(a->remote.ip6), mp->remote, 16);
     } else {
-        decap_fib_index = ntohl(mp->decap_vrf_id);
+      clib_memcpy(&(a->local.ip4), mp->local, 4);
+      clib_memcpy(&(a->remote.ip4), mp->remote, 4);
     }
-
-    memset (a, 0, sizeof (*a));
-
-    a->is_add = mp->is_add;
-    /* ip addresses sent in network byte order */
-    a->src.as_u32 = mp->src;
-    a->dst.as_u32 = mp->dst;
     a->encap_fib_index = encap_fib_index;
     a->decap_fib_index = decap_fib_index;
-    a->decap_next_index = decap_next_index;
-    a->flags = mp->flags;
-    a->ver_res = mp->ver_res;
-    a->res = mp->res;
-    a->next_protocol = mp->next_protocol;
-    a->vni = clib_net_to_host_u32 (mp->iid);
-
-    rv = vnet_lisp_gpe_add_del_tunnel (a, &sw_if_index);
+    a->protocol = protocol;
+    a->vni = ntohl(mp->vni);
+    rv = vnet_vxlan_gpe_add_del_tunnel (a, &sw_if_index);
     
 out:
-    REPLY_MACRO2(VL_API_LISP_GPE_ADD_DEL_TUNNEL_REPLY,
+    REPLY_MACRO2(VL_API_VXLAN_GPE_ADD_DEL_TUNNEL_REPLY,
     ({
         rmp->sw_if_index = ntohl (sw_if_index);
     }));
@@ -4875,7 +4759,6 @@ vl_api_lisp_gpe_add_del_fwd_entry_t_handler(
     vl_api_lisp_gpe_add_del_fwd_entry_reply_t *rmp;
     int rv = 0;
     ip_address_t slocator, dlocator;
-    ip_prefix_t * prefp = NULL;
     gid_address_t eid;
     vnet_lisp_gpe_add_del_fwd_entry_args_t a;
 
@@ -4887,9 +4770,6 @@ vl_api_lisp_gpe_add_del_fwd_entry_t_handler(
     a.deid = eid;
     a.slocator = slocator;
     a.dlocator = dlocator;
-    prefp = &gid_address_ippref(&a.deid);
-    a.decap_next_index = (ip_prefix_version(prefp) == IP4) ?
-    LISP_GPE_INPUT_NEXT_IP4_INPUT : LISP_GPE_INPUT_NEXT_IP6_INPUT;
     rv = vnet_lisp_gpe_add_del_fwd_entry (&a, 0);
 
     REPLY_MACRO(VL_API_LISP_GPE_ADD_DEL_FWD_ENTRY_REPLY);
@@ -4936,6 +4816,17 @@ vl_api_lisp_gpe_enable_disable_t_handler(
     REPLY_MACRO(VL_API_LISP_GPE_ENABLE_DISABLE_REPLY);
 }
 
+static void
+vl_api_lisp_enable_disable_t_handler(
+    vl_api_lisp_enable_disable_t *mp)
+{
+    vl_api_lisp_enable_disable_reply_t *rmp;
+    int rv = 0;
+
+    vnet_lisp_enable_disable (mp->is_en);
+    REPLY_MACRO(VL_API_LISP_ENABLE_DISABLE_REPLY);
+}
+
 static void
 vl_api_lisp_gpe_add_del_iface_t_handler(
     vl_api_lisp_gpe_add_del_iface_t *mp)
@@ -4952,24 +4843,132 @@ vl_api_lisp_gpe_add_del_iface_t_handler(
     REPLY_MACRO(VL_API_LISP_GPE_ADD_DEL_IFACE_REPLY);
 }
 
+static void
+vl_api_lisp_pitr_set_locator_set_t_handler(
+  vl_api_lisp_pitr_set_locator_set_t *mp)
+{
+    vl_api_lisp_pitr_set_locator_set_reply_t *rmp;
+    int rv = 0;
+    u8 * ls_name = 0;
+
+    ls_name = format (0, "%s", mp->ls_name);
+    rv = vnet_lisp_pitr_set_locator_set (ls_name, mp->is_add);
+    vec_free (ls_name);
+
+    REPLY_MACRO(VL_API_LISP_PITR_SET_LOCATOR_SET_REPLY);
+}
+
+/** Used for transferring locators via VPP API */
+typedef CLIB_PACKED(struct
+{
+  u8 is_ip4; /**< is locator an IPv4 address */
+  u8 addr[16]; /**< IPv4/IPv6 address */
+}) rloc_t;
+
+static void
+send_lisp_locator_set_details_set_address
+(vl_api_lisp_locator_set_details_t *rmp,
+ gid_address_t *gid_address)
+{
+    ip_prefix_t *ip_addr;
+
+    if (gid_address_type(gid_address) != GID_ADDR_IP_PREFIX) {
+        return;
+    }
+
+    ip_addr = &gid_address_ippref(gid_address);
+    rmp->prefix_len = ip_prefix_len(ip_addr);
+    rmp->is_ipv6 = ip_prefix_version(ip_addr);
+    ip_address_copy_addr(rmp->ip_address, &ip_prefix_addr(ip_addr));
+}
+
+static void
+vl_api_lisp_add_del_remote_mapping_t_handler (
+    vl_api_lisp_add_del_remote_mapping_t *mp)
+{
+    u32 i;
+    ip_address_t rloc, * rlocs = 0;
+    vl_api_lisp_add_del_remote_mapping_reply_t * rmp;
+    int rv = 0;
+    gid_address_t _seid, * seid = &_seid;
+    gid_address_t _deid, * deid = &_deid;
+    ip_prefix_t * seid_pref = &gid_address_ippref(seid);
+    ip_prefix_t * deid_pref = &gid_address_ippref(deid);
+
+    gid_address_type(seid) = GID_ADDR_IP_PREFIX;
+    gid_address_type(deid) = GID_ADDR_IP_PREFIX;
+    ip_address_t * seid_addr = &ip_prefix_addr(seid_pref);
+    ip_address_t * deid_addr = &ip_prefix_addr(deid_pref);
+    ip_prefix_len(seid_pref) = mp->seid_len;
+    ip_prefix_len(deid_pref) = mp->deid_len;
+    gid_address_set_vni (seid, ntohl (mp->vni));
+    gid_address_set_vni (deid, ntohl (mp->vni));
+
+    if (mp->eid_is_ip4) {
+        ip_prefix_version(seid_pref) = IP4;
+        ip_prefix_version(deid_pref) = IP4;
+        clib_memcpy (&ip_addr_v4(seid_addr),
+                     mp->seid, sizeof (ip_addr_v4(seid_addr)));
+        clib_memcpy (&ip_addr_v4(deid_addr),
+                     mp->deid, sizeof (ip_addr_v4(deid_addr)));
+    } else {
+        ip_prefix_version(seid_pref) = IP6;
+        ip_prefix_version(deid_pref) = IP6;
+        clib_memcpy (&ip_addr_v6(seid_addr),
+                     mp->seid, sizeof (ip_addr_v6(seid_addr)));
+        clib_memcpy (&ip_addr_v6(deid_addr),
+                     mp->deid, sizeof (ip_addr_v6(deid_addr)));
+    }
+
+    for (i = 0; i < mp->rloc_num; i++) {
+        rloc_t * r = &((rloc_t *) mp->rlocs)[i];
+        if (r->is_ip4) {
+            clib_memcpy (&ip_addr_v4(&rloc), &r->addr, sizeof (rloc_t));
+            ip_addr_version (&rloc) = IP4;
+        } else {
+            clib_memcpy (&ip_addr_v6(&rloc), &r->addr, sizeof (rloc_t));
+            ip_addr_version (&rloc) = IP6;
+        }
+        vec_add1 (rlocs, rloc);
+    }
+
+    rv = vnet_lisp_add_del_remote_mapping (deid, seid, rlocs,
+                                           mp->action, mp->is_add);
+    vec_free (rlocs);
+    REPLY_MACRO(VL_API_LISP_GPE_ADD_DEL_IFACE_REPLY);
+}
+
 static void
 send_lisp_locator_set_details (lisp_cp_main_t *lcm,
                                locator_set_t *lsit,
                                unix_shared_memory_queue_t *q,
-                               u32 context)
+                               u32 context,
+                               u32 index)
 {
     vl_api_lisp_locator_set_details_t *rmp;
     locator_t *loc = NULL;
     u32 * locit = NULL;
+    u8 * str = NULL;
 
     vec_foreach (locit, lsit->locator_indices) {
         loc = pool_elt_at_index (lcm->locator_pool, locit[0]);
         rmp = vl_msg_api_alloc (sizeof (*rmp));
         memset (rmp, 0, sizeof (*rmp));
         rmp->_vl_msg_id = ntohs(VL_API_LISP_LOCATOR_SET_DETAILS);
-        strncpy((char *) rmp->locator_set_name,
-                (char *) lsit->name, ARRAY_LEN(rmp->locator_set_name) - 1);
-        rmp->sw_if_index = htonl(loc->sw_if_index);
+        rmp->local = lsit->local;
+        if (lsit->local) {
+            ASSERT(lsit->name != NULL);
+            strncpy((char *) rmp->locator_set_name,
+                    (char *) lsit->name, ARRAY_LEN(rmp->locator_set_name) - 1);
+            rmp->sw_if_index = htonl(loc->sw_if_index);
+        } else {
+            str = format(0, "remote-%d", index);
+            strncpy((char *) rmp->locator_set_name, (char *) str,
+                    ARRAY_LEN(rmp->locator_set_name) - 1);
+            send_lisp_locator_set_details_set_address(rmp, &loc->address);
+
+            vec_free(str);
+        }
         rmp->priority = loc->priority;
         rmp->weight = loc->weight;
         rmp->context = context;
@@ -4984,15 +4983,17 @@ vl_api_lisp_locator_set_dump_t_handler (vl_api_lisp_locator_set_dump_t *mp)
     unix_shared_memory_queue_t * q = NULL;
     lisp_cp_main_t * lcm = vnet_lisp_cp_get_main();
     locator_set_t * lsit = NULL;
+    u32 index;
 
     q = vl_api_client_index_to_input_queue (mp->client_index);
     if (q == 0) {
         return;
     }
 
+    index = 0;
     pool_foreach (lsit, lcm->locator_set_pool,
         ({
-            send_lisp_locator_set_details(lcm, lsit, q, mp->context);
+            send_lisp_locator_set_details(lcm, lsit, q, mp->context, index++);
         }));
 }
 
@@ -5006,6 +5007,7 @@ send_lisp_local_eid_table_details (mapping_t *mapit,
     locator_set_t *ls = NULL;
     gid_address_t *gid = NULL;
     ip_prefix_t *ip_prefix = NULL;
+    u8 * str = NULL;
     u8 type = ~0;
 
     ls = pool_elt_at_index (lcm->locator_set_pool,
@@ -5023,8 +5025,16 @@ send_lisp_local_eid_table_details (mapping_t *mapit,
     rmp = vl_msg_api_alloc (sizeof (*rmp));
     memset (rmp, 0, sizeof (*rmp));
     rmp->_vl_msg_id = ntohs(VL_API_LISP_LOCAL_EID_TABLE_DETAILS);
-    strncpy((char *) rmp->locator_set_name,
-            (char *) ls->name, ARRAY_LEN(rmp->locator_set_name) - 1);
+    if (ls->local) {
+        ASSERT(ls->name != NULL);
+        strncpy((char *) rmp->locator_set_name,
+                (char *) ls->name, ARRAY_LEN(rmp->locator_set_name) - 1);
+    } else {
+            str = format(0, "remote-%d", mapit->locator_set_index);
+            strncpy((char *) rmp->locator_set_name, (char *) str,
+                    ARRAY_LEN(rmp->locator_set_name) - 1);
+            vec_free(str);
+    }
 
     switch (ip_prefix_version(ip_prefix)) {
         case IP4:
@@ -5171,6 +5181,37 @@ vl_api_lisp_map_resolver_dump_t_handler (
 
 }
 
+static void
+send_lisp_enable_disable_details (unix_shared_memory_queue_t *q,
+                                      u32 context)
+{
+    vl_api_lisp_enable_disable_status_details_t *rmp = NULL;
+
+    rmp = vl_msg_api_alloc (sizeof (*rmp));
+    memset (rmp, 0, sizeof (*rmp));
+    rmp->_vl_msg_id = ntohs(VL_API_LISP_ENABLE_DISABLE_STATUS_DETAILS);
+
+    rmp->gpe_status = vnet_lisp_gpe_enable_disable_status ();
+    rmp->feature_status = vnet_lisp_enable_disable_status ();
+    rmp->context = context;
+
+    vl_msg_api_send_shmem (q, (u8 *)&rmp);
+}
+
+static void
+vl_api_lisp_enable_disable_status_dump_t_handler
+(vl_api_lisp_enable_disable_status_dump_t *mp)
+{
+    unix_shared_memory_queue_t * q = NULL;
+
+    q = vl_api_client_index_to_input_queue (mp->client_index);
+    if (q == 0) {
+        return;
+    }
+
+    send_lisp_enable_disable_details(q, mp->context);
+}
+
 static void 
 vl_api_interface_name_renumber_t_handler (vl_api_interface_name_renumber_t *mp)
 {
@@ -5815,13 +5856,15 @@ static void vl_api_get_node_graph_t_handler
     
     /* 
      * Keep the number of memcpy ops to a minimum (e.g. 1).
-     * The current size of the serialized vector is
-     * slightly under 4K.
      */
-    vec_validate (vector, 4095);
+    vec_validate (vector, 16384);
     vec_reset_length (vector);
 
-    vector = vlib_node_serialize (&vm->node_main, vector);
+    /* $$$$ FIXME */
+    vector = vlib_node_serialize (&vm->node_main, vector, 
+                                  (u32)~0 /* all threads */,
+                                  1 /* include nexts */,
+                                  1 /* include stats */);
     
     svm_pop_heap (oldheap);
     pthread_mutex_unlock (&am->vlib_rp->mutex);
@@ -5886,6 +5929,191 @@ static void vl_api_trace_profile_del_t_handler
     REPLY_MACRO(VL_API_TRACE_PROFILE_DEL_REPLY);
 }
 
+static void
+vl_api_af_packet_create_t_handler
+(vl_api_af_packet_create_t *mp)
+{
+    vlib_main_t *vm = vlib_get_main();
+    vl_api_af_packet_create_reply_t *rmp;
+    int rv = 0;
+    u8 *host_if_name = NULL;
+
+    host_if_name = format(0, "%s", mp->host_if_name);
+    vec_add1 (host_if_name, 0);
+
+    rv = af_packet_create_if(vm, host_if_name,
+                             mp->use_random_hw_addr ? 0 : mp->hw_addr, 0);
+
+    vec_free(host_if_name);
+
+    REPLY_MACRO(VL_API_AF_PACKET_CREATE_REPLY);
+}
+
+static void
+vl_api_af_packet_delete_t_handler
+(vl_api_af_packet_delete_t *mp)
+{
+    vlib_main_t * vm = vlib_get_main();
+    vl_api_af_packet_delete_reply_t *rmp;
+    int rv = 0;
+    u8 *host_if_name = NULL;
+
+    host_if_name = format(0, "%s", mp->host_if_name);
+    vec_add1 (host_if_name, 0);
+
+    rv = af_packet_delete_if(vm, host_if_name);
+
+    vec_free(host_if_name);
+
+    REPLY_MACRO(VL_API_AF_PACKET_DELETE_REPLY);
+}
+
+static void
+vl_api_policer_add_del_t_handler
+(vl_api_policer_add_del_t *mp)
+{
+    vlib_main_t * vm = vlib_get_main();
+    vl_api_policer_add_del_reply_t *rmp;
+    int rv = 0;
+    u8 *name = NULL;
+    sse2_qos_pol_cfg_params_st cfg;
+    clib_error_t * error;
+
+    name = format(0, "%s", mp->name);
+
+    memset (&cfg, 0, sizeof (cfg));
+    cfg.rfc = mp->type;
+    cfg.rnd_type = mp->round_type;
+    cfg.rate_type = mp->rate_type;
+    cfg.rb.kbps.cir_kbps = mp->cir;
+    cfg.rb.kbps.eir_kbps = mp->eir;
+    cfg.rb.kbps.cb_bytes = mp->cb;
+    cfg.rb.kbps.eb_bytes = mp->eb;
+
+    error = policer_add_del(vm, name, &cfg, mp->is_add);
+
+    if (error)
+      rv = VNET_API_ERROR_UNSPECIFIED;
+
+    REPLY_MACRO(VL_API_POLICER_ADD_DEL_REPLY);
+}
+
+static void
+send_policer_details (u8 *name,
+                      sse2_qos_pol_cfg_params_st *config,
+                      policer_read_response_type_st *templ,
+                      unix_shared_memory_queue_t *q,
+                      u32 context)
+{
+    vl_api_policer_details_t * mp;
+
+    mp = vl_msg_api_alloc (sizeof (*mp));
+    memset (mp, 0, sizeof (*mp));
+    mp->_vl_msg_id = ntohs (VL_API_POLICER_DETAILS);
+    mp->context = context;
+    mp->cir = htonl(config->rb.kbps.cir_kbps);
+    mp->eir = htonl(config->rb.kbps.eir_kbps);
+    mp->cb = htonl(config->rb.kbps.cb_bytes);
+    mp->eb = htonl(config->rb.kbps.eb_bytes);
+    mp->rate_type = config->rate_type;
+    mp->round_type = config->rnd_type;
+    mp->type = config->rfc;
+    mp->single_rate = templ->single_rate ? 1 : 0;
+    mp->color_aware = templ->color_aware ? 1 : 0;
+    mp->scale = htonl(templ->scale);
+    mp->cir_tokens_per_period = htonl(templ->cir_tokens_per_period);
+    mp->pir_tokens_per_period = htonl(templ->pir_tokens_per_period);
+    mp->current_limit = htonl(templ->current_limit);
+    mp->current_bucket = htonl(templ->current_bucket);
+    mp->extended_limit = htonl(templ->extended_limit);
+    mp->extended_bucket = htonl(templ->extended_bucket);
+    mp->last_update_time = clib_host_to_net_u64(templ->last_update_time);
+
+    strncpy ((char *) mp->name, (char *) name, ARRAY_LEN(mp->name) - 1);
+
+    vl_msg_api_send_shmem (q, (u8 *)&mp);
+}
+
+static void
+vl_api_policer_dump_t_handler
+(vl_api_policer_dump_t *mp)
+{
+    unix_shared_memory_queue_t * q;
+    vnet_policer_main_t * pm = &vnet_policer_main;
+    hash_pair_t * hp;
+    uword * p;
+    u32 pool_index;
+    u8 * match_name = 0;
+    u8 * name;
+    sse2_qos_pol_cfg_params_st *config;
+    policer_read_response_type_st *templ;
+
+    q = vl_api_client_index_to_input_queue (mp->client_index);
+    if (q == 0)
+        return;
+
+    if (mp->match_name_valid) {
+        match_name = format(0, "%s%c", mp->match_name, 0);
+    }
+
+    if (mp->match_name_valid) {
+        p = hash_get_mem (pm->policer_config_by_name, match_name);
+        if (p) {
+            pool_index = p[0];
+            config = pool_elt_at_index (pm->configs, pool_index);
+            templ = pool_elt_at_index (pm->policer_templates, pool_index);
+            send_policer_details(match_name, config, templ, q, mp->context);
+        }
+    } else {
+        hash_foreach_pair (hp, pm->policer_config_by_name,
+        ({
+            name = (u8 *) hp->key;
+            pool_index = hp->value[0];
+            config = pool_elt_at_index (pm->configs, pool_index);
+            templ = pool_elt_at_index (pm->policer_templates, pool_index);
+            send_policer_details(name, config, templ, q, mp->context);
+        }));
+    }
+}
+
+static void
+vl_api_netmap_create_t_handler
+(vl_api_netmap_create_t *mp)
+{
+    vlib_main_t *vm = vlib_get_main();
+    vl_api_netmap_create_reply_t *rmp;
+    int rv = 0;
+    u8 *if_name = NULL;
+
+    if_name = format(0, "%s", mp->netmap_if_name);
+    vec_add1 (if_name, 0);
+
+    rv = netmap_create_if(vm, if_name, mp->use_random_hw_addr ? 0 : mp->hw_addr,
+                          mp->is_pipe, mp->is_master, 0);
+
+    vec_free(if_name);
+
+    REPLY_MACRO(VL_API_NETMAP_CREATE_REPLY);
+}
+
+static void
+vl_api_netmap_delete_t_handler
+(vl_api_netmap_delete_t *mp)
+{
+    vlib_main_t * vm = vlib_get_main();
+    vl_api_netmap_delete_reply_t *rmp;
+    int rv = 0;
+    u8 *if_name = NULL;
+
+    if_name = format(0, "%s", mp->netmap_if_name);
+    vec_add1 (if_name, 0);
+
+    rv = netmap_delete_if(vm, if_name);
+
+    vec_free(if_name);
+
+    REPLY_MACRO(VL_API_NETMAP_DELETE_REPLY);
+}
 
 #define BOUNCE_HANDLER(nn)                                              \
 static void vl_api_##nn##_t_handler (                                   \
@@ -5976,16 +6204,11 @@ vpe_api_hookup (vlib_main_t *vm)
     am->api_trace_cfg [VL_API_VXLAN_ADD_DEL_TUNNEL].size
         += 16 * sizeof (u32);
     
-    /*
-     * trace space for 4 nsh-gre variable TLV words
-     */
-    am->api_trace_cfg [VL_API_NSH_GRE_ADD_DEL_TUNNEL].size
-        += 4 * sizeof (u32);
-
     /* 
      * Thread-safe API messages
      */
     am->is_mp_safe [VL_API_IP_ADD_DEL_ROUTE] = 1;
+    am->is_mp_safe [VL_API_GET_NODE_GRAPH] = 1;
 
     return 0;
 }