uint8_t *salt;
};
+/* When going stricter, BEWARE of breaking entry_h_consistent_NSEC() */
struct entry_h * entry_h_consistent(knot_db_val_t data, uint16_t ktype)
{
+ (void) ktype; /* unused, for now */
/* Length checks. */
if (data.len < offsetof(struct entry_h, data))
return NULL;
ok = ok && (!kr_rank_test(eh->rank, KR_RANK_BOGUS)
|| eh->is_packet);
- switch (ktype) {
- case KNOT_RRTYPE_NSEC:
- ok = ok && !(eh->is_packet || eh->has_ns || eh->has_cname
- || eh->has_dname);
- break;
- default:
- /* doesn't hold, because of temporary NSEC3 packet caching
- if (eh->is_packet)
- ok = ok && !kr_rank_test(eh->rank, KR_RANK_SECURE);
- */
- break;
- }
+ /* doesn't hold, because of temporary NSEC3 packet caching
+ if (eh->is_packet)
+ ok = ok && !kr_rank_test(eh->rank, KR_RANK_SECURE);
+ */
//LATER: rank sanity
return ok ? /*const-cast*/(struct entry_h *)eh : NULL;
* TODO: NSEC3 chain descriptors (iff nsec3_cnt > 0)
* - is_packet: uint16_t length, otherwise opaque and handled by ./entry_pkt.c
* - otherwise RRset + its RRSIG set (possibly empty).
+ * '1' entry (NSEC1)
+ * - contents is the same as for exact hit for NSEC
+ * - flags don't make sense there
* */
struct entry_h {
uint32_t time; /**< The time of inception. */
};
-/** Check basic consistency of entry_h, not looking into ->data.
+/** Check basic consistency of entry_h for 'E' entries, not looking into ->data.
* (for is_packet the length of data is checked)
- * \note only exact hits and NSEC1 are really considered ATM.
*/
struct entry_h * entry_h_consistent(knot_db_val_t data, uint16_t ktype);
}
}
+static struct entry_h * entry_h_consistent_NSEC(knot_db_val_t data)
+{
+ /* ATM it's enough to just extend the checks for exact entries. */
+ const struct entry_h *eh = entry_h_consistent(data, KNOT_RRTYPE_NSEC);
+ bool ok = eh != NULL;
+ ok = ok && !(eh->is_packet || eh->has_ns || eh->has_cname || eh->has_dname);
+ return ok ? /*const-cast*/(struct entry_h *)eh : NULL;
+}
/** NSEC1 range search.
*
if (exact_match) {
*exact_match = is_exact;
}
- const struct entry_h *eh = entry_h_consistent(val, KNOT_RRTYPE_NSEC);
+ const struct entry_h *eh = entry_h_consistent_NSEC(val);
if (!eh) {
/* This might be just finding something else than NSEC1 entry,
* in case we searched before the very first one in the zone. */