tap: implement sw_interface_tap_v2_dump filtering by sw_if_index
Type: feature
Change-Id: I6f607f383dc77a71e8712124f7613b38b4ac065a
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
diff --git a/src/vnet/devices/tap/tapv2_api.c b/src/vnet/devices/tap/tapv2_api.c
index 9e09459..0567937 100644
--- a/src/vnet/devices/tap/tapv2_api.c
+++ b/src/vnet/devices/tap/tapv2_api.c
@@ -232,8 +232,8 @@
return;
filter_sw_if_index = htonl (mp->sw_if_index);
- if (filter_sw_if_index != ~0)
- return; /* UNIMPLEMENTED */
+ if (mp->sw_if_index != ~0)
+ VALIDATE_SW_IF_INDEX (mp);
rv = tap_dump_ifs (&tapifs);
if (rv)
@@ -241,9 +241,11 @@
vec_foreach (tap_if, tapifs)
{
- tap_send_sw_interface_details (am, reg, tap_if, mp->context);
+ if ((filter_sw_if_index == ~0)
+ || (tap_if->sw_if_index == filter_sw_if_index))
+ tap_send_sw_interface_details (am, reg, tap_if, mp->context);
}
-
+ BAD_SW_IF_INDEX_LABEL;
vec_free (tapifs);
}