quic: add conn-timeout config option
Type: feature
Change-Id: Ia9cb57b9f7c2d14a137556d6918763f1cb11850d
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c
index 6b9f1e1..983358e 100644
--- a/src/plugins/quic/quic.c
+++ b/src/plugins/quic/quic.c
@@ -101,6 +101,7 @@
quicly_ctx->transport_params.max_data = QUIC_INT_MAX;
quicly_ctx->transport_params.max_streams_uni = (uint64_t) 1 << 60;
quicly_ctx->transport_params.max_streams_bidi = (uint64_t) 1 << 60;
+ quicly_ctx->transport_params.idle_timeout = qm->connection_timeout;
/* max_enq is FIFO_SIZE - 1 */
max_enq = app->sm_properties.rx_fifo_size - 1;
@@ -141,7 +142,6 @@
return VNET_API_ERROR_MISSING_CERT_KEY;
}
-
/* Helper functions */
static u32
@@ -1706,7 +1706,6 @@
return 0;
}
-
/*
* Returns 0 if a matching connection is found and is on the right thread.
* Otherwise returns -1.
@@ -2360,24 +2359,27 @@
{
quic_main_t *qm = &quic_main;
uword tmp;
+ u32 i;
qm->udp_fifo_size = QUIC_DEFAULT_FIFO_SIZE;
qm->udp_fifo_prealloc = 0;
+ qm->connection_timeout = QUIC_DEFAULT_CONN_TIMEOUT;
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
if (unformat (input, "fifo-size %U", unformat_memory_size, &tmp))
{
if (tmp >= 0x100000000ULL)
{
- return clib_error_return
- (0, "fifo-size %llu (0x%llx) too large", tmp, tmp);
+ return clib_error_return (0,
+ "fifo-size %llu (0x%llx) too large",
+ tmp, tmp);
}
qm->udp_fifo_size = tmp;
}
- else
- if (unformat
- (input, "fifo-prealloc %u", &quic_main.udp_fifo_prealloc))
- ;
+ else if (unformat (input, "conn-timeout %u", &i))
+ qm->connection_timeout = i;
+ else if (unformat (input, "fifo-prealloc %u", &i))
+ qm->udp_fifo_prealloc = i;
else
return clib_error_return (0, "unknown input '%U'",
format_unformat_error, input);
diff --git a/src/plugins/quic/quic.h b/src/plugins/quic/quic.h
index 56817bc..dfcb0e6 100644
--- a/src/plugins/quic/quic.h
+++ b/src/plugins/quic/quic.h
@@ -43,6 +43,7 @@
#define QUIC_SEND_MAX_BATCH_PACKETS 16
#define QUIC_RCV_MAX_BATCH_PACKETS 16
+#define QUIC_DEFAULT_CONN_TIMEOUT (30 * 1000) /* 30 seconds */
/* Taken from quicly.c */
#define QUICLY_QUIC_BIT 0x40
@@ -216,6 +217,7 @@
u32 udp_fifo_size;
u32 udp_fifo_prealloc;
+ u32 connection_timeout;
} quic_main_t;
#endif /* __included_quic_h__ */