X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=vnet%2Fvnet%2Fip%2Fip46_cli.c;h=0b598c6d5c98fbf508c6bb3d1fcec851dd5cc7d0;hb=6ef7bb993e0504d62e2de8a9201f8cb4c296a83a;hp=44dde9bf3e7d1c11bde3f1cbd1dd942f47f9654c;hpb=cb9cadad578297ffd78fa8a33670bdf1ab669e7e;p=vpp.git diff --git a/vnet/vnet/ip/ip46_cli.c b/vnet/vnet/ip/ip46_cli.c index 44dde9bf3e7..0b598c6d5c9 100644 --- a/vnet/vnet/ip/ip46_cli.c +++ b/vnet/vnet/ip/ip46_cli.c @@ -101,6 +101,23 @@ void ip_del_all_interface_addresses (vlib_main_t *vm, u32 sw_if_index) vec_free (ip6_masks); } +static clib_error_t * +ip_address_delete_cleanup (vnet_main_t * vnm, u32 hw_if_index, u32 is_create) +{ + vlib_main_t * vm = vlib_get_main(); + vnet_hw_interface_t * hw; + + if (is_create) + return 0; + + hw = vnet_get_hw_interface (vnm, hw_if_index); + + ip_del_all_interface_addresses (vm, hw->sw_if_index); + return 0; +} + +VNET_HW_INTERFACE_ADD_DEL_FUNCTION (ip_address_delete_cleanup); + static clib_error_t * add_del_ip_address (vlib_main_t * vm, unformat_input_t * input, @@ -144,7 +161,22 @@ add_del_ip_address (vlib_main_t * vm, done: return error; } - +/*? + * To set an interface ip address, use "set interface ip address": + * + * @cliexpar + * @cliexstart{set interface ip address} + + * vpp# set interface ip address GigabitEthernet2/0/0 db01::1/64 + * Note that the debug CLI does not enforce classful mask-width / addressing constraints. + * Interfaces may have multiple ip4 and ip6 addresses. + * There is no concept of primary vs. secondary interface addresses; they're just addresses. + * To delete a specific interface ip address, use "set interface ip address del": + * vpp# set interface ip address del GigabitEthernet2/0/0 6.0.0.2/24 + * To delete all interfaces addresses (ip4+ip6), use "set interface ip address del all" + * vpp# set interface ip address del GigabitEthernet2/0/0 all + * @cliexend + ?*/ VLIB_CLI_COMMAND (set_interface_ip_address_command, static) = { .path = "set interface ip address", .function = add_del_ip_address,