summaryrefslogtreecommitdiffstats
path: root/src/vnet/fib/fib_entry_src.c
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2019-07-17 14:47:23 +0200
committerNeale Ranns <nranns@cisco.com>2019-07-28 14:24:29 +0000
commit99c358d62ab5106c710da23c563cd1b529a68f5a (patch)
treea5e6caca1de068ddbff136d5a7bf3b01cb790601 /src/vnet/fib/fib_entry_src.c
parent3cf9e67f5963e5f317e849892a6ec55be70a782d (diff)
fib: add invalid source type and fix debug log
Add the FIB_SOURCE_INVALID fib source type. This allows to spot uninitialized fib source more easily (0 no longer means special) and we can use it as placeholder when no source is present. Use it to fix FIB_ENTRY_DBG() which was accessing the 1st source, even when no sources were present. Type: fix Fixes: 710071bf0e Change-Id: I980b6a6a07616d4a8d6f2db166a1dd335721c74d Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/vnet/fib/fib_entry_src.c')
-rw-r--r--src/vnet/fib/fib_entry_src.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/vnet/fib/fib_entry_src.c b/src/vnet/fib/fib_entry_src.c
index 067733f0a8d..6ed13a328bd 100644
--- a/src/vnet/fib/fib_entry_src.c
+++ b/src/vnet/fib/fib_entry_src.c
@@ -1827,27 +1827,22 @@ fib_entry_get_flags_for_source (fib_node_index_t entry_index,
return (FIB_ENTRY_FLAG_NONE);
}
+fib_source_t
+fib_entry_get_source_i (const fib_entry_t *fib_entry)
+{
+ /* the vector of sources is deliberately arranged in priority order */
+ if (0 == vec_len(fib_entry->fe_srcs))
+ return (FIB_SOURCE_INVALID);
+ return (vec_elt(fib_entry->fe_srcs, 0).fes_src);
+}
+
fib_entry_flag_t
fib_entry_get_flags_i (const fib_entry_t *fib_entry)
{
- fib_entry_flag_t flags;
-
- /*
- * the vector of sources is deliberately arranged in priority order
- */
+ /* the vector of sources is deliberately arranged in priority order */
if (0 == vec_len(fib_entry->fe_srcs))
- {
- flags = FIB_ENTRY_FLAG_NONE;
- }
- else
- {
- fib_entry_src_t *esrc;
-
- esrc = vec_elt_at_index(fib_entry->fe_srcs, 0);
- flags = esrc->fes_entry_flags;
- }
-
- return (flags);
+ return (FIB_ENTRY_FLAG_NONE);
+ return (vec_elt(fib_entry->fe_srcs, 0).fes_entry_flags);
}
void