aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/fib
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/fib
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/fib')
-rw-r--r--src/vnet/fib/fib_entry.c21
-rw-r--r--src/vnet/fib/fib_entry.h1
2 files changed, 22 insertions, 0 deletions
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);