aboutsummaryrefslogtreecommitdiffstats
path: root/vpp
diff options
context:
space:
mode:
authorKeith Burns (alagalah) <alagalah@gmail.com>2016-06-13 16:56:04 -0700
committerDave Barach <openvpp@barachs.net>2016-06-14 11:45:54 +0000
commit802255c908a9bde9ef2e95ee7bffb8695c1c03f3 (patch)
treedb82dc5f733125ebcf6bf868a5ffafe83f9d868d /vpp
parent24612b3fb8c4b7cef5f6b725da3321e419cf8216 (diff)
Add sw_if_index to af_packet_create and various clean ups
Change-Id: I4c2972b55d5d99f3aa7a05885791eef47351c734 Signed-off-by: Keith Burns (alagalah) <alagalah@gmail.com>
Diffstat (limited to 'vpp')
-rw-r--r--vpp/api/api.c6
-rw-r--r--vpp/api/custom_dump.c28
-rw-r--r--vpp/api/vpe.api1
3 files changed, 33 insertions, 2 deletions
diff --git a/vpp/api/api.c b/vpp/api/api.c
index 95301f4c..f398e4f9 100644
--- a/vpp/api/api.c
+++ b/vpp/api/api.c
@@ -6001,16 +6001,18 @@ vl_api_af_packet_create_t_handler
vl_api_af_packet_create_reply_t *rmp;
int rv = 0;
u8 *host_if_name = NULL;
+ u32 sw_if_index;
host_if_name = format(0, "%s", mp->host_if_name);
vec_add1 (host_if_name, 0);
rv = af_packet_create_if(vm, host_if_name,
- mp->use_random_hw_addr ? 0 : mp->hw_addr, 0);
+ mp->use_random_hw_addr ? 0 : mp->hw_addr, &sw_if_index);
vec_free(host_if_name);
- REPLY_MACRO(VL_API_AF_PACKET_CREATE_REPLY);
+ REPLY_MACRO2(VL_API_AF_PACKET_CREATE_REPLY,
+ rmp->sw_if_index = clib_host_to_net_u32(sw_if_index));
}
static void
diff --git a/vpp/api/custom_dump.c b/vpp/api/custom_dump.c
index f49e1b05..388c7e50 100644
--- a/vpp/api/custom_dump.c
+++ b/vpp/api/custom_dump.c
@@ -1717,6 +1717,32 @@ static void * vl_api_cop_whitelist_enable_disable_t_print
FINISH;
}
+static void * vl_api_af_packet_create_t_print
+(vl_api_af_packet_create_t * mp, void *handle)
+{
+ u8 * s;
+
+ s = format (0, "SCRIPT: af_packet_create ");
+ s = format (s, "host_if_name %s ", mp->host_if_name);
+ if ( mp->use_random_hw_addr)
+ s = format (s, "hw_addr random ");
+ else
+ s = format (s, "hw_addr %U ", format_ethernet_address, mp->hw_addr);
+
+ FINISH;
+}
+
+static void * vl_api_af_packet_delete_t_print
+(vl_api_af_packet_delete_t * mp, void *handle)
+{
+ u8 * s;
+
+ s = format (0, "SCRIPT: af_packet_delete ");
+ s = format (s, "host_if_name %s ", mp->host_if_name);
+
+ FINISH;
+}
+
static void *vl_api_sw_interface_clear_stats_t_print
(vl_api_sw_interface_clear_stats_t * mp, void *handle)
{
@@ -1814,6 +1840,8 @@ _(DELETE_LOOPBACK, delete_loopback) \
_(BD_IP_MAC_ADD_DEL, bd_ip_mac_add_del) \
_(COP_INTERFACE_ENABLE_DISABLE, cop_interface_enable_disable) \
_(COP_WHITELIST_ENABLE_DISABLE, cop_whitelist_enable_disable) \
+_(AF_PACKET_CREATE, af_packet_create) \
+_(AF_PACKET_DELETE, af_packet_delete) \
_(SW_INTERFACE_CLEAR_STATS, sw_interface_clear_stats)
void vl_msg_api_custom_dump_configure (api_main_t *am)
diff --git a/vpp/api/vpe.api b/vpp/api/vpe.api
index 9a639c61..71783a46 100644
--- a/vpp/api/vpe.api
+++ b/vpp/api/vpe.api
@@ -3443,6 +3443,7 @@ define af_packet_create {
define af_packet_create_reply {
u32 context;
i32 retval;
+ u32 sw_if_index;
};
/** \brief Delete host-interface