-always_inline ip_interface_address_t *
-ip_get_interface_address (ip_lookup_main_t * lm, void *addr_fib)
-{
- uword *p = mhash_get (&lm->address_to_if_address_index, addr_fib);
- return p ? pool_elt_at_index (lm->if_address_pool, p[0]) : 0;
-}
-
-always_inline void *
-ip_interface_address_get_address (ip_lookup_main_t * lm,
- ip_interface_address_t * a)
-{
- return mhash_key_to_mem (&lm->address_to_if_address_index, a->address_key);
-}
-
-/* *INDENT-OFF* */
-#define foreach_ip_interface_address(lm,a,sw_if_index,loop,body) \
-do { \
- vnet_main_t *_vnm = vnet_get_main(); \
- u32 _sw_if_index = sw_if_index; \
- vnet_sw_interface_t *_swif; \
- _swif = vnet_get_sw_interface (_vnm, _sw_if_index); \
- \
- /* \
- * Loop => honor unnumbered interface addressing. \
- */ \
- if (_swif->flags & VNET_SW_INTERFACE_FLAG_UNNUMBERED) \
- { \
- if (loop) \
- _sw_if_index = _swif->unnumbered_sw_if_index; \
- else \
- /* the interface is unnumbered, by the caller does not want \
- * unnumbered interfaces considered/honoured */ \
- break; \
- } \
- u32 _ia = ((vec_len((lm)->if_address_pool_index_by_sw_if_index) \
- > (_sw_if_index)) ? \
- vec_elt ((lm)->if_address_pool_index_by_sw_if_index, \
- (_sw_if_index)) : \
- (u32)~0); \
- ip_interface_address_t * _a; \
- while (_ia != ~0) \
- { \
- _a = pool_elt_at_index ((lm)->if_address_pool, _ia); \
- _ia = _a->next_this_sw_interface; \
- (a) = _a; \
- body; \
- } \
-} while (0)
-/* *INDENT-ON* */