summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimír Čunát <vladimir.cunat@nic.cz>2024-03-05 13:48:21 +0100
committerVladimír Čunát <vladimir.cunat@nic.cz>2024-05-06 14:28:44 +0200
commita083f3fe63cffbabb19e6b67848151f4bb6d623c (patch)
tree8fa910e1cdc6b24fd6934ea1968beaadfc02ecd3
parentMerge branch 'macos-fix' into 'master' (diff)
downloadknot-resolver-a083f3fe63cffbabb19e6b67848151f4bb6d623c.tar.xz
knot-resolver-a083f3fe63cffbabb19e6b67848151f4bb6d623c.zip
treewide: more compatibility with future libknot 3.4
knot_wire_next_label isn't allowed with NULL wire anymore.
-rw-r--r--lib/cache/api.c2
-rw-r--r--lib/cache/peek.c2
-rw-r--r--lib/dnssec/nsec.c6
-rw-r--r--lib/dnssec/nsec3.c12
-rw-r--r--lib/dnssec/signature.c2
-rw-r--r--lib/dnssec/ta.c4
-rw-r--r--lib/layer/iterate.c2
-rw-r--r--lib/resolve.c12
-rw-r--r--lib/utils.h6
-rw-r--r--lib/zonecut.c2
10 files changed, 28 insertions, 22 deletions
diff --git a/lib/cache/api.c b/lib/cache/api.c
index f71a8d0f..73279039 100644
--- a/lib/cache/api.c
+++ b/lib/cache/api.c
@@ -517,7 +517,7 @@ static ssize_t stash_rrset(struct kr_cache *cache, const struct kr_query *qry,
goto return_needs_pkt;
const knot_dname_t *encloser = rr->owner; /**< the closest encloser name */
for (int i = 0; i < wild_labels; ++i) {
- encloser = knot_wire_next_label(encloser, NULL);
+ encloser = knot_dname_next_label(encloser);
}
/* Construct the key under which RRs will be stored,
diff --git a/lib/cache/peek.c b/lib/cache/peek.c
index e1901ac3..191e8556 100644
--- a/lib/cache/peek.c
+++ b/lib/cache/peek.c
@@ -359,7 +359,7 @@ static int peek_encloser(
/** Name of the closest (provable) encloser. */
const knot_dname_t *clencl_name = qry->sname;
for (int l = sname_labels; l > clencl_labels; --l)
- clencl_name = knot_wire_next_label(clencl_name, NULL);
+ clencl_name = knot_dname_next_label(clencl_name);
/**** 3. source of synthesis checks, in case the next closer name was covered.
**** 3a. We want to query for NSEC* of source of synthesis (SS) or its
diff --git a/lib/dnssec/nsec.c b/lib/dnssec/nsec.c
index d798e3cf..ddedc4e2 100644
--- a/lib/dnssec/nsec.c
+++ b/lib/dnssec/nsec.c
@@ -84,8 +84,8 @@ static int dname_cmp(const knot_dname_t *d1, const knot_dname_t *d2)
int res = 0;
while (res == 0 && d1_rev != NULL) {
res = lf_cmp(d1_rev, d2_rev);
- d1_rev = knot_wire_next_label(d1_rev, NULL);
- d2_rev = knot_wire_next_label(d2_rev, NULL);
+ d1_rev = knot_dname_next_label(d1_rev);
+ d2_rev = knot_dname_next_label(d2_rev);
}
kr_require(res != 0 || d2_rev == NULL);
@@ -251,7 +251,7 @@ int kr_nsec_negative(const ranked_rr_array_t *rrrs, uint32_t qry_uid,
ssynth[1] = '*';
const knot_dname_t *clencl = sname;
for (int l = sname_labels; l > clencl_labels; --l)
- clencl = knot_wire_next_label(clencl, NULL);
+ clencl = knot_dname_next_label(clencl);
(void)!!knot_dname_store(&ssynth[2], clencl);
// Try to (dis)prove the source of synthesis by a covering or matching NSEC.
diff --git a/lib/dnssec/nsec3.c b/lib/dnssec/nsec3.c
index 4199f25f..4ff27500 100644
--- a/lib/dnssec/nsec3.c
+++ b/lib/dnssec/nsec3.c
@@ -143,7 +143,7 @@ static int closest_encloser_match(int *flags, const knot_rrset_t *nsec3,
goto fail;
}
- const knot_dname_t *encloser = knot_wire_next_label(name, NULL);
+ const knot_dname_t *encloser = knot_dname_next_label(name);
*skipped = 1;
/* Avoid doing too much work on SHA1, mitigating:
@@ -154,7 +154,7 @@ static int closest_encloser_match(int *flags, const knot_rrset_t *nsec3,
const int max_labels = knot_dname_labels(nsec3->owner, NULL) - 1
+ kr_nsec3_max_depth(&params);
for (int l = knot_dname_labels(encloser, NULL); l > max_labels; --l) {
- encloser = knot_wire_next_label(encloser, NULL);
+ encloser = knot_dname_next_label(encloser);
++(*skipped);
}
@@ -174,7 +174,7 @@ static int closest_encloser_match(int *flags, const knot_rrset_t *nsec3,
if (!encloser[0])
break;
- encloser = knot_wire_next_label(encloser, NULL);
+ encloser = knot_dname_next_label(encloser);
++(*skipped);
}
@@ -404,7 +404,7 @@ static int closest_encloser_proof(const knot_pkt_t *pkt,
for (unsigned j = 0; j < skipped; ++j) {
if (kr_fails_assert(next_closer[0]))
return kr_error(EINVAL);
- next_closer = knot_wire_next_label(next_closer, NULL);
+ next_closer = knot_dname_next_label(next_closer);
}
for (unsigned j = 0; j < sec->count; ++j) {
const knot_rrset_t *rrset_j = knot_pkt_rr(sec, j);
@@ -425,7 +425,7 @@ static int closest_encloser_proof(const knot_pkt_t *pkt,
if ((flags & FLG_CLOSEST_PROVABLE_ENCLOSER) && (flags & FLG_NAME_COVERED) && next_closer) {
if (encloser_name && next_closer[0])
- *encloser_name = knot_wire_next_label(next_closer, NULL);
+ *encloser_name = knot_dname_next_label(next_closer);
if (matching_encloser_nsec3)
*matching_encloser_nsec3 = matching;
if (covering_next_nsec3)
@@ -569,7 +569,7 @@ int kr_nsec3_wildcard_answer_response_check(const knot_pkt_t *pkt, knot_section_
for (int i = 0; i < trim_to_next; ++i) {
if (kr_fails_assert(sname[0]))
return kr_error(EINVAL);
- sname = knot_wire_next_label(sname, NULL);
+ sname = knot_dname_next_label(sname);
}
int flags = 0;
diff --git a/lib/dnssec/signature.c b/lib/dnssec/signature.c
index aadb5cb9..12ed09ed 100644
--- a/lib/dnssec/signature.c
+++ b/lib/dnssec/signature.c
@@ -208,7 +208,7 @@ static int sign_ctx_add_records(dnssec_sign_ctx_t *ctx, const knot_rrset_t *cove
for (int j = 0; j < trim_labels; ++j) {
if (kr_fails_assert(beginp[0]))
return kr_error(EINVAL);
- beginp = (uint8_t *) knot_wire_next_label(beginp, NULL);
+ beginp = (uint8_t *) knot_dname_next_label(beginp);
if (kr_fails_assert(beginp))
return kr_error(EFAULT);
}
diff --git a/lib/dnssec/ta.c b/lib/dnssec/ta.c
index becf7d81..fcff1e78 100644
--- a/lib/dnssec/ta.c
+++ b/lib/dnssec/ta.c
@@ -28,7 +28,7 @@ const knot_dname_t * kr_ta_closest(const struct kr_context *ctx, const knot_dnam
kr_require(ctx && name);
if (type == KNOT_RRTYPE_DS && name[0] != '\0') {
/* DS is parent-side record, so the parent name needs to be covered. */
- name = knot_wire_next_label(name, NULL);
+ name = knot_dname_next_label(name);
}
while (name) {
struct kr_context *ctx_nc = (struct kr_context *)/*const-cast*/ctx;
@@ -38,7 +38,7 @@ const knot_dname_t * kr_ta_closest(const struct kr_context *ctx, const knot_dnam
if (kr_ta_get(ctx_nc->negative_anchors, name)) {
return NULL;
}
- name = knot_wire_next_label(name, NULL);
+ name = knot_dname_next_label(name);
}
return NULL;
}
diff --git a/lib/layer/iterate.c b/lib/layer/iterate.c
index dfb7c876..5d16015e 100644
--- a/lib/layer/iterate.c
+++ b/lib/layer/iterate.c
@@ -51,7 +51,7 @@ static const knot_dname_t *minimized_qname(struct kr_query *query, uint16_t *qty
int cut_labels = knot_dname_labels(query->zone_cut.name, NULL);
int qname_labels = knot_dname_labels(qname, NULL);
while(qname[0] && qname_labels > cut_labels + 1) {
- qname = knot_wire_next_label(qname, NULL);
+ qname = knot_dname_next_label(qname);
qname_labels -= 1;
}
diff --git a/lib/resolve.c b/lib/resolve.c
index e24a40b9..66581c59 100644
--- a/lib/resolve.c
+++ b/lib/resolve.c
@@ -184,7 +184,7 @@ static void check_empty_nonterms(struct kr_query *qry, knot_pkt_t *pkt, struct k
* otherwise this would risk leaking information to parent if the NODATA TTD > zone cut TTD. */
int labels = knot_dname_labels(target, NULL) - knot_dname_labels(cut_name, NULL);
while (target[0] && labels > 2) {
- target = knot_wire_next_label(target, NULL);
+ target = knot_dname_next_label(target);
--labels;
}
for (int i = 0; i < labels; ++i) {
@@ -196,7 +196,7 @@ static void check_empty_nonterms(struct kr_query *qry, knot_pkt_t *pkt, struct k
break;
}
kr_assert(target[0]);
- target = knot_wire_next_label(target, NULL);
+ target = knot_dname_next_label(target);
}
kr_cache_commit(cache);
#endif
@@ -1006,7 +1006,7 @@ static int forward_trust_chain_check(struct kr_request *request, struct kr_query
int cut_labels = knot_dname_labels(qry->zone_cut.name, NULL);
int wanted_name_labels = knot_dname_labels(wanted_name, NULL);
while (wanted_name[0] && wanted_name_labels > cut_labels + name_offset) {
- wanted_name = knot_wire_next_label(wanted_name, NULL);
+ wanted_name = knot_dname_next_label(wanted_name);
wanted_name_labels -= 1;
}
minimized = (wanted_name != qry->sname);
@@ -1232,11 +1232,11 @@ static int zone_cut_check(struct kr_request *request, struct kr_query *qry, knot
const knot_dname_t *parent = qry->parent->zone_cut.name;
if (parent[0] != '\0'
&& knot_dname_in_bailiwick(qry->sname, parent) >= 0) {
- requested_name = knot_wire_next_label(parent, NULL);
+ requested_name = knot_dname_next_label(parent);
}
} else if ((qry->stype == KNOT_RRTYPE_DS) && (qry->sname[0] != '\0')) {
/* If this is explicit DS query, start from encloser too. */
- requested_name = knot_wire_next_label(requested_name, NULL);
+ requested_name = knot_dname_next_label(requested_name);
}
int state = KR_STATE_FAIL;
@@ -1245,7 +1245,7 @@ static int zone_cut_check(struct kr_request *request, struct kr_query *qry, knot
if (state == KR_STATE_DONE || (state & KR_STATE_FAIL)) {
return state;
} else if (state == KR_STATE_CONSUME) {
- requested_name = knot_wire_next_label(requested_name, NULL);
+ requested_name = knot_dname_next_label(requested_name);
}
} while (state == KR_STATE_CONSUME);
diff --git a/lib/utils.h b/lib/utils.h
index fab13fe8..e03b473d 100644
--- a/lib/utils.h
+++ b/lib/utils.h
@@ -616,4 +616,10 @@ static inline size_t kr_dname_prefixlen(const uint8_t *name, unsigned nlabels)
#endif
);
}
+#if KNOT_VERSION_HEX < 0x030400
+static inline const knot_dname_t * knot_dname_next_label(const knot_dname_t *dname)
+{
+ return knot_wire_next_label(dname, NULL);
+}
+#endif
diff --git a/lib/zonecut.c b/lib/zonecut.c
index 2bbd26fc..aea38e46 100644
--- a/lib/zonecut.c
+++ b/lib/zonecut.c
@@ -580,7 +580,7 @@ int kr_zonecut_find_cached(struct kr_context *ctx, struct kr_zonecut *cut,
trie_clear(cut->nsset);
/* Subtract label from QNAME. */
if (!is_root) {
- label = knot_wire_next_label(label, NULL);
+ label = knot_dname_next_label(label);
} else {
ret = kr_error(ENOENT);
break;