diff options
author | Nathan Skrzypczak <nathan.skrzypczak@gmail.com> | 2021-04-06 17:58:18 +0200 |
---|---|---|
committer | Beno�t Ganne <bganne@cisco.com> | 2021-04-21 14:50:24 +0000 |
commit | 832926bd9666717ff2310f93981f3383e1de5ab6 (patch) | |
tree | 2511115e328a080384473515ee1ec84992eae320 /src | |
parent | 1fbf034e3ea97d507e41420248c99da7bdc916bf (diff) |
cnat: Fix session flag initialization
Type: fix
Sometimes session->value.flags wasn't initialized
leading to next_node index corruption.
Also added a debug flag to tell session/rsessions appart
Change-Id: I80da50f2267e03a4552e8c9efc8e3aa08bc5569d
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/cnat/cnat_node.h | 2 | ||||
-rw-r--r-- | src/plugins/cnat/cnat_node_feature.c | 1 | ||||
-rw-r--r-- | src/plugins/cnat/cnat_node_vip.c | 1 | ||||
-rw-r--r-- | src/plugins/cnat/cnat_session.h | 5 |
4 files changed, 8 insertions, 1 deletions
diff --git a/src/plugins/cnat/cnat_node.h b/src/plugins/cnat/cnat_node.h index 157287b0cab..246fdb8ba57 100644 --- a/src/plugins/cnat/cnat_node.h +++ b/src/plugins/cnat/cnat_node.h @@ -922,7 +922,7 @@ cnat_session_create (cnat_session_t *session, cnat_node_ctx_t *ctx, &session->key.cs_ip[VLIB_RX]); rsession->value.cs_ts_index = session->value.cs_ts_index; rsession->value.cs_lbi = INDEX_INVALID; - rsession->value.flags = rsession_flags; + rsession->value.flags = rsession_flags | CNAT_SESSION_IS_RETURN; rsession->value.cs_port[VLIB_TX] = session->key.cs_port[VLIB_RX]; rsession->value.cs_port[VLIB_RX] = session->key.cs_port[VLIB_TX]; diff --git a/src/plugins/cnat/cnat_node_feature.c b/src/plugins/cnat/cnat_node_feature.c index f9b6fa2a40d..aced4cd0a15 100644 --- a/src/plugins/cnat/cnat_node_feature.c +++ b/src/plugins/cnat/cnat_node_feature.c @@ -125,6 +125,7 @@ cnat_input_feature_fn (vlib_main_t *vm, vlib_node_runtime_t *node, session->value.cs_port[VLIB_TX] = clib_host_to_net_u16 (trk0->ct_ep[VLIB_TX].ce_port); session->value.cs_port[VLIB_RX] = udp0->src_port; + session->value.flags = 0; if (trk0->ct_flags & CNAT_TRK_FLAG_NO_NAT) { diff --git a/src/plugins/cnat/cnat_node_vip.c b/src/plugins/cnat/cnat_node_vip.c index f0a4ad7d84e..f166bd4f194 100644 --- a/src/plugins/cnat/cnat_node_vip.c +++ b/src/plugins/cnat/cnat_node_vip.c @@ -148,6 +148,7 @@ cnat_vip_node_fn (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_buffer_t *b, session->value.dpoi_next_node = ct->ct_lb.dpoi_next_node; session->value.cs_lbi = dpoi_index; + session->value.flags = 0; rv = cspm->vip_policy (vm, b, session, &rsession_flags, ct, ctx); if (CNAT_SOURCE_ERROR_USE_DEFAULT == rv) diff --git a/src/plugins/cnat/cnat_session.h b/src/plugins/cnat/cnat_session.h index 51764504bca..072bb10f96f 100644 --- a/src/plugins/cnat/cnat_session.h +++ b/src/plugins/cnat/cnat_session.h @@ -123,7 +123,12 @@ typedef enum cnat_session_flag_t_ */ CNAT_SESSION_FLAG_NO_CLIENT = (1 << 2), + /* Do not actually translate the packet but still forward it + * Used for Maglev, with an encap */ CNAT_SESSION_FLAG_NO_NAT = (1 << 3), + + /* Debug flag marking return sessions */ + CNAT_SESSION_IS_RETURN = (1 << 4), } cnat_session_flag_t; typedef enum cnat_session_location_t_ |