Commit 2b638edb authored by Daniel Salzman's avatar Daniel Salzman
Browse files

semcheck: add mandatory check for SOA

parent f97c18f2
......@@ -157,6 +157,7 @@ typedef struct {
time_t time;
} semchecks_data_t;
static int check_soa(const zone_node_t *node, semchecks_data_t *data);
static int check_cname(const zone_node_t *node, semchecks_data_t *data);
static int check_dname(const zone_node_t *node, semchecks_data_t *data);
static int check_delegation(const zone_node_t *node, semchecks_data_t *data);
......@@ -177,6 +178,7 @@ struct check_function {
/* List of function callbacks for defined check_level */
static const struct check_function CHECK_FUNCTIONS[] = {
{ check_soa, MANDATORY },
{ check_cname, MANDATORY },
{ check_dname, MANDATORY },
{ check_delegation, MANDATORY }, // mandatory for apex, optional for others
......@@ -1030,6 +1032,28 @@ nsec3_cleanup:
return ret;
}
/*!
* \brief Check if apex node contains SOA record
*
* \param node Node to check
* \param data Semantic checks context data
*/
static int check_soa(const zone_node_t *node, semchecks_data_t *data)
{
if (data->zone->apex != node) {
return KNOT_EOK;
}
const knot_rdataset_t *soa_rrs = node_rdataset(node, KNOT_RRTYPE_SOA);
if (soa_rrs == NULL) {
data->handler->error = true;
data->handler->cb(data->handler, data->zone, node,
SEM_ERR_SOA_NONE, NULL);
}
return KNOT_EOK;
}
/*!
* \brief Check if CNAME record contains other records
*
......
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