aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-04-03 00:58:48 +0000
committerDave Barach <openvpp@barachs.net>2020-04-03 14:57:12 +0000
commitd85666fdfd49a2b0a3ce5166c22c9efadf6ca239 (patch)
tree128ed23230deee135908280bbac44649ebba1a4f
parent888d9f05eff1801cbd6c5227eb22e464d3a117c3 (diff)
session udp: fix transport flags and migration
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I840d43e79b1f826380bd56485441510e45bdfc7f
-rw-r--r--src/plugins/hs_apps/sapi/vpp_echo_proto_quic.c2
-rw-r--r--src/plugins/quic/quic.c8
-rw-r--r--src/vcl/vcl_private.h2
-rw-r--r--src/vnet/session/session_node.c2
-rw-r--r--src/vnet/session/transport_types.h1
-rw-r--r--src/vnet/udp/udp.c6
-rw-r--r--src/vnet/udp/udp.h2
7 files changed, 15 insertions, 8 deletions
diff --git a/src/plugins/hs_apps/sapi/vpp_echo_proto_quic.c b/src/plugins/hs_apps/sapi/vpp_echo_proto_quic.c
index 5da81ccf4e9..95a468c0ef2 100644
--- a/src/plugins/hs_apps/sapi/vpp_echo_proto_quic.c
+++ b/src/plugins/hs_apps/sapi/vpp_echo_proto_quic.c
@@ -461,7 +461,7 @@ quic_echo_process_opts_cb (unformat_input_t * a)
else if (unformat (a, "quic-setup %U", quic_echo_unformat_setup_vft))
;
else if (unformat (a, "uni"))
- em->connect_flag = SESSION_F_UNIDIRECTIONAL;
+ em->connect_flag = TRANSPORT_CFG_F_UNIDIRECTIONAL;
else if (unformat (a, "qclose=%U",
echo_unformat_close, &eqm->send_quic_disconnects))
;
diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c
index 8689583c27f..14002a253d7 100644
--- a/src/plugins/quic/quic.c
+++ b/src/plugins/quic/quic.c
@@ -1182,6 +1182,7 @@ quic_connect_stream (session_t * quic_session, session_endpoint_cfg_t * sep)
app_worker_t *app_wrk;
quic_ctx_t *qctx, *sctx;
u32 sctx_index;
+ u8 is_unidir;
int rv;
/* Find base session to which the user want to attach a stream */
@@ -1225,9 +1226,8 @@ quic_connect_stream (session_t * quic_session, session_endpoint_cfg_t * sep)
if (!conn || !quicly_connection_is_ready (conn))
return -1;
- if ((rv =
- quicly_open_stream (conn, &stream,
- sep->flags & SESSION_F_UNIDIRECTIONAL)))
+ is_unidir = sep->transport_flags & TRANSPORT_CFG_F_UNIDIRECTIONAL;
+ if ((rv = quicly_open_stream (conn, &stream, is_unidir)))
{
QUIC_DBG (2, "Stream open failed with %d", rv);
return -1;
@@ -1246,7 +1246,7 @@ quic_connect_stream (session_t * quic_session, session_endpoint_cfg_t * sep)
stream_session->listener_handle = quic_session_handle;
stream_session->session_type =
session_type_from_proto_and_ip (TRANSPORT_PROTO_QUIC, qctx->udp_is_ip4);
- if (sep->flags & SESSION_F_UNIDIRECTIONAL)
+ if (is_unidir)
stream_session->flags |= SESSION_F_UNIDIRECTIONAL;
sctx->c_s_index = stream_session->session_index;
diff --git a/src/vcl/vcl_private.h b/src/vcl/vcl_private.h
index 433e08e2b46..38818d2d356 100644
--- a/src/vcl/vcl_private.h
+++ b/src/vcl/vcl_private.h
@@ -151,7 +151,7 @@ do { \
typedef enum vcl_session_flags_
{
- VCL_SESSION_F_CONNECTED,
+ VCL_SESSION_F_CONNECTED = 1 << 0,
} __clib_packed vcl_session_flags_t;
typedef struct
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index 7d727b7e008..0290fe69544 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -125,7 +125,7 @@ session_mq_connect_handler (void *data)
a->sep_ext.parent_handle = mp->parent_handle;
a->sep_ext.ckpair_index = mp->ckpair_index;
a->sep_ext.crypto_engine = mp->crypto_engine;
- a->sep_ext.flags = mp->flags;
+ a->sep_ext.transport_flags = mp->flags;
if (mp->hostname_len)
{
vec_validate (a->sep_ext.hostname, mp->hostname_len - 1);
diff --git a/src/vnet/session/transport_types.h b/src/vnet/session/transport_types.h
index b97955f5671..e065ed1fa59 100644
--- a/src/vnet/session/transport_types.h
+++ b/src/vnet/session/transport_types.h
@@ -195,6 +195,7 @@ typedef struct transport_endpoint_
typedef enum transport_endpt_cfg_flags_
{
TRANSPORT_CFG_F_CONNECTED = 1 << 0,
+ TRANSPORT_CFG_F_UNIDIRECTIONAL = 1 << 1,
} transport_endpt_cfg_flags_t;
#define foreach_transport_endpoint_cfg_fields \
diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c
index ba1821a5026..3632204f863 100644
--- a/src/vnet/udp/udp.c
+++ b/src/vnet/udp/udp.c
@@ -284,7 +284,11 @@ udp_session_cleanup (u32 connection_index, u32 thread_index)
{
udp_connection_t *uc;
uc = udp_connection_get (connection_index, thread_index);
- if (uc)
+ if (!uc)
+ return;
+ if (uc->flags & UDP_CONN_F_MIGRATED)
+ udp_connection_free (uc);
+ else
udp_connection_cleanup (uc);
}
diff --git a/src/vnet/udp/udp.h b/src/vnet/udp/udp.h
index 736e3ce94f1..9e1aad6fbe5 100644
--- a/src/vnet/udp/udp.h
+++ b/src/vnet/udp/udp.h
@@ -39,6 +39,7 @@ typedef enum
_(OWNS_PORT, "OWNS_PORT") /**< port belong to conn (UDPC) */ \
_(CLOSING, "CLOSING") /**< conn closed with data */ \
_(LISTEN, "LISTEN") /**< conn is listening */ \
+ _(MIGRATED, "MIGRATED") /**< cloned to another thread */ \
enum udp_conn_flags_bits
{
@@ -258,6 +259,7 @@ udp_connection_clone_safe (u32 connection_index, u32 thread_index)
udp_pool_add_peeker (thread_index);
old_c = udp_main.connections[thread_index] + connection_index;
clib_memcpy_fast (new_c, old_c, sizeof (*new_c));
+ old_c->flags |= UDP_CONN_F_MIGRATED;
udp_pool_remove_peeker (thread_index);
new_c->c_thread_index = current_thread_index;
new_c->c_c_index = udp_connection_index (new_c);