summaryrefslogtreecommitdiffstats
path: root/src/libknot
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 08:04:57 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 08:04:57 +0000
commit98e63d18fe85b29517ae8fb21ca94f37c7972652 (patch)
tree8de3b229d6a3a5062acdb3a970cc3c60bed6c07f /src/libknot
parentReleasing progress-linux version 3.3.4-1.1~progress7.99u1. (diff)
downloadknot-98e63d18fe85b29517ae8fb21ca94f37c7972652.tar.xz
knot-98e63d18fe85b29517ae8fb21ca94f37c7972652.zip
Merging upstream version 3.3.5.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/libknot')
-rw-r--r--src/libknot/errcode.h1
-rw-r--r--src/libknot/error.c1
-rw-r--r--src/libknot/rrset-dump.c8
-rw-r--r--src/libknot/rrset.h21
-rw-r--r--src/libknot/version.h2
-rw-r--r--src/libknot/xdp/protocols.h2
6 files changed, 29 insertions, 6 deletions
diff --git a/src/libknot/errcode.h b/src/libknot/errcode.h
index cf51b96..a9eb65c 100644
--- a/src/libknot/errcode.h
+++ b/src/libknot/errcode.h
@@ -174,6 +174,7 @@ enum knot_error {
KNOT_NO_PUBLIC_KEY,
KNOT_NO_PRIVATE_KEY,
KNOT_NO_READY_KEY,
+ KNOT_DNSSEC_EKEYTAG_LIMIT,
KNOT_ERROR_MAX = -501
};
diff --git a/src/libknot/error.c b/src/libknot/error.c
index d5802f2..a148ee7 100644
--- a/src/libknot/error.c
+++ b/src/libknot/error.c
@@ -173,6 +173,7 @@ static const struct error errors[] = {
{ KNOT_NO_PUBLIC_KEY, "no public key" },
{ KNOT_NO_PRIVATE_KEY, "no private key" },
{ KNOT_NO_READY_KEY, "no key ready for submission" },
+ { KNOT_DNSSEC_EKEYTAG_LIMIT, "many keys with equal keytag" },
/* Terminator */
{ KNOT_ERROR, NULL }
diff --git a/src/libknot/rrset-dump.c b/src/libknot/rrset-dump.c
index 7011a65..51a52dd 100644
--- a/src/libknot/rrset-dump.c
+++ b/src/libknot/rrset-dump.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2023 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/* Copyright (C) 2024 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
@@ -598,7 +598,7 @@ static void wire_text_to_str(rrset_dump_params_t *p, size_t in_len,
CHECK_INMAX(in_len)
// Check if quotation can ever be disabled (parser protection fallback).
- if (!quote) {
+ if (!quote && !alpn_mode) {
for (size_t i = 0; i < in_len; i++) {
if (p->in[i] == ' ') { // Other WS characters are encoded.
quote = true;
@@ -1515,7 +1515,11 @@ static void wire_svcparam_to_str(rrset_dump_params_t *p)
wire_value_list_to_str(p, wire_svcb_paramkey_to_str, p->in + val_len);
break;
case KNOT_SVCB_PARAM_ALPN:
+ dump_string(p, "\"");
+ CHECK_PRET
wire_value_list_to_str(p, wire_text_to_str_alpn, p->in + val_len);
+ dump_string(p, "\"");
+ CHECK_PRET
break;
case KNOT_SVCB_PARAM_NDALPN:
p->ret = -1; // must not have value
diff --git a/src/libknot/rrset.h b/src/libknot/rrset.h
index fdc5719..51efb74 100644
--- a/src/libknot/rrset.h
+++ b/src/libknot/rrset.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2019 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
+/* Copyright (C) 2024 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
@@ -185,10 +185,27 @@ bool knot_rrset_is_nsec3rel(const knot_rrset_t *rr);
int knot_rrset_rr_to_canonical(knot_rrset_t *rrset);
/*!
- * \brief Size of rrset in wire format.
+ * \brief Size of rrset in wire format (without compression).
*
* \retval size in bytes
*/
size_t knot_rrset_size(const knot_rrset_t *rrset);
+/*!
+ * \brief Fast estimate of knot_rrset_size(); it can return slightly larger values.
+ */
+inline static size_t knot_rrset_size_estimate(const knot_rrset_t *rrset)
+{
+ if (rrset == NULL) {
+ return 0;
+ }
+
+ /* 8B = TYPE + CLASS + TTL + RDLENGTH - sizeof(knot_rdata_t::len)
+ * We over-estimate by the count of padding bytes (<= rrset->rrs.count) */
+ size_t estim = rrset->rrs.size
+ + rrset->rrs.count * (knot_dname_size(rrset->owner) + 8);
+
+ return estim;
+}
+
/*! @} */
diff --git a/src/libknot/version.h b/src/libknot/version.h
index f3a9210..2f86ed7 100644
--- a/src/libknot/version.h
+++ b/src/libknot/version.h
@@ -18,7 +18,7 @@
#define KNOT_VERSION_MAJOR 3
#define KNOT_VERSION_MINOR 3
-#define KNOT_VERSION_PATCH 0x04
+#define KNOT_VERSION_PATCH 0x05
#define KNOT_VERSION_HEX ((KNOT_VERSION_MAJOR << 16) | \
(KNOT_VERSION_MINOR << 8) | \
diff --git a/src/libknot/xdp/protocols.h b/src/libknot/xdp/protocols.h
index 1a18601..ee26e97 100644
--- a/src/libknot/xdp/protocols.h
+++ b/src/libknot/xdp/protocols.h
@@ -90,7 +90,7 @@ inline static void *prot_read_tcp(void *data, knot_xdp_msg_t *msg, uint16_t *src
continue;
}
- if (opts + 1 > hdr_end || opts + opts[1] > hdr_end) {
+ if (opts + 1 > hdr_end || opts + opts[1] > hdr_end || opts[1] < 2) {
// Malformed option.
break;
}