aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorNeale Ranns <neale.ranns@cisco.com>2020-10-26 10:44:54 +0000
committerDave Barach <openvpp@barachs.net>2020-10-26 13:39:06 +0000
commitcc4f7e1bd75e383e6e9d065c4556118efbc4dcec (patch)
tree5deee459537a06cac5f37d36d15d30c3fd178b91 /src/vnet
parent4d7ad4a6cc08e316d78de5ac7ce3ead4e9bfcb66 (diff)
fib: API to extract any resolving interface rather than the one from the
best source Type: improvement Signed-off-by: Neale Ranns <neale.ranns@cisco.com> Change-Id: Iaa91cbc7eba94f4ffbdc249ecdb49770bd2ae916
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/arp/arp.c2
-rw-r--r--src/vnet/fib/fib_entry.c21
-rw-r--r--src/vnet/fib/fib_entry.h1
3 files changed, 23 insertions, 1 deletions
diff --git a/src/vnet/arp/arp.c b/src/vnet/arp/arp.c
index 6a32229adda..8b57376522d 100644
--- a/src/vnet/arp/arp.c
+++ b/src/vnet/arp/arp.c
@@ -543,7 +543,7 @@ arp_reply (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
dst_fei = ip4_fib_table_lookup (ip4_fib_get (fib_index0),
&arp0->ip4_over_ethernet[1].ip4,
32);
- conn_sw_if_index0 = fib_entry_get_resolving_interface (dst_fei);
+ conn_sw_if_index0 = fib_entry_get_any_resolving_interface (dst_fei);
switch (arp_dst_fib_check (dst_fei, &dst_flags))
{
diff --git a/src/vnet/fib/fib_entry.c b/src/vnet/fib/fib_entry.c
index a8dec1a8c20..33c29a6e33c 100644
--- a/src/vnet/fib/fib_entry.c
+++ b/src/vnet/fib/fib_entry.c
@@ -1464,6 +1464,27 @@ fib_entry_get_resolving_interface (fib_node_index_t entry_index)
return (fib_path_list_get_resolving_interface(fib_entry->fe_parent));
}
+u32
+fib_entry_get_any_resolving_interface (fib_node_index_t entry_index)
+{
+ const fib_entry_src_t *src;
+ fib_entry_t *fib_entry;
+ fib_source_t source;
+ u32 sw_if_index;
+
+ fib_entry = fib_entry_get(entry_index);
+
+ FOR_EACH_SRC_ADDED(fib_entry, src, source,
+ ({
+ sw_if_index = fib_entry_get_resolving_interface_for_source (entry_index,
+ source);
+
+ if (~0 != sw_if_index)
+ break;
+ }));
+ return (sw_if_index);
+}
+
fib_source_t
fib_entry_get_best_source (fib_node_index_t entry_index)
{
diff --git a/src/vnet/fib/fib_entry.h b/src/vnet/fib/fib_entry.h
index b97c80fd8bf..4053ff65181 100644
--- a/src/vnet/fib/fib_entry.h
+++ b/src/vnet/fib/fib_entry.h
@@ -440,6 +440,7 @@ extern u32 fib_entry_child_add(fib_node_index_t fib_entry_index,
extern void fib_entry_child_remove(fib_node_index_t fib_entry_index,
u32 sibling_index);
extern u32 fib_entry_get_resolving_interface(fib_node_index_t fib_entry_index);
+extern u32 fib_entry_get_any_resolving_interface(fib_node_index_t fib_entry_index);
extern u32 fib_entry_get_resolving_interface_for_source(
fib_node_index_t fib_entry_index,
fib_source_t source);