*/
#include <vnet/ip-neighbor/ip6_neighbor.h>
+#include <vnet/util/throttle.h>
+#include <vnet/fib/fib_sas.h>
+
+/** ND throttling */
+static throttle_t nd_throttle;
void
-ip6_neighbor_probe_dst (const ip_adjacency_t * adj, const ip6_address_t * dst)
+ip6_neighbor_probe_dst (u32 sw_if_index, const ip6_address_t * dst)
{
- ip_interface_address_t *ia;
- ip6_address_t *src;
-
- src = ip6_interface_address_matching_destination
- (&ip6_main, dst, adj->rewrite_header.sw_if_index, &ia);
-
- if (!src)
- return;
+ ip6_address_t src;
- ip6_neighbor_probe (vlib_get_main (), vnet_get_main (), adj, src, dst);
+ if (fib_sas6_get (sw_if_index, dst, &src))
+ ip6_neighbor_probe (vlib_get_main (), vnet_get_main (),
+ sw_if_index, &src, dst);
}
void
vlib_frame_t * frame, int is_glean)
{
vnet_main_t *vnm = vnet_get_main ();
- ip6_main_t *im = &ip6_main;
u32 *from, *to_next_drop;
uword n_left_from, n_left_to_next_drop;
u64 seed;
if (node->flags & VLIB_NODE_FLAG_TRACE)
ip6_forward_next_trace (vm, node, frame, VLIB_TX);
- seed = throttle_seed (&im->nd_throttle, thread_index, vlib_time_now (vm));
+ seed = throttle_seed (&nd_throttle, thread_index, vlib_time_now (vm));
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
/* combine the address and interface for a hash */
r0 = ip6_address_hash_to_u64 (&ip0->dst_address) ^ sw_if_index0;
- drop0 = throttle_check (&im->nd_throttle, thread_index, r0, seed);
+ drop0 = throttle_check (&nd_throttle, thread_index, r0, seed);
from += 1;
n_left_from -= 1;
* Choose source address based on destination lookup
* adjacency.
*/
- if (!ip6_src_address_for_packet (sw_if_index0,
- &ip0->dst_address, &src))
+ if (!fib_sas6_get (sw_if_index0, &ip0->dst_address, &src))
{
/* There is no address on the interface */
p0->error = node->errors[IP6_NBR_ERROR_NO_SOURCE_ADDRESS];
continue;
}
- b0 = ip6_neighbor_probe (vm, vnm, adj0, &src, &ip0->dst_address);
+ b0 = ip6_neighbor_probe (vm, vnm, sw_if_index0,
+ &src, &ip0->dst_address);
if (PREDICT_TRUE (NULL != b0))
{
VLIB_INIT_FUNCTION (ip6_neighbor_init);
+static clib_error_t *
+ip6_nd_main_loop_enter (vlib_main_t * vm)
+{
+ vlib_thread_main_t *tm = &vlib_thread_main;
+
+ throttle_init (&nd_throttle, tm->n_vlib_mains, 1e-3);
+
+ return 0;
+}
+
+VLIB_MAIN_LOOP_ENTER_FUNCTION (ip6_nd_main_loop_enter);
+
/*
* fd.io coding-style-patch-verification: ON
*