From 9260b8861e62fb9bb0c9dfb5a89c9636ef9a05e2 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Tue, 4 Oct 2022 18:08:51 +0200 Subject: fib: add fib_entry_get_path_list_for_source Type: improvement Change-Id: Ie035bebf64226691cffc84484e4bf7310287d1b7 Signed-off-by: Damjan Marion --- src/vnet/fib/fib_entry.h | 3 +++ src/vnet/fib/fib_entry_src.c | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) (limited to 'src/vnet/fib') diff --git a/src/vnet/fib/fib_entry.h b/src/vnet/fib/fib_entry.h index 4053ff65181..223928354b7 100644 --- a/src/vnet/fib/fib_entry.h +++ b/src/vnet/fib/fib_entry.h @@ -421,6 +421,9 @@ extern const int fib_entry_get_dpo_for_source ( fib_node_index_t fib_entry_index, fib_source_t source, dpo_id_t *dpo); +extern fib_node_index_t fib_entry_get_path_list_for_source ( + fib_node_index_t fib_entry_index, + fib_source_t source); extern adj_index_t fib_entry_get_adj(fib_node_index_t fib_entry_index); diff --git a/src/vnet/fib/fib_entry_src.c b/src/vnet/fib/fib_entry_src.c index 39e719e6a7a..ff81f6bcddd 100644 --- a/src/vnet/fib/fib_entry_src.c +++ b/src/vnet/fib/fib_entry_src.c @@ -1797,6 +1797,25 @@ fib_entry_get_dpo_for_source (fib_node_index_t fib_entry_index, return (0); } +fib_node_index_t +fib_entry_get_path_list_for_source (fib_node_index_t fib_entry_index, + fib_source_t source) +{ + fib_entry_t *fib_entry; + fib_entry_src_t *esrc; + + if (FIB_NODE_INDEX_INVALID == fib_entry_index) + return FIB_NODE_INDEX_INVALID; + + fib_entry = fib_entry_get(fib_entry_index); + esrc = fib_entry_src_find(fib_entry, source); + + if (esrc) + return esrc->fes_pl; + + return FIB_NODE_INDEX_INVALID; +} + u32 fib_entry_get_resolving_interface_for_source (fib_node_index_t entry_index, fib_source_t source) -- cgit 1.2.3-korg