aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vnet/interface.api2
-rw-r--r--src/vnet/interface_api.c5
-rw-r--r--src/vpp/api/custom_dump.c6
-rw-r--r--test/test_interface_crud.py7
4 files changed, 14 insertions, 6 deletions
diff --git a/src/vnet/interface.api b/src/vnet/interface.api
index 1db5ef34c3a..efc5bb487c9 100644
--- a/src/vnet/interface.api
+++ b/src/vnet/interface.api
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-option version = "3.2.0";
+option version = "3.2.1";
import "vnet/interface_types.api";
import "vnet/ethernet/ethernet_types.api";
diff --git a/src/vnet/interface_api.c b/src/vnet/interface_api.c
index 5e9561fec5f..3b0c515f013 100644
--- a/src/vnet/interface_api.c
+++ b/src/vnet/interface_api.c
@@ -358,9 +358,8 @@ vl_api_sw_interface_dump_t_handler (vl_api_sw_interface_dump_t * mp)
if (mp->name_filter_valid)
{
- filter =
- format (0, ".*%s", vl_api_string_len (&mp->name_filter),
- vl_api_from_api_string (&mp->name_filter), 0);
+ filter = vl_api_from_api_to_vec (&mp->name_filter);
+ vec_add1 (filter, 0); /* Ensure it's a C string for strcasecmp() */
}
char *strcasestr (char *, char *); /* lnx hdr file botch */
diff --git a/src/vpp/api/custom_dump.c b/src/vpp/api/custom_dump.c
index e96f4ee320c..83761bf6276 100644
--- a/src/vpp/api/custom_dump.c
+++ b/src/vpp/api/custom_dump.c
@@ -1902,7 +1902,11 @@ static void *vl_api_sw_interface_dump_t_print
s = format (0, "SCRIPT: sw_interface_dump ");
if (mp->name_filter_valid)
- s = format (s, "name_filter %s ", mp->name_filter);
+ {
+ u8 *v = vl_api_from_api_to_vec (&mp->name_filter);
+ s = format (s, "name_filter %v ", v);
+ vec_free (v);
+ }
else
s = format (s, "all ");
diff --git a/test/test_interface_crud.py b/test/test_interface_crud.py
index afeafa5f73b..f701e2735a6 100644
--- a/test/test_interface_crud.py
+++ b/test/test_interface_crud.py
@@ -90,12 +90,17 @@ class TestLoopbackInterfaceCRUD(VppTestCase):
i.admin_up()
# read (check sw if dump, ip4 fib, ip6 fib)
- if_dump = self.vapi.sw_interface_dump()
+ if_dump = self.vapi.sw_interface_dump(name_filter_valid=True,
+ name_filter='loop')
fib4_dump = self.vapi.ip_route_dump(0)
for i in loopbacks:
self.assertTrue(i.is_interface_config_in_dump(if_dump))
self.assertTrue(i.is_ip4_entry_in_fib_dump(fib4_dump))
+ if_dump = self.vapi.sw_interface_dump(name_filter_valid=True,
+ name_filter='loopXYZ')
+ self.assertEqual(len(if_dump), 0)
+
# check ping
stream = self.create_icmp_stream(self.pg0, loopbacks)
self.pg0.add_stream(stream)