X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fadj%2Fadj_nbr.c;h=3f73ff9f1d2e1c7ce81b184758ddf9649d7bed7c;hb=ae8098350cb7b96f7495fa4d4180238064256e14;hp=3f66acbb5c5ff94505836b83ef079a7afb82c4b8;hpb=d723161e038d00e59766aa67a6a0dcc350227e4b;p=vpp.git diff --git a/src/vnet/adj/adj_nbr.c b/src/vnet/adj/adj_nbr.c index 3f66acbb5c5..3f73ff9f1d2 100644 --- a/src/vnet/adj/adj_nbr.c +++ b/src/vnet/adj/adj_nbr.c @@ -18,6 +18,8 @@ #include #include +#include + /* * Vector Hash tables of neighbour (traditional) adjacencies * Key: interface(for the vector index), address (and its proto), @@ -59,7 +61,7 @@ adj_nbr_insert (fib_protocol_t nh_proto, adj_nbr_tables[nh_proto][sw_if_index] = clib_mem_alloc_aligned(sizeof(BVT(clib_bihash)), CLIB_CACHE_LINE_BYTES); - memset(adj_nbr_tables[nh_proto][sw_if_index], + clib_memset(adj_nbr_tables[nh_proto][sw_if_index], 0, sizeof(BVT(clib_bihash))); @@ -195,6 +197,8 @@ adj_nbr_alloc (fib_protocol_t nh_proto, adj->ia_link = link_type; adj->ia_nh_proto = nh_proto; adj->rewrite_header.sw_if_index = sw_if_index; + vnet_rewrite_update_mtu(vnet_get_main(), adj->ia_link, + &adj->rewrite_header); adj_nbr_evaluate_feature (adj_get_index(adj)); return (adj); @@ -230,6 +234,11 @@ adj_nbr_add_or_lock (fib_protocol_t nh_proto, adj_index = adj_get_index(adj); adj_lock(adj_index); + if (ip46_address_is_equal(&ADJ_BCAST_ADDR, nh_addr)) + { + adj->lookup_next_index = IP_LOOKUP_NEXT_BCAST; + } + vnet_rewrite_init(vnm, sw_if_index, link_type, adj_get_nd_node(nh_proto), vnet_tx_node_index_for_sw_interface(vnm, sw_if_index), @@ -258,26 +267,24 @@ adj_nbr_add_or_lock_w_rewrite (fib_protocol_t nh_proto, u8 *rewrite) { adj_index_t adj_index; - ip_adjacency_t *adj; adj_index = adj_nbr_find(nh_proto, link_type, nh_addr, sw_if_index); if (ADJ_INDEX_INVALID == adj_index) { - adj = adj_nbr_alloc(nh_proto, link_type, nh_addr, sw_if_index); + ip_adjacency_t *adj; + + adj = adj_nbr_alloc(nh_proto, link_type, nh_addr, sw_if_index); adj->rewrite_header.sw_if_index = sw_if_index; - } - else - { - adj = adj_get(adj_index); + adj_index = adj_get_index(adj); } - adj_lock(adj_get_index(adj)); - adj_nbr_update_rewrite(adj_get_index(adj), + adj_lock(adj_index); + adj_nbr_update_rewrite(adj_index, ADJ_NBR_REWRITE_FLAG_COMPLETE, rewrite); - return (adj_get_index(adj)); + return (adj_index); } /** @@ -694,7 +701,6 @@ adj_nbr_interface_state_change_one (adj_index_t ai, * since this is the walk that provides convergence */ adj_nbr_interface_state_change_ctx_t *ctx = arg; - fib_node_back_walk_ctx_t bw_ctx = { .fnbw_reason = ((ctx->flags & ADJ_NBR_INTERFACE_UP) ? FIB_NODE_BW_REASON_FLAG_INTERFACE_UP : @@ -706,10 +712,15 @@ adj_nbr_interface_state_change_one (adj_index_t ai, */ .fnbw_flags = (!(ctx->flags & ADJ_NBR_INTERFACE_UP) ? FIB_NODE_BW_FLAG_FORCE_SYNC : - 0), + FIB_NODE_BW_FLAG_NONE), }; + ip_adjacency_t *adj; + adj = adj_get(ai); + + adj->ia_flags |= ADJ_FLAG_SYNC_WALK_ACTIVE; fib_walk_sync(FIB_NODE_TYPE_ADJ, ai, &bw_ctx); + adj->ia_flags &= ~ADJ_FLAG_SYNC_WALK_ACTIVE; return (ADJ_WALK_RC_CONTINUE); } @@ -810,8 +821,13 @@ adj_nbr_interface_delete_one (adj_index_t ai, fib_node_back_walk_ctx_t bw_ctx = { .fnbw_reason = FIB_NODE_BW_REASON_FLAG_INTERFACE_DELETE, }; + ip_adjacency_t *adj; + + adj = adj_get(ai); + adj->ia_flags |= ADJ_FLAG_SYNC_WALK_ACTIVE; fib_walk_sync(FIB_NODE_TYPE_ADJ, ai, &bw_ctx); + adj->ia_flags &= ~ADJ_FLAG_SYNC_WALK_ACTIVE; return (ADJ_WALK_RC_CONTINUE); }