aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ip
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/ip')
-rw-r--r--src/vnet/ip/ip4.h13
-rw-r--r--src/vnet/ip/ip4_forward.c6
-rw-r--r--src/vnet/ip/ip_api.c23
3 files changed, 25 insertions, 17 deletions
diff --git a/src/vnet/ip/ip4.h b/src/vnet/ip/ip4.h
index 31ca10feece..5c9add4c796 100644
--- a/src/vnet/ip/ip4.h
+++ b/src/vnet/ip/ip4.h
@@ -74,6 +74,15 @@ typedef struct
uword function_opaque;
} ip4_add_del_interface_address_callback_t;
+typedef void (ip4_enable_disable_interface_function_t)
+ (struct ip4_main_t * im, uword opaque, u32 sw_if_index, u32 is_enable);
+
+typedef struct
+{
+ ip4_enable_disable_interface_function_t *function;
+ uword function_opaque;
+} ip4_enable_disable_interface_callback_t;
+
typedef void (ip4_table_bind_function_t)
(struct ip4_main_t * im,
uword opaque, u32 sw_if_index, u32 new_fib_index, u32 old_fib_index);
@@ -129,6 +138,10 @@ typedef struct ip4_main_t
ip4_add_del_interface_address_callback_t
* add_del_interface_address_callbacks;
+ /** Functions to call when interface becomes IPv4 enabled/disable. */
+ ip4_enable_disable_interface_callback_t
+ * enable_disable_interface_callbacks;
+
/** Functions to call when interface to table biding changes. */
ip4_table_bind_callback_t *table_bind_callbacks;
diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c
index d8eed67a381..9c5524f17a0 100644
--- a/src/vnet/ip/ip4_forward.c
+++ b/src/vnet/ip/ip4_forward.c
@@ -515,6 +515,12 @@ ip4_sw_interface_enable_disable (u32 sw_if_index, u32 is_enable)
vnet_feature_enable_disable ("ip4-multicast", "ip4-not-enabled",
sw_if_index, !is_enable, 0, 0);
+
+ {
+ ip4_enable_disable_interface_callback_t *cb;
+ vec_foreach (cb, im->enable_disable_interface_callbacks)
+ cb->function (im, cb->function_opaque, sw_if_index, is_enable);
+ }
}
static clib_error_t *
diff --git a/src/vnet/ip/ip_api.c b/src/vnet/ip/ip_api.c
index f4e5d1776bd..06caf111b91 100644
--- a/src/vnet/ip/ip_api.c
+++ b/src/vnet/ip/ip_api.c
@@ -3019,22 +3019,18 @@ vl_api_proxy_arp_dump_t_handler (vl_api_proxy_arp_dump_t * mp)
}
static walk_rc_t
-send_proxy_arp_intfc_details (vnet_main_t * vnm,
- vnet_sw_interface_t * si, void *data)
+send_proxy_arp_intfc_details (u32 sw_if_index, 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));
clib_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);
+ mp->sw_if_index = htonl (sw_if_index);
vl_api_send_msg (ctx->reg, (u8 *) mp);
@@ -3055,8 +3051,7 @@ vl_api_proxy_arp_intfc_dump_t_handler (vl_api_proxy_arp_intfc_dump_t * mp)
.context = mp->context,
};
- vnet_sw_interface_walk (vnet_get_main (),
- send_proxy_arp_intfc_details, &wctx);
+ proxy_arp_intfc_walk (send_proxy_arp_intfc_details, &wctx);
}
static void
@@ -3069,15 +3064,9 @@ static void
VALIDATE_SW_IF_INDEX (mp);
- vnet_sw_interface_t *si =
- vnet_get_sw_interface (vnm, ntohl (mp->sw_if_index));
-
- ASSERT (si);
-
- if (mp->enable_disable)
- si->flags |= VNET_SW_INTERFACE_FLAG_PROXY_ARP;
- else
- si->flags &= ~VNET_SW_INTERFACE_FLAG_PROXY_ARP;
+ rv = vnet_proxy_arp_enable_disable (vnm,
+ ntohl (mp->sw_if_index),
+ mp->enable_disable);
BAD_SW_IF_INDEX_LABEL;