From 0eb22efbb54fe2e56ce8928476fffa381cb1ca8b Mon Sep 17 00:00:00 2001 From: John Lo Date: Thu, 2 Mar 2017 12:51:45 -0500 Subject: [PATCH] Fix create_vlan_subif API using sw_if_index as hw_if_index Also added check for bounded interface. Change-Id: I44b981d5b6fbe360e0b95c326f3f8b0e6c715468 Signed-off-by: John Lo --- src/vpp/api/api.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/vpp/api/api.c b/src/vpp/api/api.c index a8f471e864e..6b2329fac74 100644 --- a/src/vpp/api/api.c +++ b/src/vpp/api/api.c @@ -492,7 +492,7 @@ vl_api_create_vlan_subif_t_handler (vl_api_create_vlan_subif_t * mp) { vl_api_create_vlan_subif_reply_t *rmp; vnet_main_t *vnm = vnet_get_main (); - u32 hw_if_index, sw_if_index = (u32) ~ 0; + u32 sw_if_index = (u32) ~ 0; vnet_hw_interface_t *hi; int rv = 0; u32 id; @@ -506,8 +506,13 @@ vl_api_create_vlan_subif_t_handler (vl_api_create_vlan_subif_t * mp) VALIDATE_SW_IF_INDEX (mp); - hw_if_index = ntohl (mp->sw_if_index); - hi = vnet_get_hw_interface (vnm, hw_if_index); + hi = vnet_get_sup_hw_interface (vnm, ntohl (mp->sw_if_index)); + + if (hi->bond_info == VNET_HW_INTERFACE_BOND_INFO_SLAVE) + { + rv = VNET_API_ERROR_BOND_SLAVE_NOT_ALLOWED; + goto out; + } id = ntohl (mp->vlan_id); if (id == 0 || id > 4095) -- 2.16.6