aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/adj
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/adj')
-rw-r--r--src/vnet/adj/adj_glean.c22
-rw-r--r--src/vnet/adj/adj_glean.h1
-rw-r--r--src/vnet/adj/adj_nbr.c35
3 files changed, 50 insertions, 8 deletions
diff --git a/src/vnet/adj/adj_glean.c b/src/vnet/adj/adj_glean.c
index 8df104bd19d..e8ca043662f 100644
--- a/src/vnet/adj/adj_glean.c
+++ b/src/vnet/adj/adj_glean.c
@@ -187,12 +187,6 @@ adj_glean_update_rewrite_walk (adj_index_t ai,
}
void
-adj_glean_update_rewrite_itf (u32 sw_if_index)
-{
- adj_glean_walk (sw_if_index, adj_glean_update_rewrite_walk, NULL);
-}
-
-void
adj_glean_walk (u32 sw_if_index,
adj_walk_cb_t cb,
void *data)
@@ -425,6 +419,16 @@ adj_glean_interface_delete (vnet_main_t * vnm,
VNET_SW_INTERFACE_ADD_DEL_FUNCTION(adj_glean_interface_delete);
+/**
+ * Callback function invoked when an interface's MAC Address changes
+ */
+static void
+adj_glean_ethernet_change_mac (ethernet_main_t * em,
+ u32 sw_if_index, uword opaque)
+{
+ adj_glean_walk (sw_if_index, adj_glean_update_rewrite_walk, NULL);
+}
+
u8*
format_adj_glean (u8* s, va_list *ap)
{
@@ -509,4 +513,10 @@ void
adj_glean_module_init (void)
{
dpo_register(DPO_ADJACENCY_GLEAN, &adj_glean_dpo_vft, glean_nodes);
+
+ ethernet_address_change_ctx_t ctx = {
+ .function = adj_glean_ethernet_change_mac,
+ .function_opaque = 0,
+ };
+ vec_add1 (ethernet_main.address_change_callbacks, ctx);
}
diff --git a/src/vnet/adj/adj_glean.h b/src/vnet/adj/adj_glean.h
index a06b9e81616..9e25fd9c919 100644
--- a/src/vnet/adj/adj_glean.h
+++ b/src/vnet/adj/adj_glean.h
@@ -67,7 +67,6 @@ extern adj_index_t adj_glean_get(fib_protocol_t proto,
* glean behaviour on an adjacency liked to a connected prefix.
*/
extern void adj_glean_update_rewrite(adj_index_t adj_index);
-extern void adj_glean_update_rewrite_itf(u32 sw_if_index);
/**
* Return the source address from the glean
diff --git a/src/vnet/adj/adj_nbr.c b/src/vnet/adj/adj_nbr.c
index 3344d6e47cc..8524c6c83ae 100644
--- a/src/vnet/adj/adj_nbr.c
+++ b/src/vnet/adj/adj_nbr.c
@@ -910,13 +910,40 @@ adj_nbr_interface_add_del (vnet_main_t * vnm,
}
return (NULL);
-
}
VNET_SW_INTERFACE_ADD_DEL_FUNCTION(adj_nbr_interface_add_del);
static adj_walk_rc_t
+adj_nbr_ethernet_mac_change_one (adj_index_t ai,
+ void *arg)
+{
+ vnet_update_adjacency_for_sw_interface(vnet_get_main(),
+ adj_get_sw_if_index(ai),
+ ai);
+
+ return (ADJ_WALK_RC_CONTINUE);
+}
+
+/**
+ * Callback function invoked when an interface's MAC Address changes
+ */
+static void
+adj_nbr_ethernet_change_mac (ethernet_main_t * em,
+ u32 sw_if_index, uword opaque)
+{
+ fib_protocol_t proto;
+
+ FOR_EACH_FIB_IP_PROTOCOL(proto)
+ {
+ adj_nbr_walk(sw_if_index, proto,
+ adj_nbr_ethernet_mac_change_one,
+ NULL);
+ }
+}
+
+static adj_walk_rc_t
adj_nbr_show_one (adj_index_t ai,
void *arg)
{
@@ -1156,4 +1183,10 @@ adj_nbr_module_init (void)
dpo_register(DPO_ADJACENCY_INCOMPLETE,
&adj_nbr_incompl_dpo_vft,
nbr_incomplete_nodes);
+
+ ethernet_address_change_ctx_t ctx = {
+ .function = adj_nbr_ethernet_change_mac,
+ .function_opaque = 0,
+ };
+ vec_add1 (ethernet_main.address_change_callbacks, ctx);
}