From b6e2f4dbf8f54a487e50780d8498757eb03d615f Mon Sep 17 00:00:00 2001 From: George Thessalonikefs Date: Fri, 4 Aug 2023 19:03:23 +0200 Subject: [PATCH] - For #762: Formatting. --- daemon/worker.c | 16 +++++++++------- util/data/msgencode.c | 14 +++++++------- util/data/msgencode.h | 6 +++--- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/daemon/worker.c b/daemon/worker.c index 47d29ce91..a92f1023b 100644 --- a/daemon/worker.c +++ b/daemon/worker.c @@ -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, diff --git a/util/data/msgencode.c b/util/data/msgencode.c index d832ddc91..ec93ca071 100644 --- a/util/data/msgencode.c +++ b/util/data/msgencode.c @@ -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); } - diff --git a/util/data/msgencode.h b/util/data/msgencode.h index 1b37ca870..b42dc5029 100644 --- a/util/data/msgencode.h +++ b/util/data/msgencode.h @@ -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, -- 2.47.3