aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsrc/vnet/ip/ip4_forward.c50
-rw-r--r--src/vnet/ip/ip6_forward.c39
-rw-r--r--src/vnet/ip/lookup.h3
3 files changed, 48 insertions, 44 deletions
diff --git a/src/vnet/ip/ip4_forward.c b/src/vnet/ip/ip4_forward.c
index d86f22ca984..f4ecc395ab1 100755
--- a/src/vnet/ip/ip4_forward.c
+++ b/src/vnet/ip/ip4_forward.c
@@ -717,28 +717,23 @@ ip4_add_interface_routes (u32 sw_if_index,
.fp_addr.ip4 = *address,
};
- a->neighbor_probe_adj_index = ~0;
-
if (pfx.fp_len <= 30)
{
/* a /30 or shorter - add a glean for the network address */
- fib_node_index_t fei;
-
- fei = fib_table_entry_update_one_path (fib_index, &pfx,
- FIB_SOURCE_INTERFACE,
- (FIB_ENTRY_FLAG_CONNECTED |
- FIB_ENTRY_FLAG_ATTACHED),
- FIB_PROTOCOL_IP4,
- /* No next-hop address */
- NULL,
- sw_if_index,
- // invalid FIB index
- ~0,
- 1,
- // no out-label stack
- NULL,
- FIB_ROUTE_PATH_FLAG_NONE);
- a->neighbor_probe_adj_index = fib_entry_get_adj (fei);
+ fib_table_entry_update_one_path (fib_index, &pfx,
+ FIB_SOURCE_INTERFACE,
+ (FIB_ENTRY_FLAG_CONNECTED |
+ FIB_ENTRY_FLAG_ATTACHED),
+ FIB_PROTOCOL_IP4,
+ /* No next-hop address */
+ NULL,
+ sw_if_index,
+ // invalid FIB index
+ ~0,
+ 1,
+ // no out-label stack
+ NULL,
+ FIB_ROUTE_PATH_FLAG_NONE);
/* Add the two broadcast addresses as drop */
fib_prefix_t net_pfx = {
@@ -2269,6 +2264,7 @@ ip4_probe_neighbor (vlib_main_t * vm, ip4_address_t * dst, u32 sw_if_index)
vnet_hw_interface_t *hi;
vnet_sw_interface_t *si;
vlib_buffer_t *b;
+ adj_index_t ai;
u32 bi = 0;
si = vnet_get_sw_interface (vnm, sw_if_index);
@@ -2293,12 +2289,17 @@ ip4_probe_neighbor (vlib_main_t * vm, ip4_address_t * dst, u32 sw_if_index)
sw_if_index);
}
- adj = adj_get (ia->neighbor_probe_adj_index);
+ ip46_address_t nh = {
+ .ip4 = *dst,
+ };
+
+ ai = adj_nbr_add_or_lock (FIB_PROTOCOL_IP4,
+ VNET_LINK_IP4, &nh, sw_if_index);
+ adj = adj_get (ai);
- h =
- vlib_packet_template_get_packet (vm,
- &im->ip4_arp_request_packet_template,
- &bi);
+ h = vlib_packet_template_get_packet (vm,
+ &im->ip4_arp_request_packet_template,
+ &bi);
hi = vnet_get_sup_hw_interface (vnm, sw_if_index);
@@ -2324,6 +2325,7 @@ ip4_probe_neighbor (vlib_main_t * vm, ip4_address_t * dst, u32 sw_if_index)
vlib_put_frame_to_node (vm, hi->output_node_index, f);
}
+ adj_unlock (ai);
return /* no error */ 0;
}
diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c
index 28c84d1c2ee..17a4a6dd34b 100644
--- a/src/vnet/ip/ip6_forward.c
+++ b/src/vnet/ip/ip6_forward.c
@@ -347,24 +347,20 @@ ip6_add_interface_routes (vnet_main_t * vnm, u32 sw_if_index,
.fp_addr.ip6 = *address,
};
- a->neighbor_probe_adj_index = ~0;
if (a->address_length < 128)
{
- fib_node_index_t fei;
-
- fei = fib_table_entry_update_one_path (fib_index,
- &pfx,
- FIB_SOURCE_INTERFACE,
- (FIB_ENTRY_FLAG_CONNECTED |
- FIB_ENTRY_FLAG_ATTACHED),
- FIB_PROTOCOL_IP6,
- /* No next-hop address */
- NULL, sw_if_index,
- /* invalid FIB index */
- ~0, 1,
- /* no label stack */
- NULL, FIB_ROUTE_PATH_FLAG_NONE);
- a->neighbor_probe_adj_index = fib_entry_get_adj (fei);
+ fib_table_entry_update_one_path (fib_index,
+ &pfx,
+ FIB_SOURCE_INTERFACE,
+ (FIB_ENTRY_FLAG_CONNECTED |
+ FIB_ENTRY_FLAG_ATTACHED),
+ FIB_PROTOCOL_IP6,
+ /* No next-hop address */
+ NULL, sw_if_index,
+ /* invalid FIB index */
+ ~0, 1,
+ /* no label stack */
+ NULL, FIB_ROUTE_PATH_FLAG_NONE);
}
pfx.fp_len = 128;
@@ -1854,6 +1850,7 @@ ip6_probe_neighbor (vlib_main_t * vm, ip6_address_t * dst, u32 sw_if_index)
vnet_hw_interface_t *hi;
vnet_sw_interface_t *si;
vlib_buffer_t *b;
+ adj_index_t ai;
u32 bi = 0;
int bogus_length;
@@ -1906,7 +1903,14 @@ ip6_probe_neighbor (vlib_main_t * vm, ip6_address_t * dst, u32 sw_if_index)
vnet_buffer (b)->sw_if_index[VLIB_TX] = sw_if_index;
/* Add encapsulation string for software interface (e.g. ethernet header). */
- adj = adj_get (ia->neighbor_probe_adj_index);
+ ip46_address_t nh = {
+ .ip6 = *dst,
+ };
+
+ ai = adj_nbr_add_or_lock (FIB_PROTOCOL_IP6,
+ VNET_LINK_IP6, &nh, sw_if_index);
+ adj = adj_get (ai);
+
vnet_rewrite_one_header (adj[0], h, sizeof (ethernet_header_t));
vlib_buffer_advance (b, -adj->rewrite_header.data_bytes);
@@ -1918,6 +1922,7 @@ ip6_probe_neighbor (vlib_main_t * vm, ip6_address_t * dst, u32 sw_if_index)
vlib_put_frame_to_node (vm, hi->output_node_index, f);
}
+ adj_unlock (ai);
return /* no error */ 0;
}
diff --git a/src/vnet/ip/lookup.h b/src/vnet/ip/lookup.h
index 90c6a25573f..28a4bd8f755 100644
--- a/src/vnet/ip/lookup.h
+++ b/src/vnet/ip/lookup.h
@@ -93,9 +93,6 @@ typedef struct
/* Interface which has this address. */
u32 sw_if_index;
- /* Adjacency for neighbor probe (ARP) for this interface address. */
- u32 neighbor_probe_adj_index;
-
/* Address (prefix) length for this interface. */
u16 address_length;
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524