diff options
Diffstat (limited to 'contrib/unbound/util/data/msgreply.c')
-rw-r--r-- | contrib/unbound/util/data/msgreply.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/contrib/unbound/util/data/msgreply.c b/contrib/unbound/util/data/msgreply.c index e98dce133039..02e1230e96e7 100644 --- a/contrib/unbound/util/data/msgreply.c +++ b/contrib/unbound/util/data/msgreply.c @@ -251,7 +251,7 @@ rdata_copy(sldns_buffer* pkt, struct packed_rrset_data* data, uint8_t* to, *rr_ttl = sldns_read_uint32(rr->ttl_data); /* RFC 2181 Section 8. if msb of ttl is set treat as if zero. */ - if(*rr_ttl & 0x80000000U) + if((*rr_ttl & 0x80000000U)) *rr_ttl = 0; if(type == LDNS_RR_TYPE_SOA && section == LDNS_SECTION_AUTHORITY) { /* negative response. see if TTL of SOA record larger than the @@ -984,14 +984,14 @@ log_reply_info(enum verbosity_value v, struct query_info *qinf, if(daddr->ss_family == AF_INET6) { struct sockaddr_in6 *d = (struct sockaddr_in6 *)daddr; if(inet_ntop(d->sin6_family, &d->sin6_addr, da, - sizeof(*d)) == 0) + sizeof(da)) == 0) snprintf(dest_buf, sizeof(dest_buf), "(inet_ntop_error)"); port = ntohs(d->sin6_port); } else if(daddr->ss_family == AF_INET) { struct sockaddr_in *d = (struct sockaddr_in *)daddr; if(inet_ntop(d->sin_family, &d->sin_addr, da, - sizeof(*d)) == 0) + sizeof(da)) == 0) snprintf(dest_buf, sizeof(dest_buf), "(inet_ntop_error)"); port = ntohs(d->sin_port); @@ -1129,7 +1129,7 @@ int edns_opt_list_append_ede(struct edns_option** list, struct regional* region, prevp = list; while(*prevp != NULL) prevp = &((*prevp)->next); - verbose(VERB_ALGO, "attached EDE code: %d with message: %s", code, (txt?txt:"\"\"")); + verbose(VERB_ALGO, "attached EDE code: %d with message: '%s'", code, (txt?txt:"")); *prevp = opt; return 1; } @@ -1471,3 +1471,22 @@ struct edns_option* edns_opt_list_find(struct edns_option* list, uint16_t code) } return NULL; } + +int local_alias_shallow_copy_qname(struct local_rrset* local_alias, uint8_t** qname, + size_t* qname_len) +{ + struct ub_packed_rrset_key* rrset = local_alias->rrset; + struct packed_rrset_data* d = rrset->entry.data; + + /* Sanity check: our current implementation only supports + * a single CNAME RRset as a local alias. */ + if(local_alias->next || + rrset->rk.type != htons(LDNS_RR_TYPE_CNAME) || + d->count != 1) { + log_err("assumption failure: unexpected local alias"); + return 0; + } + *qname = d->rr_data[0] + 2; + *qname_len = d->rr_len[0] - 2; + return 1; +} |