diff options
author | Pavel Kotucek <pkotucek@cisco.com> | 2016-10-17 15:31:59 +0200 |
---|---|---|
committer | John Lo <loj@cisco.com> | 2016-11-15 16:08:20 +0000 |
commit | 7c8eda16d4bc10bf779200b23369e2ee12843dc1 (patch) | |
tree | 0e27b12de1b76a8c7f0cd8cbbb6036e163b4973d | |
parent | 86d87c40dd97ced69c939299204fadf1859a2f50 (diff) |
VPP-393: Subinterface is still used after deletion
Fixed bug in delete of sub-interface, if sub-interface is xconnected it
was not deleted correctly (show interface address fails).
Interface is set to L3 mode before deletion.
Fixed help in API command.
Signed-off-by: Pavel Kotucek <pkotucek@cisco.com>
Change-Id: Ibe781e4b53422e6535e34ec72dbe274f9045f051
-rw-r--r-- | vnet/vnet/interface.c | 10 | ||||
-rw-r--r-- | vpp-api-test/vat/api_format.c | 4 |
2 files changed, 13 insertions, 1 deletions
diff --git a/vnet/vnet/interface.c b/vnet/vnet/interface.c index 7a808add832..b57c1e8a01a 100644 --- a/vnet/vnet/interface.c +++ b/vnet/vnet/interface.c @@ -623,6 +623,16 @@ vnet_delete_sw_interface (vnet_main_t * vnm, u32 sw_if_index) vnet_sw_interface_t *sw = pool_elt_at_index (im->sw_interfaces, sw_if_index); + /* Make sure the interface is in L3 mode (removed from L2 BD or XConnect) */ + vlib_main_t *vm = vlib_get_main (); + l2_input_config_t *config; + config = vec_elt_at_index (l2input_main.configs, sw_if_index); + if (config->xconnect) + set_int_l2_mode (vm, vnm, MODE_L3, config->output_sw_if_index, 0, 0, 0, + 0); + if (config->xconnect || config->bridge) + set_int_l2_mode (vm, vnm, MODE_L3, sw_if_index, 0, 0, 0, 0); + /* Bring down interface in case it is up. */ if (sw->flags != 0) vnet_sw_interface_set_flags (vnm, sw_if_index, /* flags */ 0); diff --git a/vpp-api-test/vat/api_format.c b/vpp-api-test/vat/api_format.c index 5c77590ce49..c77571a7357 100644 --- a/vpp-api-test/vat/api_format.c +++ b/vpp-api-test/vat/api_format.c @@ -15935,6 +15935,8 @@ api_delete_subif (vat_main_t * vam) while (unformat_check_input (i) != UNFORMAT_END_OF_INPUT) { + if (unformat (i, "%U", unformat_sw_if_index, vam, &sw_if_index)) + ; if (unformat (i, "sw_if_index %d", &sw_if_index)) ; else @@ -16727,7 +16729,7 @@ _(ip_source_and_port_range_check_interface_add_del, \ _(ipsec_gre_add_del_tunnel, \ "src <addr> dst <addr> local_sa <sa-id> remote_sa <sa-id> [del]") \ _(ipsec_gre_tunnel_dump, "[sw_if_index <nn>]") \ -_(delete_subif,"sub_sw_if_index <nn> sub_if_id <nn>") \ +_(delete_subif,"<intfc> | sw_if_index <nn>") \ _(l2_interface_pbb_tag_rewrite, \ "<intfc> | sw_if_index <nn> \n" \ "[disable | push | pop | translate_pbb_stag <outer_tag>] \n" \ |