25 void *addr_fib,
u32 address_length)
39 u32 address_length,
u32 * result_if_address_index)
48 if ((address_length == 0) ||
49 (lm->
is_ip6 && address_length > 128) ||
50 (!lm->
is_ip6 && address_length > 32))
52 vnm->
api_errno = VNET_API_ERROR_ADDRESS_LENGTH_MISMATCH;
54 (
"%U wrong length for interface %U",
68 while (pi != (
u32) ~ 0)
88 *result_if_address_index = ai;
96 u32 address_index,
void *addr_fib,
105 vnm->
api_errno = VNET_API_ERROR_ADDRESS_NOT_FOUND_FOR_INTERFACE;
108 addr_fib, address_length,
217 ia->flags |= IP_INTERFACE_ADDRESS_FLAG_STALE;
221 ia->flags |= IP_INTERFACE_ADDRESS_FLAG_STALE;
241 ip6_address_t *ip6_addrs = 0;
252 if (ia->flags & IP_INTERFACE_ADDRESS_FLAG_STALE)
254 ip4_address_t * x = (ip4_address_t *)
255 ip_interface_address_get_address (&im4->lookup_main, ia);
256 vec_add1 (ip4_addrs, x[0]);
257 vec_add1 (ip4_masks, ia->address_length);
263 if (ia->flags & IP_INTERFACE_ADDRESS_FLAG_STALE)
265 ip6_address_t * x = (ip6_address_t *)
266 ip_interface_address_get_address (&im6->lookup_main, ia);
267 vec_add1 (ip6_addrs, x[0]);
268 vec_add1 (ip6_masks, ia->address_length);
273 for (i = 0; i <
vec_len (ip4_addrs); i++)
276 for (i = 0; i <
vec_len (ip6_addrs); i++)
u8 ip_interface_has_address(u32 sw_if_index, ip46_address_t *ip, u8 is_ip4)
ip_interface_address_t * if_address_pool
Pool of addresses that are assigned to interfaces.
vnet_main_t * vnet_get_main(void)
#define pool_get_zero(P, E)
Allocate an object E from a pool P and zero it.
void ip_interface_address_mark(void)
void * ip_interface_get_first_ip(u32 sw_if_index, u8 is_ip4)
static void * ip_interface_address_get_address(ip_lookup_main_t *lm, ip_interface_address_t *a)
uword mhash_unset(mhash_t *h, void *key, uword *old_value)
ip_lookup_main_t lookup_main
mhash_t address_to_if_address_index
Hash table mapping address to index in interface address pool.
format_function_t format_vnet_sw_if_index_name
enum walk_rc_t_ walk_rc_t
Walk return code.
vl_api_interface_index_t sw_if_index
#define clib_error_create(args...)
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)
vnet_api_error_t api_errno
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static walk_rc_t ip_interface_address_mark_one_interface(vnet_main_t *vnm, vnet_sw_interface_t *si, void *ctx)
void vnet_sw_interface_walk(vnet_main_t *vnm, vnet_sw_interface_walk_t fn, void *ctx)
Walk all the SW interfaces in the system.
#define pool_put(P, E)
Free an object E in pool P.
int ip6_address_compare(ip6_address_t *a1, ip6_address_t *a2)
ip_interface_address_flags_t flags
static uword mhash_set(mhash_t *h, void *key, uword new_value, uword *old_value)
u32 ip_interface_address_find(ip_lookup_main_t *lm, void *addr_fib, u32 address_length)
void ip_interface_address_sweep(void)
int ip4_address_compare(ip4_address_t *a1, ip4_address_t *a2)
sll srl srl sll sra u16x4 i
#define vec_free(V)
Free vector's memory (no header).
clib_error_t * ip_interface_address_add(ip_lookup_main_t *lm, u32 sw_if_index, void *addr_fib, u32 address_length, u32 *result_if_address_index)
clib_error_t * ip_interface_address_del(ip_lookup_main_t *lm, vnet_main_t *vnm, u32 address_index, void *addr_fib, u32 address_length, u32 sw_if_index)
u32 * if_address_pool_index_by_sw_if_index
Head of doubly linked list of interface addresses for each software interface.
static uword * mhash_get(mhash_t *h, const void *key)
ip_lookup_main_t lookup_main
static uword ip6_address_is_link_local_unicast(const ip6_address_t *a)
static vlib_main_t * vlib_get_main(void)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define foreach_ip_interface_address(lm, a, sw_if_index, loop, body)
u32 is_ip6
1 for ip6; 0 for ip4.
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 vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
static walk_rc_t ip_interface_address_sweep_one_interface(vnet_main_t *vnm, vnet_sw_interface_t *si, void *ctx)
u32 next_this_sw_interface
format_function_t * format_address_and_length
Either format_ip4_address_and_length or format_ip6_address_and_length.
u32 prev_this_sw_interface