diff options
Diffstat (limited to 'src/vnet/ip')
-rw-r--r-- | src/vnet/ip/ip6_neighbor.c | 8 | ||||
-rw-r--r-- | src/vnet/ip/lookup.h | 23 |
2 files changed, 21 insertions, 10 deletions
diff --git a/src/vnet/ip/ip6_neighbor.c b/src/vnet/ip/ip6_neighbor.c index 92708f14d5b..edc670af3b0 100644 --- a/src/vnet/ip/ip6_neighbor.c +++ b/src/vnet/ip/ip6_neighbor.c @@ -273,7 +273,8 @@ ip6_neighbor_sw_interface_up_down (vnet_main_t * vnm, { n = pool_elt_at_index (nm->neighbor_pool, to_delete[i]); mhash_unset (&nm->neighbor_index_by_key, &n->key, 0); - fib_table_entry_delete_index (n->fib_entry_index, FIB_SOURCE_ADJ); + if (FIB_NODE_INDEX_INVALID != n->fib_entry_index) + fib_table_entry_delete_index (n->fib_entry_index, FIB_SOURCE_ADJ); pool_put (nm->neighbor_pool, n); } @@ -609,6 +610,7 @@ vnet_set_ip6_ethernet_neighbor (vlib_main_t * vm, mhash_set (&nm->neighbor_index_by_key, &k, n - nm->neighbor_pool, /* old value */ 0); n->key = k; + n->fib_entry_index = FIB_NODE_INDEX_INVALID; clib_memcpy (n->link_layer_address, link_layer_address, n_bytes_link_layer_address); @@ -746,7 +748,9 @@ vnet_unset_ip6_ethernet_neighbor (vlib_main_t * vm, adj_nbr_walk_nh6 (sw_if_index, &n->key.ip6_address, ip6_nd_mk_incomplete_walk, NULL); - fib_table_entry_delete_index (n->fib_entry_index, FIB_SOURCE_ADJ); + + if (FIB_NODE_INDEX_INVALID != n->fib_entry_index) + fib_table_entry_delete_index (n->fib_entry_index, FIB_SOURCE_ADJ); pool_put (nm->neighbor_pool, n); out: diff --git a/src/vnet/ip/lookup.h b/src/vnet/ip/lookup.h index 48360b5b41f..0fc2a992a0f 100644 --- a/src/vnet/ip/lookup.h +++ b/src/vnet/ip/lookup.h @@ -416,7 +416,7 @@ ip_interface_address_get_address (ip_lookup_main_t * lm, /* *INDENT-OFF* */ #define foreach_ip_interface_address(lm,a,sw_if_index,loop,body) \ do { \ - vnet_main_t *_vnm = vnet_get_main(); \ + 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); \ @@ -424,13 +424,20 @@ do { \ /* \ * Loop => honor unnumbered interface addressing. \ */ \ - if (loop && _swif->flags & VNET_SW_INTERFACE_FLAG_UNNUMBERED) \ - _sw_if_index = _swif->unnumbered_sw_if_index; \ - 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; \ + 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) \ { \ |