summaryrefslogtreecommitdiffstats
path: root/src/vnet/interface_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/interface_api.c')
-rw-r--r--src/vnet/interface_api.c94
1 files changed, 62 insertions, 32 deletions
diff --git a/src/vnet/interface_api.c b/src/vnet/interface_api.c
index ab9d04af2d8..b75ec574d1c 100644
--- a/src/vnet/interface_api.c
+++ b/src/vnet/interface_api.c
@@ -54,38 +54,37 @@
#include <vlibapi/api_helper_macros.h>
vpe_api_main_t vpe_api_main;
-#define foreach_vpe_api_msg \
-_(SW_INTERFACE_SET_FLAGS, sw_interface_set_flags) \
-_(HW_INTERFACE_SET_MTU, hw_interface_set_mtu) \
-_(SW_INTERFACE_SET_MTU, sw_interface_set_mtu) \
-_(WANT_INTERFACE_EVENTS, want_interface_events) \
-_(SW_INTERFACE_DUMP, sw_interface_dump) \
-_(SW_INTERFACE_ADD_DEL_ADDRESS, sw_interface_add_del_address) \
-_(SW_INTERFACE_SET_RX_MODE, sw_interface_set_rx_mode) \
-_(SW_INTERFACE_RX_PLACEMENT_DUMP, sw_interface_rx_placement_dump) \
-_(SW_INTERFACE_SET_RX_PLACEMENT, sw_interface_set_rx_placement) \
-_(SW_INTERFACE_SET_TABLE, sw_interface_set_table) \
-_(SW_INTERFACE_GET_TABLE, sw_interface_get_table) \
-_(SW_INTERFACE_SET_UNNUMBERED, sw_interface_set_unnumbered) \
-_(SW_INTERFACE_CLEAR_STATS, sw_interface_clear_stats) \
-_(SW_INTERFACE_TAG_ADD_DEL, sw_interface_tag_add_del) \
-_(SW_INTERFACE_ADD_DEL_MAC_ADDRESS, sw_interface_add_del_mac_address) \
-_(SW_INTERFACE_SET_MAC_ADDRESS, sw_interface_set_mac_address) \
-_(SW_INTERFACE_GET_MAC_ADDRESS, sw_interface_get_mac_address) \
-_(CREATE_VLAN_SUBIF, create_vlan_subif) \
-_(CREATE_SUBIF, create_subif) \
-_(DELETE_SUBIF, delete_subif) \
-_(CREATE_LOOPBACK, create_loopback) \
-_(CREATE_LOOPBACK_INSTANCE, create_loopback_instance) \
-_(DELETE_LOOPBACK, delete_loopback) \
-_(INTERFACE_NAME_RENUMBER, interface_name_renumber) \
-_(COLLECT_DETAILED_INTERFACE_STATS, collect_detailed_interface_stats) \
-_(SW_INTERFACE_SET_IP_DIRECTED_BROADCAST, \
- sw_interface_set_ip_directed_broadcast) \
-_(SW_INTERFACE_ADDRESS_REPLACE_BEGIN, \
- sw_interface_address_replace_begin) \
-_(SW_INTERFACE_ADDRESS_REPLACE_END, \
- sw_interface_address_replace_end)
+#define foreach_vpe_api_msg \
+ _ (SW_INTERFACE_SET_FLAGS, sw_interface_set_flags) \
+ _ (SW_INTERFACE_SET_PROMISC, sw_interface_set_promisc) \
+ _ (HW_INTERFACE_SET_MTU, hw_interface_set_mtu) \
+ _ (SW_INTERFACE_SET_MTU, sw_interface_set_mtu) \
+ _ (WANT_INTERFACE_EVENTS, want_interface_events) \
+ _ (SW_INTERFACE_DUMP, sw_interface_dump) \
+ _ (SW_INTERFACE_ADD_DEL_ADDRESS, sw_interface_add_del_address) \
+ _ (SW_INTERFACE_SET_RX_MODE, sw_interface_set_rx_mode) \
+ _ (SW_INTERFACE_RX_PLACEMENT_DUMP, sw_interface_rx_placement_dump) \
+ _ (SW_INTERFACE_SET_RX_PLACEMENT, sw_interface_set_rx_placement) \
+ _ (SW_INTERFACE_SET_TABLE, sw_interface_set_table) \
+ _ (SW_INTERFACE_GET_TABLE, sw_interface_get_table) \
+ _ (SW_INTERFACE_SET_UNNUMBERED, sw_interface_set_unnumbered) \
+ _ (SW_INTERFACE_CLEAR_STATS, sw_interface_clear_stats) \
+ _ (SW_INTERFACE_TAG_ADD_DEL, sw_interface_tag_add_del) \
+ _ (SW_INTERFACE_ADD_DEL_MAC_ADDRESS, sw_interface_add_del_mac_address) \
+ _ (SW_INTERFACE_SET_MAC_ADDRESS, sw_interface_set_mac_address) \
+ _ (SW_INTERFACE_GET_MAC_ADDRESS, sw_interface_get_mac_address) \
+ _ (CREATE_VLAN_SUBIF, create_vlan_subif) \
+ _ (CREATE_SUBIF, create_subif) \
+ _ (DELETE_SUBIF, delete_subif) \
+ _ (CREATE_LOOPBACK, create_loopback) \
+ _ (CREATE_LOOPBACK_INSTANCE, create_loopback_instance) \
+ _ (DELETE_LOOPBACK, delete_loopback) \
+ _ (INTERFACE_NAME_RENUMBER, interface_name_renumber) \
+ _ (COLLECT_DETAILED_INTERFACE_STATS, collect_detailed_interface_stats) \
+ _ (SW_INTERFACE_SET_IP_DIRECTED_BROADCAST, \
+ sw_interface_set_ip_directed_broadcast) \
+ _ (SW_INTERFACE_ADDRESS_REPLACE_BEGIN, sw_interface_address_replace_begin) \
+ _ (SW_INTERFACE_ADDRESS_REPLACE_END, sw_interface_address_replace_end)
static void
vl_api_sw_interface_set_flags_t_handler (vl_api_sw_interface_set_flags_t * mp)
@@ -114,6 +113,37 @@ vl_api_sw_interface_set_flags_t_handler (vl_api_sw_interface_set_flags_t * mp)
}
static void
+vl_api_sw_interface_set_promisc_t_handler (
+ vl_api_sw_interface_set_promisc_t *mp)
+{
+ vl_api_sw_interface_set_promisc_reply_t *rmp;
+ vnet_main_t *vnm = vnet_get_main ();
+ ethernet_main_t *em = &ethernet_main;
+ int rv = 0;
+ ethernet_interface_t *eif;
+ vnet_sw_interface_t *swif;
+ u32 flags, sw_if_index;
+
+ VALIDATE_SW_IF_INDEX (mp);
+
+ sw_if_index = ntohl (mp->sw_if_index);
+ swif = vnet_get_sw_interface (vnm, sw_if_index);
+ eif = ethernet_get_interface (em, swif->hw_if_index);
+ if (!eif)
+ {
+ rv = VNET_API_ERROR_INVALID_VALUE;
+ goto done;
+ }
+
+ flags = mp->promisc_on ? ETHERNET_INTERFACE_FLAG_ACCEPT_ALL : 0;
+ rv = ethernet_set_flags (vnm, swif->hw_if_index, flags);
+
+done:
+ BAD_SW_IF_INDEX_LABEL;
+ REPLY_MACRO (VL_API_SW_INTERFACE_SET_PROMISC_REPLY);
+}
+
+static void
vl_api_hw_interface_set_mtu_t_handler (vl_api_hw_interface_set_mtu_t * mp)
{
vl_api_hw_interface_set_mtu_reply_t *rmp;