Skip to content
Snippets Groups Projects
Commit 2d4e430d authored by Marek Vavrusa's avatar Marek Vavrusa
Browse files

Removed duplicated function.

parent 6d1c20e1
No related branches found
No related tags found
No related merge requests found
......@@ -80,7 +80,8 @@ bool knot_is_nsec3_enabled(const knot_zone_contents_t *zone)
return false;
}
return zone->nsec3_params.algorithm != 0;
return zone->nsec3_params.algorithm != 0 &&
knot_zone_tree_weight(zone->nsec3_nodes) > 0;
}
/*!
......
......@@ -2,6 +2,7 @@
#include "knot/nameserver/nsec_proofs.h"
#include "knot/nameserver/process_query.h"
#include "knot/dnssec/zone-nsec.h"
#include "libknot/common.h"
#include "libknot/rdata.h"
......@@ -336,7 +337,7 @@ static int ns_put_nsec_nsec3_wildcard_nodata(const knot_node_t *node,
{
int ret = KNOT_EOK;
if (knot_zone_contents_nsec3_enabled(zone)) {
if (knot_is_nsec3_enabled(zone)) {
ret = ns_put_nsec3_closest_encloser_proof(zone,
&closest_encloser,
qname, resp);
......@@ -417,7 +418,7 @@ static int ns_put_nsec3_wildcard(const knot_zone_contents_t *zone,
assert(qname != NULL);
assert(resp != NULL);
if (!knot_zone_contents_nsec3_enabled(zone)) {
if (!knot_is_nsec3_enabled(zone)) {
return KNOT_EOK;
}
......@@ -475,7 +476,7 @@ static int ns_put_nsec_nsec3_wildcard_answer(const knot_node_t *node,
if (knot_dname_is_wildcard(knot_node_owner(node))
&& knot_dname_cmp(qname, knot_node_owner(node)) != 0) {
dbg_ns_verb("Adding NSEC/NSEC3 for wildcard answer.\n");
if (knot_zone_contents_nsec3_enabled(zone)) {
if (knot_is_nsec3_enabled(zone)) {
ret = ns_put_nsec3_wildcard(zone, closest_encloser,
qname, resp);
} else {
......@@ -663,7 +664,7 @@ static int ns_put_nsec_nsec3_nxdomain(const knot_zone_contents_t *zone,
{
int ret = 0;
if (knot_zone_contents_nsec3_enabled(zone)) {
if (knot_is_nsec3_enabled(zone)) {
ret = ns_put_nsec3_nxdomain(zone, closest_encloser,
qname, resp);
} else {
......@@ -704,7 +705,7 @@ static int ns_put_nsec_nsec3_nodata(const knot_node_t *node,
knot_rrset_t *rrset = NULL;
if (knot_zone_contents_nsec3_enabled(zone)) {
if (knot_is_nsec3_enabled(zone)) {
knot_node_t *nsec3_node = knot_node_get_nsec3_node(node);
dbg_ns("%s: adding NSEC3 NODATA\n", __func__);
......
......@@ -1458,18 +1458,6 @@ int knot_zone_contents_load_nsec3param(knot_zone_contents_t *zone)
/*----------------------------------------------------------------------------*/
int knot_zone_contents_nsec3_enabled(const knot_zone_contents_t *zone)
{
if (zone == NULL) {
return KNOT_EINVAL;
}
return (zone->nsec3_params.algorithm != 0
&& knot_zone_tree_weight(zone->nsec3_nodes) != 0);
}
/*----------------------------------------------------------------------------*/
const knot_nsec3_params_t *knot_zone_contents_nsec3params(
const knot_zone_contents_t *zone)
{
......@@ -1477,7 +1465,7 @@ const knot_nsec3_params_t *knot_zone_contents_nsec3params(
return NULL;
}
if (knot_zone_contents_nsec3_enabled(zone)) {
if (knot_is_nsec3_enabled(zone)) {
return &zone->nsec3_params;
} else {
return NULL;
......
......@@ -367,21 +367,6 @@ int knot_zone_contents_adjust_full(knot_zone_contents_t *contents,
*/
int knot_zone_contents_load_nsec3param(knot_zone_contents_t *contents);
/*!
* \brief Checks if the zone uses NSEC3.
*
* This function will return 0 if the NSEC3PARAM record was not parse prior to
* calling it.
*
* \param zone Zone to check.
*
* \retval <> 0 if the zone uses NSEC3.
* \retval 0 if it does not.
*
* \see knot_zone_contents_load_nsec3param()
*/
int knot_zone_contents_nsec3_enabled(const knot_zone_contents_t *contents);
/*!
* \brief Returns the parsed NSEC3PARAM record of the zone.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment