From: Libor Peltan Date: Fri, 25 Aug 2023 09:41:09 +0000 (+0200) Subject: server/quic: re-configure table parameters while running X-Git-Tag: v3.4.dev~8^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f10637d0e35bb9161bf7dd791bd2ea3c08da7e61;p=thirdparty%2Fknot-dns.git server/quic: re-configure table parameters while running --- diff --git a/src/knot/server/quic-handler.c b/src/knot/server/quic-handler.c index 2664b6b921..57a3856da5 100644 --- a/src/knot/server/quic-handler.c +++ b/src/knot/server/quic-handler.c @@ -111,6 +111,21 @@ knot_quic_table_t *quic_make_table(struct server *server) return table; } +void quic_reconfigure_table(knot_quic_table_t *table) +{ + if (table != NULL) { + conf_t *pconf = conf(); + size_t udp_pl = MIN(pconf->cache.srv_udp_max_payload_ipv4, + pconf->cache.srv_udp_max_payload_ipv6); + table->udp_payload_limit = udp_pl; + + // it's also easy to re-configure inbuf and outbuf limits, but no need to yet + // but it's more difficult to re-configure table size (realloc...) + + table->log_cb = log_enabled_quic_debug() ? quic_log_cb : NULL; + } +} + void quic_sweep_table(knot_quic_table_t *table, knot_sweep_stats_t *stats) { if (table != NULL) { diff --git a/src/knot/server/quic-handler.h b/src/knot/server/quic-handler.h index 7f7715f77a..12b2b47c12 100644 --- a/src/knot/server/quic-handler.h +++ b/src/knot/server/quic-handler.h @@ -49,6 +49,13 @@ void quic_handler(knotd_qdata_params_t *params, knot_layer_t *layer, */ knot_quic_table_t *quic_make_table(struct server *server); +/*! + * \brief Change QUIC configuration while running. + * + * \param table QUIC connection table. + */ +void quic_reconfigure_table(knot_quic_table_t *table); + /*! * \brief Sweep idle or excessive QUIC connections. * diff --git a/src/knot/server/udp-handler.c b/src/knot/server/udp-handler.c index 0305b1554a..6ae8b02ff2 100644 --- a/src/knot/server/udp-handler.c +++ b/src/knot/server/udp-handler.c @@ -169,6 +169,7 @@ static void udp_sweep(udp_context_t *ctx, _unused_ void *d) { #ifdef ENABLE_QUIC quic_sweep_table(ctx->quic_table, &ctx->quic_closed); + quic_reconfigure_table(ctx->quic_table); #endif // ENABLE_QUIC } diff --git a/src/knot/server/xdp-handler.c b/src/knot/server/xdp-handler.c index 2dbd8fb095..ec9e02f17a 100644 --- a/src/knot/server/xdp-handler.c +++ b/src/knot/server/xdp-handler.c @@ -339,6 +339,7 @@ void xdp_handle_sweep(xdp_handle_ctx_t *ctx) { #ifdef ENABLE_QUIC quic_sweep_table(ctx->quic_table, &ctx->quic_closed); + quic_reconfigure_table(ctx->quic_table); #endif // ENABLE_QUIC if (!ctx->tcp) {