aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/adj
diff options
context:
space:
mode:
authorNeale Ranns <neale@graphiant.com>2021-10-08 07:16:12 +0000
committerNeale Ranns <neale@graphiant.com>2021-11-15 08:42:26 +0000
commit50bd1d3e256154212198a31932896b07af5b129f (patch)
tree020ead7393316f8229f0f592f6cc8e1bc2daf6c0 /src/vnet/adj
parent8d76ccf9cca5991d2f9b18035989ccb0baca1798 (diff)
fib: re-evaluate the import/export state of a prefix.
Type: fix re-evaluate the import/export state of a prefix when the interface it is attached to rebinds to a different table. Only attached routes have import/export requirements, so we can back walk from the glean adjacency when the interface rebinds tables. There are two cases to consider. 1. the rebind may change the prefix from/to import 2. the import VRF may change Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: I25b6af43b3b2d8f701dfbe7a08710dc56b3f5778
Diffstat (limited to 'src/vnet/adj')
-rw-r--r--src/vnet/adj/adj_glean.c60
1 files changed, 59 insertions, 1 deletions
diff --git a/src/vnet/adj/adj_glean.c b/src/vnet/adj/adj_glean.c
index e8ca043662f..45477649c1a 100644
--- a/src/vnet/adj/adj_glean.c
+++ b/src/vnet/adj/adj_glean.c
@@ -424,11 +424,59 @@ VNET_SW_INTERFACE_ADD_DEL_FUNCTION(adj_glean_interface_delete);
*/
static void
adj_glean_ethernet_change_mac (ethernet_main_t * em,
- u32 sw_if_index, uword opaque)
+ u32 sw_if_index,
+ uword opaque)
{
adj_glean_walk (sw_if_index, adj_glean_update_rewrite_walk, NULL);
}
+static void
+adj_glean_table_bind (fib_protocol_t fproto,
+ u32 sw_if_index,
+ u32 itf_fib_index)
+{
+ /*
+ * for each glean on the interface trigger a walk back to the children
+ */
+ fib_node_back_walk_ctx_t bw_ctx = {
+ .fnbw_reason = FIB_NODE_BW_REASON_FLAG_INTERFACE_BIND,
+ .interface_bind = {
+ .fnbw_to_fib_index = itf_fib_index,
+ },
+ };
+
+ adj_glean_walk (sw_if_index, adj_glean_start_backwalk, &bw_ctx);
+}
+
+
+/**
+ * Callback function invoked when an interface's IPv6 Table
+ * binding changes
+ */
+static void
+adj_glean_ip6_table_bind (ip6_main_t * im,
+ uword opaque,
+ u32 sw_if_index,
+ u32 new_fib_index,
+ u32 old_fib_index)
+{
+ adj_glean_table_bind (FIB_PROTOCOL_IP6, sw_if_index, new_fib_index);
+}
+
+/**
+ * Callback function invoked when an interface's IPv4 Table
+ * binding changes
+ */
+static void
+adj_glean_ip4_table_bind (ip4_main_t * im,
+ uword opaque,
+ u32 sw_if_index,
+ u32 new_fib_index,
+ u32 old_fib_index)
+{
+ adj_glean_table_bind (FIB_PROTOCOL_IP4, sw_if_index, new_fib_index);
+}
+
u8*
format_adj_glean (u8* s, va_list *ap)
{
@@ -519,4 +567,14 @@ adj_glean_module_init (void)
.function_opaque = 0,
};
vec_add1 (ethernet_main.address_change_callbacks, ctx);
+
+ ip6_table_bind_callback_t cbt6 = {
+ .function = adj_glean_ip6_table_bind,
+ };
+ vec_add1 (ip6_main.table_bind_callbacks, cbt6);
+
+ ip4_table_bind_callback_t cbt4 = {
+ .function = adj_glean_ip4_table_bind,
+ };
+ vec_add1 (ip4_main.table_bind_callbacks, cbt4);
}