}
if (host != NULL) {
- if (flags & NI_NUMERICHOST) {
+ if ((flags & NI_NUMERICHOST)) {
if (strlcpy(host, inet_ntoa(sin->sin_addr),
hostlen) >= hostlen)
return (EAI_MEMORY);
port = 0;
}
- if (hints && hints->ai_flags & AI_PASSIVE) {
+ if (hints && (hints->ai_flags & AI_PASSIVE)) {
addr = htonl(0x00000000);
if (hostname && inet_aton(hostname, &in) != 0)
addr = in.s_addr;
}
/* Don't try DNS if AI_NUMERICHOST is set */
- if (hints && hints->ai_flags & AI_NUMERICHOST)
+ if (hints && (hints->ai_flags & AI_NUMERICHOST))
return (EAI_NONAME);
hp = gethostbyname(hostname);
qflags = sldns_buffer_read_u16_at(qmsg, 2);
/* type */
- if (qflags & BIT_RD) {
+ if ((qflags & BIT_RD)) {
if (!env->log_forwarder_query_messages)
return;
dt_msg_init(env, &dm, DNSTAP__MESSAGE__TYPE__FORWARDER_QUERY);
qflags = ntohs(qflags);
/* type */
- if (qflags & BIT_RD) {
+ if ((qflags & BIT_RD)) {
if (!env->log_forwarder_response_messages)
return;
dt_msg_init(env, &dm, DNSTAP__MESSAGE__TYPE__FORWARDER_RESPONSE);
11 June 2025: Wouter
- Fix bitwise operators in conditional expressions with parentheses.
+ - Fix conditional expressions with parentheses for bitwise and.
5 June 2025: Wouter
- Fix unbound-anchor certificate file read for line ends and end of
/* store message with the finished prepended items,
* but only if we did recursion. The nonrecursion referral
* from cache does not need to be stored in the msg cache. */
- if(!qstate->no_cache_store && qstate->query_flags&BIT_RD) {
+ if(!qstate->no_cache_store && (qstate->query_flags&BIT_RD)) {
iter_dns_store(qstate->env, &qstate->qinfo,
iq->response->rep, 0, qstate->prefetch_leeway,
iq->dp&&iq->dp->has_parent_side_NS,
random = ub_random(rnd);
bits = 30;
}
- if(random & 0x1) {
+ if((random & 0x1)) {
*d = (uint8_t)toupper((unsigned char)*d);
} else {
*d = (uint8_t)tolower((unsigned char)*d);
edns.opt_list_inplace_cb_out = NULL;
edns.udp_size = serviced_query_udp_size(sq, sq->status);
edns.bits = 0;
- if(sq->dnssec & EDNS_DO)
+ if((sq->dnssec & EDNS_DO))
edns.bits = EDNS_DO;
- if(sq->dnssec & BIT_CD)
+ if((sq->dnssec & BIT_CD))
LDNS_CD_SET(sldns_buffer_begin(buff));
if (sq->ssl_upstream && sq->padding_block_size) {
padding_option.opt_code = LDNS_EDNS_PADDING;
size_t i;
uint32_t ac32 = 0;
for (i = 0; i < keysize; ++i) {
- ac32 += (i & 1) ? key[i] : key[i] << 8;
+ ac32 += ((i & 1)) ? key[i] : key[i] << 8;
}
ac32 += (ac32 >> 16) & 0xFFFF;
return (uint16_t) (ac32 & 0xFFFF);
while (rdata_len && *rdata != 0) {
uint8_t label_len;
- if (*rdata & 0xC0)
+ if ((*rdata & 0xC0))
return LDNS_WIREPARSE_ERR_OK;
label_len = *rdata + 1;
}
if(((frame->hd.type != NGHTTP2_DATA &&
frame->hd.type != NGHTTP2_HEADERS) ||
- frame->hd.flags & NGHTTP2_FLAG_END_STREAM) &&
+ (frame->hd.flags & NGHTTP2_FLAG_END_STREAM)) &&
h2_stream->res_status == 200) {
char* pktstr;
sldns_buffer_flip(h2_stream->buf);
if(sldns_buffer_remaining(query) < 1)
return 0; /* parse error, need label len */
labellen = sldns_buffer_read_u8(query);
- if(labellen&0xc0)
+ if((labellen&0xc0))
return 0; /* no compression allowed in queries */
len += labellen + 1;
if(len > LDNS_MAX_DOMAINLEN)
return 0; /* too short, shortest is '0' root label */
labellen = *dname++;
while(labellen) {
- if(labellen&0xc0)
+ if((labellen&0xc0))
return 0; /* no compression ptrs allowed */
len += labellen + 1;
if(len >= LDNS_MAX_DOMAINLEN)
flags |= BIT_AA;
flags &= ~BIT_AD;
}
- log_assert(flags & BIT_QR); /* QR bit must be on in our replies */
+ log_assert((flags & BIT_QR)); /* QR bit must be on in our replies */
if(udpsize < LDNS_HEADER_SIZE)
return 0;
/* currently edns does not change during calculations;
*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
* For DNS64 bit_cd signals no dns64 processing, but we want to
* provide validation there too */
/*
- if(qstate->query_flags & BIT_CD) {
+ if((qstate->query_flags & BIT_CD)) {
verbose(VERB_ALGO, "not validating response due to CD bit");
return 0;
}
/* Update rep->reason_bogus as it is the one being cached */
update_reason_bogus(vq->orig_msg->rep, errinf_to_reason_bogus(qstate));
/* store results in cache */
- if(qstate->query_flags&BIT_RD) {
+ if((qstate->query_flags&BIT_RD)) {
/* if secure, this will override cache anyway, no need
* to check if from parentNS */
if(!qstate->no_cache_store) {