43 {
return clib_net_to_host_u32 (a1->
data_u32) - clib_net_to_host_u32 (a2->
data_u32); }
50 int cmp = clib_net_to_host_u16 (a1->
as_u16[i]) - clib_net_to_host_u16 (a2->
as_u16[i]);
58 .path =
"set interface ip",
59 .short_help =
"IP4/IP6 commands",
76 ip4_address_t * x = (ip4_address_t *)
77 ip_interface_address_get_address (&im4->lookup_main, ia);
78 vec_add1 (ip4_addrs, x[0]);
79 vec_add1 (ip4_masks, ia->address_length);
85 ip6_address_t * x = (ip6_address_t *)
86 ip_interface_address_get_address (&im6->lookup_main, ia);
87 vec_add1 (ip6_addrs, x[0]);
88 vec_add1 (ip6_masks, ia->address_length);
91 for (i = 0; i <
vec_len (ip4_addrs); i++)
94 for (i = 0; i <
vec_len (ip6_addrs); i++)
113 u32 sw_if_index, length, is_del;
128 if (is_del &&
unformat (input,
"all"))
149 .path =
"set interface ip address",
151 .short_help =
"Add/delete IP4/IP6 address for interface",
#define foreach_ip_interface_address(lm, a, sw_if_index, loop, body)
sll srl srl sll sra u16x4 i
void ip_del_all_interface_addresses(vlib_main_t *vm, u32 sw_if_index)
ip_lookup_main_t lookup_main
unformat_function_t unformat_vnet_sw_interface
static clib_error_t * ip4_cli_init(vlib_main_t *vm)
vnet_main_t * vnet_get_main(void)
#define VLIB_INIT_FUNCTION(x)
clib_error_t * ip4_add_del_interface_address(vlib_main_t *vm, u32 sw_if_index, ip4_address_t *address, u32 address_length, u32 is_del)
int ip6_address_compare(ip6_address_t *a1, ip6_address_t *a2)
#define vec_free(V)
Free vector's memory (no header).
static clib_error_t * add_del_ip_address(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define VLIB_CLI_COMMAND(x,...)
ip_lookup_main_t lookup_main
int ip4_address_compare(ip4_address_t *a1, ip4_address_t *a2)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
clib_error_t * ip6_add_del_interface_address(vlib_main_t *vm, u32 sw_if_index, ip6_address_t *address, u32 address_length, u32 is_del)
#define clib_error_return(e, args...)