summaryrefslogtreecommitdiffstats
path: root/src/libknot
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-12 04:44:07 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-12 04:44:07 +0000
commitbdd6bd04ba39d67eaf51ef77cba67321c787258e (patch)
treeb38069ef607224c4060da303320a4c7a9d71c671 /src/libknot
parentAdding upstream version 3.3.8. (diff)
downloadknot-bdd6bd04ba39d67eaf51ef77cba67321c787258e.tar.xz
knot-bdd6bd04ba39d67eaf51ef77cba67321c787258e.zip
Adding upstream version 3.3.9.upstream/3.3.9
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/libknot')
-rw-r--r--src/libknot/codes.c1
-rw-r--r--src/libknot/consts.h1
-rw-r--r--src/libknot/packet/rrset-wire.c23
-rw-r--r--src/libknot/version.h2
-rw-r--r--src/libknot/xdp/bpf-user.c6
5 files changed, 18 insertions, 15 deletions
diff --git a/src/libknot/codes.c b/src/libknot/codes.c
index 7a0a170..b0b78fa 100644
--- a/src/libknot/codes.c
+++ b/src/libknot/codes.c
@@ -92,6 +92,7 @@ const knot_lookup_t knot_edns_ede_names[] = {
{ KNOT_EDNS_EDE_NSEC3_ITERS, "Unsupported NSEC3 Iterations Value" },
{ KNOT_EDNS_EDE_NONCONF_POLICY, "Unable to conform to policy" },
{ KNOT_EDNS_EDE_SYNTHESIZED, "Synthesized" },
+ { KNOT_EDNS_EDE_INV_QTYPE, "Invalid Query Type" },
{ 0, NULL }
};
diff --git a/src/libknot/consts.h b/src/libknot/consts.h
index f685365..e3be096 100644
--- a/src/libknot/consts.h
+++ b/src/libknot/consts.h
@@ -134,6 +134,7 @@ typedef enum {
KNOT_EDNS_EDE_NSEC3_ITERS = 27,
KNOT_EDNS_EDE_NONCONF_POLICY = 28,
KNOT_EDNS_EDE_SYNTHESIZED = 29,
+ KNOT_EDNS_EDE_INV_QTYPE = 30,
} knot_edns_ede_t;
/*!
diff --git a/src/libknot/packet/rrset-wire.c b/src/libknot/packet/rrset-wire.c
index a822cfe..ef3a068 100644
--- a/src/libknot/packet/rrset-wire.c
+++ b/src/libknot/packet/rrset-wire.c
@@ -324,11 +324,11 @@ static int write_owner(const knot_rrset_t *rrset, uint8_t **dst, size_t *dst_ava
return KNOT_EOK;
}
-static int write_fixed_header(const knot_rrset_t *rrset, uint16_t rrset_index,
+static int write_fixed_header(const knot_rrset_t *rrset, const knot_rdata_t *rdata,
uint8_t **dst, size_t *dst_avail, uint16_t flags)
{
assert(rrset);
- assert(rrset_index < rrset->rrs.count);
+ assert(rdata);
assert(dst && *dst);
assert(dst_avail);
@@ -339,10 +339,8 @@ static int write_fixed_header(const knot_rrset_t *rrset, uint16_t rrset_index,
wire_ctx_write_u16(&write, rrset->rclass);
if ((flags & KNOT_PF_ORIGTTL) && rrset->type == KNOT_RRTYPE_RRSIG) {
- const knot_rdata_t *rdata = knot_rdataset_at(&rrset->rrs, rrset_index);
wire_ctx_write_u32(&write, knot_rrsig_original_ttl(rdata));
} else if ((flags & KNOT_PF_SOAMINTTL) && rrset->type == KNOT_RRTYPE_SOA) {
- const knot_rdata_t *rdata = knot_rdataset_at(&rrset->rrs, rrset_index);
wire_ctx_write_u32(&write, MIN(knot_soa_minimum(rdata), rrset->ttl));
} else {
wire_ctx_write_u32(&write, rrset->ttl);
@@ -433,15 +431,15 @@ static int rdata_traverse_write(const uint8_t **src, size_t *src_avail,
}
static int write_rdata(const knot_rrset_t *rrset, uint16_t rrset_index,
- uint8_t **dst, size_t *dst_avail, knot_compr_t *compr)
+ const knot_rdata_t *rdata, uint8_t **dst, size_t *dst_avail,
+ knot_compr_t *compr)
{
assert(rrset);
assert(rrset_index < rrset->rrs.count);
+ assert(rdata);
assert(dst && *dst);
assert(dst_avail);
- const knot_rdata_t *rdata = knot_rdataset_at(&rrset->rrs, rrset_index);
-
// Reserve space for RDLENGTH.
if (sizeof(uint16_t) > *dst_avail) {
return KNOT_ESPACE;
@@ -478,7 +476,8 @@ static int write_rdata(const knot_rrset_t *rrset, uint16_t rrset_index,
return KNOT_EOK;
}
-static int write_rr(const knot_rrset_t *rrset, uint16_t rrset_index, uint8_t **dst,
+static int write_rr(const knot_rrset_t *rrset, uint16_t rrset_index,
+ const knot_rdata_t *rdata, uint8_t **dst,
size_t *dst_avail, knot_compr_t *compr, uint16_t flags)
{
int ret = write_owner(rrset, dst, dst_avail, compr);
@@ -486,12 +485,12 @@ static int write_rr(const knot_rrset_t *rrset, uint16_t rrset_index, uint8_t **d
return ret;
}
- ret = write_fixed_header(rrset, rrset_index, dst, dst_avail, flags);
+ ret = write_fixed_header(rrset, rdata, dst, dst_avail, flags);
if (ret != KNOT_EOK) {
return ret;
}
- return write_rdata(rrset, rrset_index, dst, dst_avail, compr);
+ return write_rdata(rrset, rrset_index, rdata, dst, dst_avail, compr);
}
_public_
@@ -518,9 +517,11 @@ int knot_rrset_to_wire_extra(const knot_rrset_t *rrset, uint8_t *wire,
}
uint16_t count = rrset->rrs.count;
+ knot_rdata_t *rdata = rotate > 1 ? knot_rdataset_at(&rrset->rrs, rotate - 1) : rrset->rrs.rdata;
for (int i = rotate; i < count + rotate; i++) {
uint16_t pos = (i < count) ? i : (i - count);
- int ret = write_rr(rrset, pos, &write, &capacity, compr, flags);
+ rdata = pos ? knot_rdataset_next(rdata) : rrset->rrs.rdata;
+ int ret = write_rr(rrset, pos, rdata, &write, &capacity, compr, flags);
if (ret != KNOT_EOK) {
return ret;
}
diff --git a/src/libknot/version.h b/src/libknot/version.h
index 91261cb..38e0b74 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 0x08
+#define KNOT_VERSION_PATCH 0x09
#define KNOT_VERSION_HEX ((KNOT_VERSION_MAJOR << 16) | \
(KNOT_VERSION_MINOR << 8) | \
diff --git a/src/libknot/xdp/bpf-user.c b/src/libknot/xdp/bpf-user.c
index 449dffe..4963e3d 100644
--- a/src/libknot/xdp/bpf-user.c
+++ b/src/libknot/xdp/bpf-user.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2022 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
@@ -289,13 +289,13 @@ int kxsk_iface_new(const char *if_name, unsigned if_queue, knot_xdp_load_bpf_t l
ret = get_bpf_maps(ret, iface);
}
if (ret < 0) {
- free(iface);
+ kxsk_iface_free(iface);
return ret;
}
knot_xdp_mode_t mode = knot_eth_xdp_mode(iface->if_index);
if (mode == KNOT_XDP_MODE_NONE) {
- free(iface);
+ kxsk_iface_free(iface);
return KNOT_ENOTSUP;
}