summaryrefslogtreecommitdiffstats
path: root/src/vnet/gre/interface.c
diff options
context:
space:
mode:
authorNeale Ranns <neale@graphiant.com>2021-03-15 14:42:30 +0000
committerNeale Ranns <neale@graphiant.com>2021-03-21 18:55:01 +0000
commitbd8e43dfa045b4aec4ecf4ad3e5503924b5c9c38 (patch)
treefe91b63cc88910c5497dd34a0f3c6e1d20a3ea9e /src/vnet/gre/interface.c
parent8d8150262b00435c365a43c8f859584901736aff (diff)
gre: Multipoint GRE fixes
Type: fix - the CLI was broken when a nh-table-id was present, since it overwrote the next-hop address - bouncing interface state stacked the adjacencies on the tunnel's destination (which is all zeros) - don't crash in the switch path if the interface has no hw-address Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: I1ba9fdc9b2185899b753a2d40f23afa847a3ef4f
Diffstat (limited to 'src/vnet/gre/interface.c')
-rw-r--r--src/vnet/gre/interface.c54
1 files changed, 53 insertions, 1 deletions
diff --git a/src/vnet/gre/interface.c b/src/vnet/gre/interface.c
index 30c8dc479c2..30dfa3057b1 100644
--- a/src/vnet/gre/interface.c
+++ b/src/vnet/gre/interface.c
@@ -156,6 +156,45 @@ gre_tunnel_stack (adj_index_t ai)
}
/**
+ * mgre_tunnel_stack
+ *
+ * 'stack' (resolve the recursion for) the tunnel's midchain adjacency
+ */
+static void
+mgre_tunnel_stack (adj_index_t ai)
+{
+ gre_main_t *gm = &gre_main;
+ const ip_adjacency_t *adj;
+ const gre_tunnel_t *gt;
+ u32 sw_if_index;
+
+ adj = adj_get (ai);
+ sw_if_index = adj->rewrite_header.sw_if_index;
+
+ if ((vec_len (gm->tunnel_index_by_sw_if_index) <= sw_if_index) ||
+ (~0 == gm->tunnel_index_by_sw_if_index[sw_if_index]))
+ return;
+
+ gt = pool_elt_at_index (gm->tunnels,
+ gm->tunnel_index_by_sw_if_index[sw_if_index]);
+
+ if ((vnet_hw_interface_get_flags (vnet_get_main (), gt->hw_if_index) &
+ VNET_HW_INTERFACE_FLAG_LINK_UP) == 0)
+ {
+ adj_midchain_delegate_unstack (ai);
+ }
+ else
+ {
+ const teib_entry_t *ne;
+
+ ne = teib_entry_find_46 (sw_if_index, adj->ia_nh_proto,
+ &adj->sub_type.nbr.next_hop);
+ if (NULL != ne)
+ teib_entry_adj_stack (ne, ai);
+ }
+}
+
+/**
* @brief Call back when restacking all adjacencies on a GRE interface
*/
static adj_walk_rc_t
@@ -165,6 +204,13 @@ gre_adj_walk_cb (adj_index_t ai, void *ctx)
return (ADJ_WALK_RC_CONTINUE);
}
+static adj_walk_rc_t
+mgre_adj_walk_cb (adj_index_t ai, void *ctx)
+{
+ mgre_tunnel_stack (ai);
+
+ return (ADJ_WALK_RC_CONTINUE);
+}
static void
gre_tunnel_restack (gre_tunnel_t * gt)
@@ -176,7 +222,13 @@ gre_tunnel_restack (gre_tunnel_t * gt)
*/
FOR_EACH_FIB_IP_PROTOCOL (proto)
{
- adj_nbr_walk (gt->sw_if_index, proto, gre_adj_walk_cb, NULL);
+ switch (gt->mode)
+ {
+ case TUNNEL_MODE_P2P:
+ return (adj_nbr_walk (gt->sw_if_index, proto, gre_adj_walk_cb, NULL));
+ case TUNNEL_MODE_MP:
+ return (adj_nbr_walk (gt->sw_if_index, proto, mgre_adj_walk_cb, NULL));
+ }
}
}