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++)
130 u32 sw_if_index, length, is_del;
145 if (is_del &&
unformat (input,
"all"))
181 .path =
"set interface ip address",
183 .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
static vlib_main_t * vlib_get_main(void)
void ip_del_all_interface_addresses(vlib_main_t *vm, u32 sw_if_index)
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_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)
VNET_HW_INTERFACE_ADD_DEL_FUNCTION(ip_address_delete_cleanup)
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)
static clib_error_t * ip_address_delete_cleanup(vnet_main_t *vnm, u32 hw_if_index, u32 is_create)
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)
ip_lookup_main_t lookup_main
int ip4_address_compare(ip4_address_t *a1, ip4_address_t *a2)
VLIB_CLI_COMMAND(set_interface_ip_source_and_port_range_check_command, static)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
ip4_main_t ip4_main
Global ip4 main structure.
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...)