src/utils/common/netio.h
src/utils/common/params.c
src/utils/common/params.h
+src/utils/common/quic.c
+src/utils/common/quic.h
src/utils/common/resolv.c
src/utils/common/resolv.h
src/utils/common/sign.c
Fast zone parser: ${enable_fastparser}
Utilities with IDN: ${with_libidn}
Utilities with DoH: ${with_libnghttp2}
+ Utilities with DoQ: ${with_libngtcp2}
Utilities with Dnstap: ${enable_dnstap}
MaxMind DB support: ${enable_maxminddb}
Systemd integration: ${enable_systemd}
utils/common/netio.h \
utils/common/params.c \
utils/common/params.h \
+ utils/common/quic.c \
+ utils/common/quic.h \
utils/common/resolv.c \
utils/common/resolv.h \
utils/common/sign.c \
-/* Copyright (C) 2020 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/* Copyright (C) 2022 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#define DEFAULT_IPV6_NAME "::1"
#define DEFAULT_DNS_PORT "53"
#define DEFAULT_DNS_HTTPS_PORT "443"
+#define DEFAULT_DNS_QUIC_PORT "853"
#define DEFAULT_DNS_TLS_PORT "853"
#define DEFAULT_UDP_SIZE 512
#define DEFAULT_EDNS_SIZE 4096
--- /dev/null
+/* Copyright (C) 2022 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#include <stddef.h>
+#include "libknot/errcode.h"
+#include "utils/common/quic.h"
+
+int quic_params_copy(quic_params_t *dst, const quic_params_t *src)
+{
+ if (dst == NULL || src == NULL) {
+ return KNOT_EINVAL;
+ }
+
+ dst->enable = src->enable;
+
+ return KNOT_EOK;
+}
+
+void quic_params_clean(quic_params_t *params)
+{
+ if (params == NULL) {
+ return;
+ }
+
+ params->enable = false;
+}
--- /dev/null
+/* Copyright (C) 2022 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include <stdbool.h>
+
+/*! \brief QUIC parameters. */
+typedef struct {
+ /*! Use QUIC indicator. */
+ bool enable;
+} quic_params_t;
+
+int quic_params_copy(quic_params_t *dst, const quic_params_t *src);
+
+void quic_params_clean(quic_params_t *params);
+
.show_footer = true
};
+static int opt_padding(const char *arg, void *query);
+
static int opt_multiline(const char *arg, void *query)
{
query_t *q = query;
#endif
}
+static int opt_quic(const char *arg, void *query)
+{
+#ifdef LIBNGTCP2
+ query_t *q = query;
+
+ q->quic.enable = true;
+
+ opt_tls(arg, query);
+ opt_notcp(arg, query);
+ opt_padding(arg, query);
+
+ return KNOT_EOK;
+#else
+ return KNOT_ENOTSUP;
+#endif //LIBNGTCP2
+}
+
+static int opt_noquic(const char *arg, void *query)
+{
+#ifdef LIBNGTCP2
+ query_t *q = query;
+
+ quic_params_clean(&q->quic);
+
+ return opt_notls(arg, query);
+#else
+ return KNOT_ENOTSUP;
+#endif //LIBNGTCP2
+}
+
static int opt_nsid(const char *arg, void *query)
{
query_t *q = query;
{ "https-get", ARG_NONE, opt_https_get },
{ "nohttps-get", ARG_NONE, opt_nohttps_get },
+ { "quic", ARG_NONE, opt_quic },
+ { "noquic", ARG_NONE, opt_noquic },
+
{ "nsid", ARG_NONE, opt_nsid },
{ "nonsid", ARG_NONE, opt_nonsid },
query->port = strdup(conf->port);
tls_params_copy(&query->tls, &conf->tls);
https_params_copy(&query->https, &conf->https);
+ quic_params_copy(&query->quic, &conf->quic);
if (conf->tsig_key.name != NULL) {
int ret = knot_tsig_key_copy(&query->tsig_key,
&conf->tsig_key);
tls_params_clean(&query->tls);
https_params_clean(&query->https);
+ quic_params_clean(&query->quic);
// Cleanup signing key.
knot_tsig_key_deinit(&query->tsig_key);
def_port = conf->port;
} else if (query->https.enable) {
def_port = DEFAULT_DNS_HTTPS_PORT;
+ } else if (query->quic.enable) {
+ def_port = DEFAULT_DNS_QUIC_PORT;
} else if (query->tls.enable) {
def_port = DEFAULT_DNS_TLS_PORT;
} else {
" +[no]https[=URL] Use HTTPS protocol. It's also possible to specify\n"
" URL as [authority][/path] where query will be sent.\n"
" +[no]https-get Use HTTPS protocol with GET method instead of POST.\n"
+#endif
+#ifdef LIBNGTCP2
+ " +[no]quic Use QUIC protocol.\n"
#endif
" +[no]nsid Request NSID.\n"
" +[no]bufsize=B Set EDNS buffer size.\n"
-/* Copyright (C) 2021 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/* Copyright (C) 2022 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "utils/common/params.h"
#include "utils/common/exec.h"
#include "utils/common/https.h"
+#include "utils/common/quic.h"
#include "utils/common/sign.h"
#include "libknot/libknot.h"
#include "contrib/sockaddr.h"
tls_params_t tls;
/*!< HTTPS parameters. */
https_params_t https;
+ /*!< QUIC parameters. */
+ quic_params_t quic;
/*!< Transaction signature. */
knot_tsig_key_t tsig_key;
/*!< EDNS client subnet. */