summaryrefslogtreecommitdiffstats
path: root/src/plugins/ping/ping.c
diff options
context:
space:
mode:
authorNeale Ranns <neale.ranns@cisco.com>2020-11-26 08:37:27 +0000
committerOle Tr�an <otroan@employees.org>2020-12-08 09:00:24 +0000
commite2fe097424fb169dfe01421ff17b8ccd0c26b4a6 (patch)
tree2d9993f78d9165c1aba23b1daa4067106da81b45 /src/plugins/ping/ping.c
parent9b8cb5082471dd670066b8ba2872ffbcc35a87f8 (diff)
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 <neale.ranns@cisco.com> Change-Id: I0f3dd1edb1f3fc965af1c7c586709028eb9cdeac
Diffstat (limited to 'src/plugins/ping/ping.c')
-rw-r--r--src/plugins/ping/ping.c18
1 files changed, 8 insertions, 10 deletions
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 <vlib/vlib.h>
#include <vnet/fib/ip6_fib.h>
#include <vnet/fib/ip4_fib.h>
-#include <vnet/fib/fib_entry.h>
+#include <vnet/fib/fib_sas.h>
#include <vnet/ip/ip6_link.h>
#include <vnet/plugin/plugin.h>
#include <vpp/app/version.h>
@@ -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;
}