mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-01-22 22:52:55 -05:00
- For #762: Formatting.
This commit is contained in:
parent
702f485587
commit
b6e2f4dbf8
3 changed files with 19 additions and 17 deletions
|
|
@ -1477,8 +1477,8 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
|
|||
edns.opt_list_out = NULL;
|
||||
edns.opt_list_inplace_cb_out = NULL;
|
||||
verbose(VERB_ALGO, "query with bad edns version.");
|
||||
log_addr( VERB_CLIENT, "from",&repinfo->remote_addr
|
||||
, repinfo->remote_addrlen);
|
||||
log_addr(VERB_CLIENT, "from", &repinfo->client_addr,
|
||||
repinfo->client_addrlen);
|
||||
extended_error_encode(c->buffer, EDNS_RCODE_BADVERS, &qinfo,
|
||||
*(uint16_t*)(void *)sldns_buffer_begin(c->buffer),
|
||||
sldns_buffer_read_u16_at(c->buffer, 2), 0, &edns);
|
||||
|
|
@ -1494,17 +1494,18 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
|
|||
edns.udp_size = NORMAL_UDP_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
/* "if, else if" sequence below deals with downstream DNS Cookies */
|
||||
if (acl != acl_allow_cookie)
|
||||
if(acl != acl_allow_cookie)
|
||||
; /* pass; No cookie downstream processing whatsoever */
|
||||
|
||||
else if (edns.cookie_valid)
|
||||
else if(edns.cookie_valid)
|
||||
; /* pass; Valid cookie is good! */
|
||||
|
||||
else if (c->type != comm_udp)
|
||||
else if(c->type != comm_udp)
|
||||
; /* pass; Stateful transport */
|
||||
|
||||
else if (edns.cookie_present) {
|
||||
else if(edns.cookie_present) {
|
||||
/* Cookie present, but not valid: Cookie was bad! */
|
||||
extended_error_encode(c->buffer,
|
||||
LDNS_EXT_RCODE_BADCOOKIE, &qinfo,
|
||||
|
|
@ -1515,7 +1516,7 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
|
|||
regional_free_all(worker->scratchpad);
|
||||
goto send_reply;
|
||||
} else {
|
||||
/* Cookie requered, but no cookie present on UDP */
|
||||
/* Cookie required, but no cookie present on UDP */
|
||||
verbose(VERB_ALGO, "worker request: "
|
||||
"need cookie or stateful transport");
|
||||
log_addr(VERB_ALGO, "from",&repinfo->remote_addr
|
||||
|
|
@ -1532,6 +1533,7 @@ worker_handle_request(struct comm_point* c, void* arg, int error,
|
|||
regional_free_all(worker->scratchpad);
|
||||
goto send_reply;
|
||||
}
|
||||
|
||||
if(edns.udp_size > worker->daemon->cfg->max_udp_size &&
|
||||
c->type == comm_udp) {
|
||||
verbose(VERB_QUERY,
|
||||
|
|
|
|||
|
|
@ -958,9 +958,10 @@ qinfo_query_encode(sldns_buffer* pkt, struct query_info* qinfo)
|
|||
sldns_buffer_flip(pkt);
|
||||
}
|
||||
|
||||
void
|
||||
extended_error_encode(sldns_buffer* buf, uint16_t rcode, struct query_info* qinfo,
|
||||
uint16_t qid, uint16_t qflags, uint16_t xflags, struct edns_data* edns)
|
||||
void
|
||||
extended_error_encode(sldns_buffer* buf, uint16_t rcode,
|
||||
struct query_info* qinfo, uint16_t qid, uint16_t qflags,
|
||||
uint16_t xflags, struct edns_data* edns)
|
||||
{
|
||||
uint16_t flags;
|
||||
|
||||
|
|
@ -1003,11 +1004,10 @@ extended_error_encode(sldns_buffer* buf, uint16_t rcode, struct query_info* qinf
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
error_encode(sldns_buffer* buf, int r, struct query_info* qinfo,
|
||||
uint16_t qid, uint16_t qflags, struct edns_data* edns)
|
||||
{
|
||||
extended_error_encode(buf, (r & 0x000F), qinfo, qid, qflags
|
||||
, (r & 0xFFF0), edns);
|
||||
extended_error_encode(buf, (r & 0x000F), qinfo, qid, qflags,
|
||||
(r & 0xFFF0), edns);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ uint16_t calc_edns_field_size(struct edns_data* edns);
|
|||
*/
|
||||
void attach_edns_record(struct sldns_buffer* pkt, struct edns_data* edns);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Encode an error. With QR and RA set.
|
||||
*
|
||||
* @param pkt: where to store the packet.
|
||||
|
|
@ -130,7 +130,7 @@ void attach_edns_record(struct sldns_buffer* pkt, struct edns_data* edns);
|
|||
void error_encode(struct sldns_buffer* pkt, int r, struct query_info* qinfo,
|
||||
uint16_t qid, uint16_t qflags, struct edns_data* edns);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Encode an extended error. With QR and RA set.
|
||||
*
|
||||
* @param pkt: where to store the packet.
|
||||
|
|
@ -141,7 +141,7 @@ void error_encode(struct sldns_buffer* pkt, int r, struct query_info* qinfo,
|
|||
* @param xflags: extra flags to set (such as for example BIT_AA and/or BIT_TC)
|
||||
* @param edns: if not NULL, this is the query edns info,
|
||||
* and an edns reply is attached. Only attached if EDNS record fits reply.
|
||||
* Without edns extended errors (i.e. > 15 )will not be conveyed.
|
||||
* Without edns extended errors (i.e. > 15) will not be conveyed.
|
||||
*/
|
||||
void extended_error_encode(struct sldns_buffer* pkt, uint16_t rcode,
|
||||
struct query_info* qinfo, uint16_t qid, uint16_t qflags,
|
||||
|
|
|
|||
Loading…
Reference in a new issue