From e2fe097424fb169dfe01421ff17b8ccd0c26b4a6 Mon Sep 17 00:00:00 2001 From: Neale Ranns Date: Thu, 26 Nov 2020 08:37:27 +0000 Subject: fib: Source Address Selection Type: feature Use the FIB to provide SAS (in so far as it is today) - Use the glean adjacency as the record of the connected prefixes = there's a glean per-{interface, protocol, connected-prefix} - Keep the glean up to date with whatever the recieve host prefix is (since it can change) Signed-off-by: Neale Ranns Change-Id: I0f3dd1edb1f3fc965af1c7c586709028eb9cdeac --- src/plugins/ping/ping.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src/plugins/ping/ping.c') diff --git a/src/plugins/ping/ping.c b/src/plugins/ping/ping.c index 0ce4f9698f0..98add533407 100644 --- a/src/plugins/ping/ping.c +++ b/src/plugins/ping/ping.c @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include #include @@ -725,24 +725,22 @@ ip46_fill_l3_header (ip46_address_t * pa46, vlib_buffer_t * b0, int is_ip6) } } -static int +static bool ip46_set_src_address (u32 sw_if_index, vlib_buffer_t * b0, int is_ip6) { - int res; + bool res = false; + if (is_ip6) { ip6_header_t *ip6 = vlib_buffer_get_current (b0); - res = ip6_src_address_for_packet (sw_if_index, - &ip6->dst_address, &ip6->src_address); + + res = fib_sas6_get (sw_if_index, &ip6->dst_address, &ip6->src_address); } else { - ip4_main_t *im = &ip4_main; ip4_header_t *ip4 = vlib_buffer_get_current (b0); - res = ip4_src_address_for_packet (&im->lookup_main, - sw_if_index, &ip4->src_address); - /* IP4 and IP6 paths have the inverse logic. Harmonize. */ - res = !res; + + res = fib_sas4_get (sw_if_index, &ip4->dst_address, &ip4->src_address); } return res; } -- cgit 1.2.3-korg