Commit f77858eb authored by Vladimír Čunát's avatar Vladimír Čunát Committed by Daniel Salzman

knot_dname_is_sub(): remove

Two of the call points might be slightly more readable with _is_sub(),
but I'm not convinced that justifies keeping the function.
parent 0de77d62
......@@ -43,7 +43,6 @@ libknot.so.7 libknot7 #MINVER#
knot_dname_from_str@Base 2.3.0
knot_dname_in@Base 2.3.0
knot_dname_is_equal@Base 2.3.0
knot_dname_is_sub@Base 2.3.0
knot_dname_is_wildcard@Base 2.3.0
knot_dname_label_is_equal@Base 2.6.0
knot_dname_labels@Base 2.3.0
......
......@@ -628,12 +628,12 @@ static int check_update(const knot_rrset_t *rrset, const knot_pkt_t *query,
/* Accept both subdomain and dname match. */
const knot_dname_t *owner = rrset->owner;
const knot_dname_t *qname = knot_pkt_qname(query);
const bool is_sub = knot_dname_is_sub(owner, qname);
const bool is_apex = knot_dname_is_equal(owner, qname);
if (!is_sub && !is_apex) {
const int in_bailiwick = knot_dname_in_bailiwick(owner, qname);
if (in_bailiwick < 0) {
*rcode = KNOT_RCODE_NOTZONE;
return KNOT_EOUTOFZONE;
}
const bool is_apex = in_bailiwick == 0;
if (is_dnssec_protected(rrset->type, is_apex)) {
*rcode = KNOT_RCODE_REFUSED;
......
......@@ -65,7 +65,7 @@ static int check_node(const zone_contents_t *contents, const zone_node_t *node)
assert(contents->apex != NULL);
assert(node);
if (!knot_dname_is_sub(node->owner, contents->apex->owner)) {
if (knot_dname_in_bailiwick(node->owner, contents->apex->owner) <= 0) {
return KNOT_EOUTOFZONE;
}
......@@ -590,8 +590,7 @@ static int insert_rr(zone_contents_t *z, const knot_rrset_t *rr,
}
// check if the RRSet belongs to the zone
if (!knot_dname_is_sub(rr->owner, z->apex->owner) &&
!knot_dname_is_equal(rr->owner, z->apex->owner)) {
if (knot_dname_in_bailiwick(rr->owner, z->apex->owner) < 0) {
return KNOT_EOUTOFZONE;
}
......@@ -622,8 +621,7 @@ static int remove_rr(zone_contents_t *z, const knot_rrset_t *rr,
}
// check if the RRSet belongs to the zone
if (!knot_dname_is_sub(rr->owner, z->apex->owner) &&
!knot_dname_is_equal(rr->owner, z->apex->owner)) {
if (knot_dname_in_bailiwick(rr->owner, z->apex->owner) < 0) {
return KNOT_EOUTOFZONE;
}
......
......@@ -472,7 +472,7 @@ static int check_delegation(const zone_node_t *node, semchecks_data_t *data)
for (int i = 0; i < ns_rrs->count; ++i) {
knot_rdata_t *ns_rr = knot_rdataset_at(ns_rrs, i);
const knot_dname_t *ns_dname = knot_ns_name(ns_rr);
if (!knot_dname_is_sub(ns_dname, node->owner)) {
if (knot_dname_in_bailiwick(ns_dname, node->owner) <= 0) {
continue;
}
......
......@@ -325,21 +325,6 @@ uint8_t *knot_dname_lf(const knot_dname_t *src, knot_dname_storage_t storage);
*/
int knot_dname_in_bailiwick(const knot_dname_t *name, const knot_dname_t *bailiwick);
/*!
* \brief Checks if one domain name is a (strict) subdomain of other.
*
* \param sub Domain name to be the possible subdomain.
* \param domain Domain name to be the possible parent domain.
*
* \retval true \a sub is a (strict) subdomain of \a domain.
* \retval false otherwise.
*/
static inline
bool knot_dname_is_sub(const knot_dname_t *sub, const knot_dname_t *domain)
{
return knot_dname_in_bailiwick(sub, domain) > 0;
}
/*!
* \brief Check if the domain name is a subdomain of or equal to other.
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment