summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2020-12-04 10:23:34 +0100
committerBeno�t Ganne <bganne@cisco.com>2021-01-28 13:35:49 +0000
commit0c1792e983425216588e93cd98286ea61b5cbd02 (patch)
tree65f97a931059febfd179e663c93eb5c56313e929 /src
parent208891c093468b753830d1e7ebdb4a69d4c192bf (diff)
cnat: Fix session with deleted tr
Type: fix When a translation gets deleted, hiting a session pointing to it sefaults. We're better off directly storing the next node index. Change-Id: I4f0716d775202b4ecf54d6cdb827bbeebd23056c Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/cnat/cnat_node_vip.c5
-rw-r--r--src/plugins/cnat/cnat_session.h2
-rw-r--r--src/plugins/cnat/test/test_cnat.py5
3 files changed, 3 insertions, 9 deletions
diff --git a/src/plugins/cnat/cnat_node_vip.c b/src/plugins/cnat/cnat_node_vip.c
index ffe5899c0cf..02e6da4c2e9 100644
--- a/src/plugins/cnat/cnat_node_vip.c
+++ b/src/plugins/cnat/cnat_node_vip.c
@@ -114,8 +114,7 @@ cnat_vip_node_fn (vlib_main_t * vm,
if (INDEX_INVALID != session->value.cs_lbi)
{
/* Translate & follow the translation given LB */
- ct = cnat_translation_get (session->value.ct_index);
- next0 = ct->ct_lb.dpoi_next_node;
+ next0 = session->value.dpoi_next_node;
vnet_buffer (b)->ip.adj_index[VLIB_TX] = session->value.cs_lbi;
}
else if (session->value.flags & CNAT_SESSION_FLAG_HAS_SNAT)
@@ -193,7 +192,7 @@ cnat_vip_node_fn (vlib_main_t * vm,
session->value.cs_port[VLIB_RX] =
clib_host_to_net_u16 (trk0->ct_ep[VLIB_RX].ce_port);
- session->value.ct_index = ct - cnat_translation_pool;
+ session->value.dpoi_next_node = ct->ct_lb.dpoi_next_node;
session->value.cs_lbi = dpo0->dpoi_index;
rv = cspm->vip_policy (vm, b, session, &rsession_flags, ct, ctx);
diff --git a/src/plugins/cnat/cnat_session.h b/src/plugins/cnat/cnat_session.h
index e352fe6e374..fba28e5a241 100644
--- a/src/plugins/cnat/cnat_session.h
+++ b/src/plugins/cnat/cnat_session.h
@@ -102,7 +102,7 @@ typedef struct cnat_session_t_
* Persist translation->ct_lb.dpoi_next_node
* when cs_lbi != INDEX_INVALID
*/
- u32 ct_index;
+ u32 dpoi_next_node;
};
} value;
} cnat_session_t;
diff --git a/src/plugins/cnat/test/test_cnat.py b/src/plugins/cnat/test/test_cnat.py
index d46d047e558..271f5076942 100644
--- a/src/plugins/cnat/test/test_cnat.py
+++ b/src/plugins/cnat/test/test_cnat.py
@@ -271,11 +271,6 @@ class TestCNatTranslation(VppTestCase):
p1 * N_PKTS,
self.pg0)
- self.assertEqual(t1.get_stats()['packets'],
- N_PKTS *
- len(sports) *
- len(self.pg0.remote_hosts))
-
def cnat_test_translation_update(self, t1, sports, isV6=False):
ip_v = "ip6" if isV6 else "ip4"
ip_class = IPv6 if isV6 else IP