summaryrefslogtreecommitdiffstats
path: root/src/vnet/ip
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/ip')
-rw-r--r--src/vnet/ip/ip.api57
-rw-r--r--src/vnet/ip/ip_api.c100
-rw-r--r--src/vnet/ip/ip_neighbor.c2
3 files changed, 145 insertions, 14 deletions
diff --git a/src/vnet/ip/ip.api b/src/vnet/ip/ip.api
index 7f4f030882d..c5be0c67fbb 100644
--- a/src/vnet/ip/ip.api
+++ b/src/vnet/ip/ip.api
@@ -860,18 +860,13 @@ service {
events ip6_nd_event;
};
-/** \brief Proxy ARP add / del request
- @param client_index - opaque cookie to identify the sender
- @param context - sender context, to match reply w/ request
+/** \brief Proxy ARP configuration type
@param vrf_id - VRF / Fib table ID
- @param is_add - 1 if adding the Proxy ARP range, 0 if deleting
@param low_address[4] - Low address of the Proxy ARP range
@param hi_address[4] - High address of the Proxy ARP range
*/
-autoreply define proxy_arp_add_del
+typeonly define proxy_arp
{
- u32 client_index;
- u32 context;
u32 vrf_id;
u8 is_add;
u8 low_address[4];
@@ -881,6 +876,37 @@ autoreply define proxy_arp_add_del
/** \brief Proxy ARP add / del request
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
+ @param is_add - 1 if adding the Proxy ARP range, 0 if deleting
+ @param proxy - Proxy configuration
+*/
+autoreply define proxy_arp_add_del
+{
+ u32 client_index;
+ u32 context;
+ u8 is_add;
+ vl_api_proxy_arp_t proxy;
+};
+
+/** \brief Proxy ARP dump request
+ */
+define proxy_arp_dump
+{
+ u32 client_index;
+ u32 context;
+};
+
+/** \brief Proxy ARP dump details reply
+ * @param proxy - Same data as used to configure
+ */
+define proxy_arp_details
+{
+ u32 context;
+ vl_api_proxy_arp_t proxy;
+};
+
+/** \brief Proxy ARP add / del interface request
+ @param client_index - opaque cookie to identify the sender
+ @param context - sender context, to match reply w/ request
@param sw_if_index - Which interface to enable / disable Proxy Arp on
@param enable_disable - 1 to enable Proxy ARP on interface, 0 to disable
*/
@@ -893,6 +919,23 @@ autoreply define proxy_arp_intfc_enable_disable
u8 enable_disable;
};
+/** \brief Proxy ARP interface dump request
+ */
+define proxy_arp_intfc_dump
+{
+ u32 client_index;
+ u32 context;
+};
+
+/** \brief Proxy ARP interface dump details reply
+ * @param sw_if_index The interface on which ARP proxy is enabled.
+ */
+define proxy_arp_intfc_details
+{
+ u32 context;
+ u32 sw_if_index;
+};
+
/** \brief Reset fib table request
@param client_index - opaque cookie to identify the sender
@param context - sender context, to match reply w/ request
diff --git a/src/vnet/ip/ip_api.c b/src/vnet/ip/ip_api.c
index ce3ff79acfa..8464b1ddc98 100644
--- a/src/vnet/ip/ip_api.c
+++ b/src/vnet/ip/ip_api.c
@@ -45,6 +45,7 @@
#include <vnet/ip/ip6_hop_by_hop.h>
#include <vnet/ip/ip4_reassembly.h>
#include <vnet/ip/ip6_reassembly.h>
+#include <vnet/ethernet/arp.h>
#include <vnet/vnet_msg_enum.h>
@@ -84,7 +85,9 @@ _(WANT_IP4_ARP_EVENTS, want_ip4_arp_events) \
_(WANT_IP6_ND_EVENTS, want_ip6_nd_events) \
_(WANT_IP6_RA_EVENTS, want_ip6_ra_events) \
_(PROXY_ARP_ADD_DEL, proxy_arp_add_del) \
+_(PROXY_ARP_DUMP, proxy_arp_dump) \
_(PROXY_ARP_INTFC_ENABLE_DISABLE, proxy_arp_intfc_enable_disable) \
+ _(PROXY_ARP_INTFC_DUMP, proxy_arp_intfc_dump) \
_(RESET_FIB, reset_fib) \
_(IP_ADD_DEL_ROUTE, ip_add_del_route) \
_(IP_TABLE_ADD_DEL, ip_table_add_del) \
@@ -2715,14 +2718,11 @@ vl_api_proxy_arp_add_del_t_handler (vl_api_proxy_arp_add_del_t * mp)
u32 fib_index;
int rv;
ip4_main_t *im = &ip4_main;
- int vnet_proxy_arp_add_del (ip4_address_t * lo_addr,
- ip4_address_t * hi_addr,
- u32 fib_index, int is_del);
uword *p;
stats_dslock_with_hint (1 /* release hint */ , 6 /* tag */ );
- p = hash_get (im->fib_index_by_table_id, ntohl (mp->vrf_id));
+ p = hash_get (im->fib_index_by_table_id, ntohl (mp->proxy.vrf_id));
if (!p)
{
@@ -2732,8 +2732,8 @@ vl_api_proxy_arp_add_del_t_handler (vl_api_proxy_arp_add_del_t * mp)
fib_index = p[0];
- rv = vnet_proxy_arp_add_del ((ip4_address_t *) mp->low_address,
- (ip4_address_t *) mp->hi_address,
+ rv = vnet_proxy_arp_add_del ((ip4_address_t *) mp->proxy.low_address,
+ (ip4_address_t *) mp->proxy.hi_address,
fib_index, mp->is_add == 0);
out:
@@ -2741,6 +2741,94 @@ out:
REPLY_MACRO (VL_API_PROXY_ARP_ADD_DEL_REPLY);
}
+typedef struct proxy_arp_walk_ctx_t_
+{
+ vl_api_registration_t *reg;
+ u32 context;
+} proxy_arp_walk_ctx_t;
+
+static walk_rc_t
+send_proxy_arp_details (const ip4_address_t * lo_addr,
+ const ip4_address_t * hi_addr,
+ u32 fib_index, void *data)
+{
+ vl_api_proxy_arp_details_t *mp;
+ proxy_arp_walk_ctx_t *ctx;
+
+ ctx = data;
+
+ mp = vl_msg_api_alloc (sizeof (*mp));
+ memset (mp, 0, sizeof (*mp));
+ mp->_vl_msg_id = ntohs (VL_API_PROXY_ARP_DETAILS);
+ mp->context = ctx->context;
+ mp->proxy.vrf_id = htonl (fib_index);
+ clib_memcpy (mp->proxy.low_address, lo_addr,
+ sizeof (mp->proxy.low_address));
+ clib_memcpy (mp->proxy.hi_address, hi_addr, sizeof (mp->proxy.hi_address));
+
+ vl_api_send_msg (ctx->reg, (u8 *) mp);
+
+ return (WALK_CONTINUE);
+}
+
+static void
+vl_api_proxy_arp_dump_t_handler (vl_api_proxy_arp_dump_t * mp)
+{
+ vl_api_registration_t *reg;
+
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
+ return;
+
+ proxy_arp_walk_ctx_t wctx = {
+ .reg = reg,
+ .context = mp->context,
+ };
+
+ proxy_arp_walk (send_proxy_arp_details, &wctx);
+}
+
+static walk_rc_t
+send_proxy_arp_intfc_details (vnet_main_t * vnm,
+ vnet_sw_interface_t * si, void *data)
+{
+ vl_api_proxy_arp_intfc_details_t *mp;
+ proxy_arp_walk_ctx_t *ctx;
+
+ if (!(si->flags & VNET_SW_INTERFACE_FLAG_PROXY_ARP))
+ return (WALK_CONTINUE);
+
+ ctx = data;
+
+ mp = vl_msg_api_alloc (sizeof (*mp));
+ memset (mp, 0, sizeof (*mp));
+ mp->_vl_msg_id = ntohs (VL_API_PROXY_ARP_INTFC_DETAILS);
+ mp->context = ctx->context;
+ mp->sw_if_index = htonl (si->sw_if_index);
+
+ vl_api_send_msg (ctx->reg, (u8 *) mp);
+
+ return (WALK_CONTINUE);
+}
+
+static void
+vl_api_proxy_arp_intfc_dump_t_handler (vl_api_proxy_arp_intfc_dump_t * mp)
+{
+ vl_api_registration_t *reg;
+
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
+ return;
+
+ proxy_arp_walk_ctx_t wctx = {
+ .reg = reg,
+ .context = mp->context,
+ };
+
+ vnet_sw_interface_walk (vnet_get_main (),
+ send_proxy_arp_intfc_details, &wctx);
+}
+
static void
vl_api_proxy_arp_intfc_enable_disable_t_handler
(vl_api_proxy_arp_intfc_enable_disable_t * mp)
diff --git a/src/vnet/ip/ip_neighbor.c b/src/vnet/ip/ip_neighbor.c
index a43fdfd58b3..b9c03aa703c 100644
--- a/src/vnet/ip/ip_neighbor.c
+++ b/src/vnet/ip/ip_neighbor.c
@@ -19,7 +19,7 @@
#include <vnet/ip/ip.h>
#include <vnet/ip/ip6_neighbor.h>
#include <vnet/ip/ip_neighbor.h>
-#include <vnet/ethernet/arp_packet.h>
+#include <vnet/ethernet/arp.h>
/*
* IP neighbor scan parameter defaults are as follows: