aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/fib/fib_entry_src_interface.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/vnet/fib/fib_entry_src_interface.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/vnet/fib/fib_entry_src_interface.c')
-rw-r--r--src/vnet/fib/fib_entry_src_interface.c88
1 files changed, 61 insertions, 27 deletions
diff --git a/src/vnet/fib/fib_entry_src_interface.c b/src/vnet/fib/fib_entry_src_interface.c
index e1725773d93..402369d1dfc 100644
--- a/src/vnet/fib/fib_entry_src_interface.c
+++ b/src/vnet/fib/fib_entry_src_interface.c
@@ -48,45 +48,72 @@ static void
fib_entry_src_interface_remove (fib_entry_src_t *src)
{
src->fes_pl = FIB_NODE_INDEX_INVALID;
+ ASSERT(src->u.interface.fesi_sibling == ~0);
}
-static void
-fib_entry_src_interface_path_swap (fib_entry_src_t *src,
- const fib_entry_t *entry,
- fib_path_list_flags_t pl_flags,
- const fib_route_path_t *paths)
+static int
+fib_entry_src_interface_update_glean (fib_entry_t *cover,
+ const fib_entry_t *local)
{
- fib_node_index_t fib_entry_index;
- ip_adjacency_t *adj;
+ fib_entry_src_t *src;
+ adj_index_t ai;
- fib_entry_index = fib_entry_get_index(entry);
- src->fes_pl = fib_path_list_create(pl_flags, paths);
+ src = fib_entry_src_find (cover, FIB_SOURCE_INTERFACE);
- /*
- * this is a hack to get the entry's prefix into the glean adjacency
- * so that it is available for fast retrieval in the switch path.
- */
- if (!(FIB_ENTRY_FLAG_LOCAL & src->fes_entry_flags))
+ if (NULL == src)
{
- adj_index_t ai;
+ /*
+ * The cover is not an interface source, no work
+ */
+ return 0;
+ }
- ai = fib_path_list_get_adj(src->fes_pl,
- fib_entry_get_default_chain_type(
- fib_entry_get(fib_entry_index)));
- if (INDEX_INVALID != ai)
- {
- adj = adj_get(ai);
+ ai = fib_path_list_get_adj(src->fes_pl,
+ fib_entry_get_default_chain_type(cover));
+
+ if (INDEX_INVALID != ai)
+ {
+ ip_adjacency_t *adj;
+
+ adj = adj_get(ai);
- if (IP_LOOKUP_NEXT_GLEAN == adj->lookup_next_index)
+ if (IP_LOOKUP_NEXT_GLEAN == adj->lookup_next_index)
+ {
+ /*
+ * the connected prefix will link to a glean on a non-p2p
+ * interface.
+ * Ensure we are updating with a host in the connected's subnet
+ */
+ if (fib_prefix_is_cover(&adj->sub_type.glean.rx_pfx,
+ &local->fe_prefix))
{
- /*
- * the connected prefix will link to a glean on a non-p2p
- * u.interface.
- */
- adj->sub_type.glean.receive_addr = entry->fe_prefix.fp_addr;
+ adj->sub_type.glean.rx_pfx.fp_addr = local->fe_prefix.fp_addr;
+ return (1);
}
}
}
+
+ return (0);
+}
+
+static walk_rc_t
+fib_entry_src_interface_update_glean_walk (fib_entry_t *cover,
+ fib_node_index_t covered,
+ void *ctx)
+{
+ if (fib_entry_src_interface_update_glean(cover, fib_entry_get(covered)))
+ return (WALK_STOP);
+
+ return (WALK_CONTINUE);
+}
+
+static void
+fib_entry_src_interface_path_swap (fib_entry_src_t *src,
+ const fib_entry_t *entry,
+ fib_path_list_flags_t pl_flags,
+ const fib_route_path_t *paths)
+{
+ src->fes_pl = fib_path_list_create(pl_flags, paths);
}
/*
@@ -116,6 +143,8 @@ fib_entry_src_interface_activate (fib_entry_src_t *src,
src->u.interface.fesi_sibling =
fib_entry_cover_track(cover, fib_entry_get_index(fib_entry));
+
+ fib_entry_src_interface_update_glean(cover, fib_entry);
}
return (!0);
@@ -142,6 +171,11 @@ fib_entry_src_interface_deactivate (fib_entry_src_t *src,
fib_entry_cover_untrack(cover, src->u.interface.fesi_sibling);
src->u.interface.fesi_cover = FIB_NODE_INDEX_INVALID;
+ src->u.interface.fesi_sibling = ~0;
+
+ fib_entry_cover_walk(cover,
+ fib_entry_src_interface_update_glean_walk,
+ NULL);
}
}