aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/interface_api.c
diff options
context:
space:
mode:
authorMatthew Smith <mgsmith@netgate.com>2019-07-12 11:48:24 -0500
committerDamjan Marion <dmarion@me.com>2019-10-09 10:30:05 +0000
commite0792fdff6a9cc141f1cb4c6c1d2ac478cf44ee2 (patch)
treeba4d3e098043531cc5957f34e793dd29b0ee851d /src/vnet/interface_api.c
parent6a6af6ea1a77b5818e717047b5d01251ef6d024a (diff)
interface: callback to manage extra MAC addresses
Type: feature New callback vnet_hw_interface_add_del_mac_address(). Add or delete secondary MAC addresses on a hardware interface. This will allow packets to be processed which have a destination MAC address other than the primary programmed MAC address without needing to put the device into promiscuous mode. Change-Id: I6beecbcb8932fc1fe45b567f76fa3706feefae2c Signed-off-by: Matthew Smith <mgsmith@netgate.com>
Diffstat (limited to 'src/vnet/interface_api.c')
-rw-r--r--src/vnet/interface_api.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/vnet/interface_api.c b/src/vnet/interface_api.c
index 687f599b616..4d5dab30f38 100644
--- a/src/vnet/interface_api.c
+++ b/src/vnet/interface_api.c
@@ -68,6 +68,7 @@ _(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) \
@@ -899,6 +900,34 @@ out:
REPLY_MACRO (VL_API_SW_INTERFACE_TAG_ADD_DEL_REPLY);
}
+static void vl_api_sw_interface_add_del_mac_address_t_handler
+ (vl_api_sw_interface_add_del_mac_address_t * mp)
+{
+ vl_api_sw_interface_add_del_mac_address_reply_t *rmp;
+ vnet_main_t *vnm = vnet_get_main ();
+ u32 sw_if_index = ntohl (mp->sw_if_index);
+ vnet_hw_interface_t *hi;
+ clib_error_t *error;
+ int rv = 0;
+
+ VALIDATE_SW_IF_INDEX (mp);
+
+ /* for subifs, the MAC should be changed on the actual hw if */
+ hi = vnet_get_sup_hw_interface (vnm, sw_if_index);
+ error = vnet_hw_interface_add_del_mac_address (vnm, hi->hw_if_index,
+ mp->addr, mp->is_add);
+ if (error)
+ {
+ rv = VNET_API_ERROR_UNIMPLEMENTED;
+ clib_error_report (error);
+ goto out;
+ }
+
+ BAD_SW_IF_INDEX_LABEL;
+out:
+ REPLY_MACRO (VL_API_SW_INTERFACE_ADD_DEL_MAC_ADDRESS_REPLY);
+}
+
static void vl_api_sw_interface_set_mac_address_t_handler
(vl_api_sw_interface_set_mac_address_t * mp)
{