aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/lisp-cp/one_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/lisp-cp/one_api.c')
-rw-r--r--src/vnet/lisp-cp/one_api.c82
1 files changed, 82 insertions, 0 deletions
diff --git a/src/vnet/lisp-cp/one_api.c b/src/vnet/lisp-cp/one_api.c
index 23549afa68b..724e58df839 100644
--- a/src/vnet/lisp-cp/one_api.c
+++ b/src/vnet/lisp-cp/one_api.c
@@ -42,6 +42,11 @@
#define vl_api_one_add_del_remote_mapping_t_endian vl_noop_handler
#define vl_api_one_add_del_remote_mapping_t_print vl_noop_handler
+#define vl_api_one_l2_arp_entry_t_endian vl_noop_handler
+#define vl_api_one_l2_arp_entry_t_print vl_noop_handler
+#define vl_api_one_add_del_l2_arp_entry vl_noop_handler
+#define vl_api_one_l2_arp_bd_get vl_noop_handler
+
#define vl_typedefs /* define message structures */
#include <vnet/vnet_all_api_h.h>
#undef vl_typedefs
@@ -109,6 +114,9 @@ _(SHOW_ONE_STATS_ENABLE_DISABLE, show_one_stats_enable_disable) \
_(ONE_STATS_ENABLE_DISABLE, one_stats_enable_disable) \
_(ONE_STATS_DUMP, one_stats_dump) \
_(ONE_STATS_FLUSH, one_stats_flush) \
+_(ONE_L2_ARP_BD_GET, one_l2_arp_bd_get) \
+_(ONE_L2_ARP_ENTRIES_GET, one_l2_arp_entries_get) \
+_(ONE_ADD_DEL_L2_ARP_ENTRY, one_add_del_l2_arp_entry) \
static locator_t *
@@ -1387,6 +1395,80 @@ vl_api_one_stats_dump_t_handler (vl_api_one_stats_dump_t * mp)
}
}
+static void
+ vl_api_one_add_del_l2_arp_entry_t_handler
+ (vl_api_one_add_del_l2_arp_entry_t * mp)
+{
+ vl_api_one_add_del_l2_arp_entry_reply_t *rmp;
+ int rv = 0;
+ gid_address_t _arp, *arp = &_arp;
+ memset (arp, 0, sizeof (*arp));
+
+ gid_address_type (arp) = GID_ADDR_ARP;
+ gid_address_arp_bd (arp) = clib_net_to_host_u32 (mp->bd);
+
+ /* vpp keeps ip4 addresses in network byte order */
+ clib_memcpy (&gid_address_arp_ip4 (arp), &mp->ip4, 4);
+
+ rv = vnet_lisp_add_del_l2_arp_entry (arp, mp->mac, mp->is_add);
+
+ REPLY_MACRO (VL_API_ONE_ADD_DEL_L2_ARP_ENTRY_REPLY);
+}
+
+static void
+vl_api_one_l2_arp_bd_get_t_handler (vl_api_one_l2_arp_bd_get_t * mp)
+{
+ vl_api_one_l2_arp_bd_get_reply_t *rmp;
+ int rv = 0;
+ u32 i = 0;
+ hash_pair_t *p;
+
+ u32 *bds = vnet_lisp_l2_arp_bds_get ();
+ u32 size = hash_elts (bds) * sizeof (u32);
+
+ /* *INDENT-OFF* */
+ REPLY_MACRO4 (VL_API_ONE_L2_ARP_BD_GET_REPLY, size,
+ {
+ rmp->count = clib_host_to_net_u32 (hash_elts (bds));
+ hash_foreach_pair (p, bds,
+ ({
+ rmp->bridge_domains[i++] = clib_host_to_net_u32 (p->key);
+ }));
+ });
+ /* *INDENT-ON* */
+
+ hash_free (bds);
+}
+
+static void
+vl_api_one_l2_arp_entries_get_t_handler (vl_api_one_l2_arp_entries_get_t * mp)
+{
+ vl_api_one_l2_arp_entries_get_reply_t *rmp;
+ lisp_api_l2_arp_entry_t *entries = 0, *e;
+ u32 i = 0;
+ int rv = 0;
+
+ u32 bd = clib_net_to_host_u32 (mp->bd);
+
+ entries = vnet_lisp_l2_arp_entries_get_by_bd (bd);
+ u32 size = vec_len (entries) * sizeof (u32);
+
+ /* *INDENT-OFF* */
+ REPLY_MACRO4 (VL_API_ONE_L2_ARP_ENTRIES_GET_REPLY, size,
+ {
+ rmp->count = clib_host_to_net_u32 (vec_len (entries));
+ vec_foreach (e, entries)
+ {
+ mac_copy (rmp->entries[i].mac, e->mac);
+ rmp->entries[i].ip4 = e->ip4;
+ i++;
+ }
+ });
+ /* *INDENT-ON* */
+
+ vec_free (entries);
+}
+
/*
* one_api_hookup
* Add vpe's API message handlers to the table.