X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fadj%2Fadj_nbr.c;h=7acdccc72b09c10e4151212de05c0db027795adf;hb=d88fc0fcedb402e3dc82cb44280d4567a6a13266;hp=9e990e00f3b12553835f96ad666a867dac0902fb;hpb=37157d52794f7f5774435d7bd524e3f998213a8a;p=vpp.git diff --git a/src/vnet/adj/adj_nbr.c b/src/vnet/adj/adj_nbr.c index 9e990e00f3b..7acdccc72b0 100644 --- a/src/vnet/adj/adj_nbr.c +++ b/src/vnet/adj/adj_nbr.c @@ -452,6 +452,12 @@ adj_nbr_update_rewrite_internal (ip_adjacency_t *adj, }; fib_walk_sync(FIB_NODE_TYPE_ADJ, walk_ai, &bw_ctx); + /* + * fib_walk_sync may allocate a new adjacency and potentially cuase a + * realloc for adj_pool. When that happens, adj pointer is no longer + * valid here. We refresh the adj pointer accordingly. + */ + adj = adj_get (ai); } /* @@ -907,15 +913,19 @@ adj_nbr_show (vlib_main_t * vm, vlib_cli_command_t * cmd) { adj_index_t ai = ADJ_INDEX_INVALID; + ip46_address_t nh = ip46_address_initializer; u32 sw_if_index = ~0; while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT) { - if (unformat (input, "%d", &ai)) + if (unformat (input, "%U", + unformat_vnet_sw_interface, vnet_get_main(), + &sw_if_index)) ; else if (unformat (input, "%U", - unformat_vnet_sw_interface, vnet_get_main(), - &sw_if_index)) + unformat_ip46_address, &nh, IP46_TYPE_ANY)) + ; + else if (unformat (input, "%d", &ai)) ; else break; @@ -932,12 +942,24 @@ adj_nbr_show (vlib_main_t * vm, { fib_protocol_t proto; - for (proto = FIB_PROTOCOL_IP4; proto <= FIB_PROTOCOL_IP6; proto++) - { - adj_nbr_walk(sw_if_index, proto, - adj_nbr_show_one, - vm); - } + if (ip46_address_is_zero(&nh)) + { + for (proto = FIB_PROTOCOL_IP4; proto <= FIB_PROTOCOL_IP6; proto++) + { + adj_nbr_walk(sw_if_index, proto, + adj_nbr_show_one, + vm); + } + } + else + { + proto = (ip46_address_is_ip4(&nh) ? + FIB_PROTOCOL_IP4 : + FIB_PROTOCOL_IP6); + adj_nbr_walk_nh(sw_if_index, proto, &nh, + adj_nbr_show_one, + vm); + } } else {