aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/interface_api.c
diff options
context:
space:
mode:
authorJuraj Sloboda <jsloboda@cisco.com>2018-02-01 15:18:49 +0100
committerOle Trøan <otroan@employees.org>2018-03-16 20:07:51 +0000
commitc03742346f0f3f08b83b0d2944bf72e19ea26191 (patch)
tree124cb6dc5cd45d070d2649bcf64916b27bf7bd01 /src/vnet/interface_api.c
parentff92efe1074e338f91e59d9c27125d102516e7bf (diff)
IPv6 ND Router discovery control plane (VPP-1095)
Change-Id: I4b5b60e7c6f618bb935eab1e96a2e79bbb14f58f Signed-off-by: Juraj Sloboda <jsloboda@cisco.com>
Diffstat (limited to 'src/vnet/interface_api.c')
-rw-r--r--src/vnet/interface_api.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/vnet/interface_api.c b/src/vnet/interface_api.c
index ed116bc88d9..fc7af1be463 100644
--- a/src/vnet/interface_api.c
+++ b/src/vnet/interface_api.c
@@ -61,6 +61,7 @@ _(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_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) \
@@ -903,6 +904,37 @@ out:
REPLY_MACRO (VL_API_SW_INTERFACE_SET_MAC_ADDRESS_REPLY);
}
+static void vl_api_sw_interface_get_mac_address_t_handler
+ (vl_api_sw_interface_get_mac_address_t * mp)
+{
+ vl_api_sw_interface_get_mac_address_reply_t *rmp;
+ vl_api_registration_t *reg;
+ vnet_main_t *vnm = vnet_get_main ();
+ u32 sw_if_index = ntohl (mp->sw_if_index);
+ vnet_sw_interface_t *si;
+ ethernet_interface_t *eth_if = 0;
+ int rv = 0;
+
+ VALIDATE_SW_IF_INDEX (mp);
+
+ si = vnet_get_sup_sw_interface (vnm, sw_if_index);
+ if (si->type == VNET_SW_INTERFACE_TYPE_HARDWARE)
+ eth_if = ethernet_get_interface (&ethernet_main, si->hw_if_index);
+
+ BAD_SW_IF_INDEX_LABEL;
+
+ reg = vl_api_client_index_to_registration (mp->client_index);
+ if (!reg)
+ return;
+ rmp = vl_msg_api_alloc (sizeof (*rmp));
+ rmp->_vl_msg_id = htons (VL_API_SW_INTERFACE_GET_MAC_ADDRESS_REPLY);
+ rmp->context = mp->context;
+ rmp->retval = htonl (rv);
+ if (!rv && eth_if)
+ memcpy (rmp->mac_address, eth_if->address, 6);
+ vl_api_send_msg (reg, (u8 *) rmp);
+}
+
static void vl_api_sw_interface_set_rx_mode_t_handler
(vl_api_sw_interface_set_rx_mode_t * mp)
{