Commit 8f601ef8 authored by Daniel Salzman's avatar Daniel Salzman

nsec: tiny code cleanup

parent c07d4ad4
......@@ -110,15 +110,6 @@ static int mark_removed_nsec3(const zone_contents_t *zone, changeset_t *ch)
return KNOT_EOK;
}
bool knot_is_nsec3_enabled(const zone_contents_t *zone)
{
if (zone == NULL) {
return false;
}
return zone->nsec3_params.algorithm != 0;
}
int knot_nsec3_hash_to_dname(uint8_t *out, size_t out_size, const uint8_t *hash,
size_t hash_size, const knot_dname_t *zone_apex)
......
/* Copyright (C) 2017 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
/* Copyright (C) 2018 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
......@@ -30,7 +30,10 @@
*
* \return NSEC3 is enabled.
*/
bool knot_is_nsec3_enabled(const zone_contents_t *zone);
inline static bool knot_is_nsec3_enabled(const zone_contents_t *zone)
{
return zone != NULL && zone->nsec3_params.algorithm != 0;
}
/*!
* \brief Create NSEC3 owner name from hash and zone apex.
......
......@@ -470,15 +470,11 @@ static int put_nxdomain(const zone_contents_t *zone,
knotd_qdata_t *qdata,
knot_pkt_t *resp)
{
int ret = 0;
if (knot_is_nsec3_enabled(zone)) {
ret = put_nsec3_nxdomain(qname, zone, closest, qdata, resp);
return put_nsec3_nxdomain(qname, zone, closest, qdata, resp);
} else {
ret = put_nsec_nxdomain(zone, previous, closest, qdata, resp);
return put_nsec_nxdomain(zone, previous, closest, qdata, resp);
}
return ret;
}
/*!
......@@ -509,9 +505,9 @@ static int put_nsec_nodata(const zone_contents_t *zone,
{
if (empty_nonterminal(match)) {
return put_nsec_nxdomain(zone, previous, closest, qdata, resp);
} else {
return put_nsec_from_node(match, qdata, resp);
}
return put_nsec_from_node(match, qdata, resp);
}
/*!
......@@ -569,15 +565,11 @@ static int put_nodata(const zone_node_t *node,
knotd_qdata_t *qdata,
knot_pkt_t *resp)
{
int ret = 0;
if (knot_is_nsec3_enabled(zone)) {
ret = put_nsec3_nodata(qname, zone, node, closest, qdata, resp);
return put_nsec3_nodata(qname, zone, node, closest, qdata, resp);
} else {
ret = put_nsec_nodata(zone, node, closest, previous, qdata, resp);
return put_nsec_nodata(zone, node, closest, previous, qdata, resp);
}
return ret;
}
int nsec_prove_wildcards(knot_pkt_t *pkt, knotd_qdata_t *qdata)
......
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