]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
server/quic: re-configure table parameters while running
authorLibor Peltan <libor.peltan@nic.cz>
Fri, 25 Aug 2023 09:41:09 +0000 (11:41 +0200)
committerDaniel Salzman <daniel.salzman@nic.cz>
Fri, 25 Aug 2023 13:36:05 +0000 (15:36 +0200)
src/knot/server/quic-handler.c
src/knot/server/quic-handler.h
src/knot/server/udp-handler.c
src/knot/server/xdp-handler.c

index 2664b6b92181824912ae9c32e155746592e91365..57a3856da5db47a69ff655390e954912e04d70b7 100644 (file)
@@ -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) {
index 7f7715f77a76aa7f15942aad948bcbf7a6bc23b1..12b2b47c123f71dc12dbebdfc895cee0654349cf 100644 (file)
@@ -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.
  *
index 0305b1554a1f91498d9f5f19afd7fc71aad77acd..6ae8b02ff21012d5b1033c3e6ffb11be6717b7cf 100644 (file)
@@ -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
 }
 
index 2dbd8fb0950823118345a194f9969a6da3974c87..ec9e02f17ac41d31543d2177b718f6fd06592744 100644 (file)
@@ -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) {