* no nameserver found!!!
* try to resolve the names we do got
*/
- printf("nameserver %d\n", ldns_rr_list_rr_count(new_nss));
for(i = 0; i < ldns_rr_list_rr_count(new_nss); i++) {
/* get the name of the nameserver */
pop = ldns_rr_rdf(ldns_rr_list_rr(new_nss, i), 0);
- printf("pop %p\n", pop);
if (!pop) {
break;
}
ldns_rr_list_print(stdout, new_nss);
- printf("pop -- ");
ldns_rdf_print(stdout, pop);
- printf("\n");
/* retrieve it's addresses */
ns_addr = ldns_rr_list_cat_clone(ns_addr,
ldns_get_rr_list_addr_by_name(local_res, pop, c, 0));
type = LDNS_RR_TYPE_A;
}
- /* if we're asking for DNSSEC record, act as if -D with given */
+ /* if we're asking for DNSSEC records, act as if -D with given */
if (type == LDNS_RR_TYPE_DNSKEY ||
- type == LDNS_RR_TYPE_RRSIG ||
+ type == LDNS_RR_TYPE_RRSIG ||
+ type == LDNS_RR_TYPE_DS ||
type == LDNS_RR_TYPE_NSEC) {
qdnssec = true;
}
for(i = 1; i < 10 && chopped_dname[i - 1]; i++) {
chopped_dname[i] = ldns_dname_left_chop(chopped_dname[i - 1]);
}
- printf("%d i\n", i);
chopped_dname[i] = NULL;
dname_labels = i - 2; /* set this also before this last NULL */
ldns_pkt_free(u_pkt);
return LDNS_STATUS_ERR;
}
+
+bool
+ldns_nsec_type_check(ldns_rr *nsec, ldns_rr_type t)
+{
+ /* does the nsec cover the t given? */
+ /* copied from host2str.c line 465: ldns_rdf2buffer_str_nsec */
+ uint8_t window_block_nr;
+ uint8_t bitmap_length;
+ uint16_t type;
+ uint16_t pos = 0;
+ uint16_t bit_pos;
+ ldns_rdf *nsec_type_list = ldns_rr_rdf(nsec, 1);
+ uint8_t *data = ldns_rdf_data(nsec_type_list);
+
+ while(pos < ldns_rdf_size(nsec_type_list)) {
+ window_block_nr = data[pos];
+ bitmap_length = data[pos+1];
+ pos += 2;
+
+ for (bit_pos = 0; bit_pos < (bitmap_length) * 8; bit_pos++) {
+ if (ldns_get_bit(&data[pos], bit_pos)) {
+ type = 256 * (uint16_t) window_block_nr + bit_pos;
+
+ if ((ldns_rr_type)type == t) {
+ /* we have a winner */
+ return true;
+ }
+ }
+ }
+ pos += (uint16_t) bitmap_length;
+ }
+ return false;
+}
ldns_status
ldns_rdf2buffer_str_nsec(ldns_buffer *output, ldns_rdf *rdf)
{
+ /* Note: this code is duplicated in higher.c in
+ * ldns_nsec_type_check() function
+ */
uint8_t window_block_nr;
uint8_t bitmap_length;
uint16_t type;
*/
ldns_rr_list *ldns_getaddrinfo_secure();
+/**
+ * Check if t is enumerated in the nsec type rdata
+ * \param[in] nsec the NSEC Record to look in
+ * \param[in] t the type to check for
+ * \return true when t is found, otherwise return false
+ */
+bool ldns_nsec_type_check(ldns_rr *nsec, ldns_rr_type t);
+
/*
* Send a "simple" update for an A or an AAAA RR.
* \param[in] fqdn the update RR owner