+Knot Resolver 5.5.1 (2022-mm-dd)
+================================
+
+Bugfixes
+--------
+- modules/dns64: fix incorrect packet writes for cached packets (#727, !1275)
+
+
Knot Resolver 5.5.0 (2022-03-15)
================================
int kr_pkt_put(knot_pkt_t *, const knot_dname_t *, uint32_t, uint16_t, uint16_t, const uint8_t *, uint16_t);
int kr_pkt_recycle(knot_pkt_t *);
int kr_pkt_clear_payload(knot_pkt_t *);
-uint16_t kr_pkt_has_dnssec(const knot_pkt_t *);
+_Bool kr_pkt_has_wire(const knot_pkt_t *);
+_Bool kr_pkt_has_dnssec(const knot_pkt_t *);
uint16_t kr_pkt_qclass(const knot_pkt_t *);
uint16_t kr_pkt_qtype(const knot_pkt_t *);
char *kr_pkt_text(const knot_pkt_t *);
int kr_pkt_put(knot_pkt_t *, const knot_dname_t *, uint32_t, uint16_t, uint16_t, const uint8_t *, uint16_t);
int kr_pkt_recycle(knot_pkt_t *);
int kr_pkt_clear_payload(knot_pkt_t *);
-uint16_t kr_pkt_has_dnssec(const knot_pkt_t *);
+_Bool kr_pkt_has_wire(const knot_pkt_t *);
+_Bool kr_pkt_has_dnssec(const knot_pkt_t *);
uint16_t kr_pkt_qclass(const knot_pkt_t *);
uint16_t kr_pkt_qtype(const knot_pkt_t *);
char *kr_pkt_text(const knot_pkt_t *);
kr_pkt_put
kr_pkt_recycle
kr_pkt_clear_payload
+ kr_pkt_has_wire
kr_pkt_has_dnssec
kr_pkt_qclass
kr_pkt_qtype
if ret ~= 0 then return nil, knot_error_t(ret) end
return true
end,
+ -- Checks whether the packet has a wire, i.e. the .size is not
+ -- equal to KR_PKT_SIZE_NOWIRE
+ has_wire = function (pkt)
+ assert(ffi.istype(knot_pkt_t, pkt))
+ return C.kr_pkt_has_wire(pkt)
+ end,
recycle = function (pkt)
assert(ffi.istype(knot_pkt_t, pkt))
local ret = C.kr_pkt_recycle(pkt)
#include "lib/defines.h"
#include "contrib/ucw/config.h" /*uint*/
-/** When knot_pkt is passed from cache without ->wire, this is the ->size. */
-static const size_t PKT_SIZE_NOWIRE = -1;
-
-
#include "lib/module.h"
/* Prototypes for the 'cache' module implementation. */
int cache_peek(kr_layer_t *ctx, knot_pkt_t *pkt);
if (ret) return kr_error(ret);
}
- pkt->parsed = pkt->size = PKT_SIZE_NOWIRE;
+ pkt->parsed = pkt->size = KR_PKT_SIZE_NOWIRE;
knot_wire_set_qr(pkt->wire);
knot_wire_set_aa(pkt->wire);
return kr_ok();
if (kr_fails_assert(rrset)) return;
knot_rrset_init(rrset, owner, type, rclass, ttl);
}
-uint16_t kr_pkt_has_dnssec(const knot_pkt_t *pkt)
+bool kr_pkt_has_wire(const knot_pkt_t *pkt)
+{
+ return pkt->size != KR_PKT_SIZE_NOWIRE;
+}
+bool kr_pkt_has_dnssec(const knot_pkt_t *pkt)
{
return knot_pkt_has_dnssec(pkt);
}
#include "lib/log.h"
+/** When knot_pkt is passed from cache without ->wire, this is the ->size. */
+static const size_t KR_PKT_SIZE_NOWIRE = -1;
+
+
/*
* Logging and debugging.
*/
/* Trivial non-inline wrappers, to be used in lua. */
KR_EXPORT void kr_rrset_init(knot_rrset_t *rrset, knot_dname_t *owner,
uint16_t type, uint16_t rclass, uint32_t ttl);
-KR_EXPORT uint16_t kr_pkt_has_dnssec(const knot_pkt_t *pkt);
+KR_EXPORT bool kr_pkt_has_wire(const knot_pkt_t *pkt);
+KR_EXPORT bool kr_pkt_has_dnssec(const knot_pkt_t *pkt);
KR_EXPORT uint16_t kr_pkt_qclass(const knot_pkt_t *pkt);
KR_EXPORT uint16_t kr_pkt_qtype(const knot_pkt_t *pkt);
KR_EXPORT uint32_t kr_rrsig_sig_inception(const knot_rdata_t *rdata);
then return end
-- Update packet question if it was minimized.
qry.flags.NO_MINIMIZE = true
- if not ffi.C.knot_dname_is_equal(pkt.wire + 12, sname) then
+ if not ffi.C.knot_dname_is_equal(pkt.wire + 12, sname) or not pkt:has_wire() then
if not pkt:recycle() or not pkt:question(sname, qry.sclass, qry.stype)
then return end
end