From 959613b5d7fbb8fadcd96853585268ffc33b3593 Mon Sep 17 00:00:00 2001 From: Alexander Chernavin Date: Thu, 24 Jun 2021 10:46:19 -0400 Subject: linux-cp: stop managing adjacencies for tunnels Type: fix Outbound packets which arrive on tun/L3 interfaces use a default adjacency for the interface & address family from the corresponding interface pair. However, there are entries in the linux-cp adj table that are created for them. Managing these entries might cause a segfault because the rewrite data might exceed the reserved space for it of 28 bytes in the linux-cp adj key (e.g. in case of GRE IPv6). With this change, stop creating adjacencies for tun/L3 interfaces in the linux-cp adj table and delegating them. Signed-off-by: Alexander Chernavin Change-Id: I4bcd685860053ab87c65064c182e3ed53fd4fae9 --- src/plugins/linux-cp/lcp_adj.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/plugins/linux-cp/lcp_adj.c b/src/plugins/linux-cp/lcp_adj.c index cbeb91a75a1..bfbc2fec913 100644 --- a/src/plugins/linux-cp/lcp_adj.c +++ b/src/plugins/linux-cp/lcp_adj.c @@ -14,6 +14,8 @@ */ #include + +#include #include #include @@ -133,9 +135,19 @@ lcp_adj_delegate_adj_created (adj_index_t ai) lcp_adj_kv_t kv; index_t lai = INDEX_INVALID; lcp_adj_key_t *adj_key; + index_t lipi; + lcp_itf_pair_t *lip; adj = adj_get (ai); + lipi = lcp_itf_pair_find_by_phy (adj->rewrite_header.sw_if_index); + if (lipi == INDEX_INVALID) + return; + + lip = lcp_itf_pair_get (lipi); + if (lip->lip_host_type == LCP_ITF_HOST_TUN) + return; + if (IP_LOOKUP_NEXT_REWRITE == adj->lookup_next_index) { lcp_adj_mk_key_adj (adj, &kv.k); -- cgit 1.2.3-korg