From: W.C.A. Wijngaards Date: Wed, 9 Dec 2020 10:13:58 +0000 (+0100) Subject: Remove unused whitespace, add missing header change, make it compile X-Git-Tag: release-1.13.2rc1~254^2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=31cedb47cbf9033df3670ef5d3e91044a5369046;p=thirdparty%2Funbound.git Remove unused whitespace, add missing header change, make it compile --- diff --git a/dnstap/dnstap.c b/dnstap/dnstap.c index 2ee269be3..e1abfeeb3 100644 --- a/dnstap/dnstap.c +++ b/dnstap/dnstap.c @@ -345,7 +345,7 @@ dt_msg_fill_net(struct dt_msg *dm, /* * This block is to fill second set of fields in DNSTAP-message defined as request_/response_ names. - * Additional responsive structure is: struct sockaddr_storage *rs + * Additional responsive structure is: struct sockaddr_storage *rs */ if (rs->ss_family == AF_INET6) { struct sockaddr_in6 *r = (struct sockaddr_in6 *) rs; diff --git a/services/listen_dnsport.c b/services/listen_dnsport.c index 02d44fcba..e8b8fdbd6 100644 --- a/services/listen_dnsport.c +++ b/services/listen_dnsport.c @@ -1215,12 +1215,12 @@ ports_create_if(const char* ifname, int do_auto, int do_udp, int do_tcp, } } if(do_tcp) { - ub_sock = malloc(sizeof(struct unbound_socket)); - if(!ub_sock) - return 0; int is_ssl = if_is_ssl(ifname, port, ssl_port, tls_additional_port); enum listen_type port_type; + ub_sock = malloc(sizeof(struct unbound_socket)); + if(!ub_sock) + return 0; if(is_ssl) port_type = listen_type_ssl; else if(is_https) diff --git a/services/listen_dnsport.h b/services/listen_dnsport.h index 96feea667..82f0d9ec6 100644 --- a/services/listen_dnsport.h +++ b/services/listen_dnsport.h @@ -112,7 +112,7 @@ struct unbound_socket { int s; /** address family (AF_INET/IF_INET6) */ int fam; - /** descriptor returned by accept() syscall for further usage. TODO: actually it might be useless here unlike in NSD where we have no comm_points mechanism with callback pointers for every created communication point */ + /** descriptor returned by accept() syscall for further usage. TODO: actually it might be useless here unlike in NSD where we have no comm_points mechanism with callback pointers for every created communication point */ int tcp_read_fd; }; diff --git a/services/outside_network.c b/services/outside_network.c index 5d6b6c3c2..587f33a88 100644 --- a/services/outside_network.c +++ b/services/outside_network.c @@ -1923,7 +1923,7 @@ randomize_and_send_udp(struct pending* pend, sldns_buffer* packet, int timeout) #ifdef USE_DNSTAP /* * sending src (local service)/dst (upstream) addresses over DNSTAP - * TODO: right now there are no chances to get the src (local service) addr. So we will pass 0.0.0.0 (::) + * TODO: right now there are no chances to get the src (local service) addr. So we will pass 0.0.0.0 (::) * to argument for dt_msg_send_outside_query()/dt_msg_send_outside_response() calls. * For the both UDP and TCP. */ @@ -1933,12 +1933,12 @@ randomize_and_send_udp(struct pending* pend, sldns_buffer* packet, int timeout) if(addr_is_ip6(&sq->addr, sq->addrlen)) { log_addr(VERB_ALGO, "from local addr", &sq->outnet->ip6_ifs->addr, sq->outnet->ip6_ifs->addrlen); log_addr(VERB_ALGO, "request to upstream", &sq->addr, sq->addrlen); - dt_msg_send_outside_query(sq->outnet->dtenv, &sq->addr, &sq->outnet->ip6_ifs->addr, + dt_msg_send_outside_query(sq->outnet->dtenv, &sq->addr, &sq->outnet->ip6_ifs->addr, comm_tcp, sq->zone, sq->zonelen, packet); } else { log_addr(VERB_ALGO, "from local addr", &sq->outnet->ip4_ifs->addr, sq->outnet->ip4_ifs->addrlen); log_addr(VERB_ALGO, "request to upstream", &sq->addr, sq->addrlen); - dt_msg_send_outside_query(sq->outnet->dtenv, &sq->addr, &sq->outnet->ip4_ifs->addr, + dt_msg_send_outside_query(sq->outnet->dtenv, &sq->addr, &sq->outnet->ip4_ifs->addr, comm_tcp, sq->zone, sq->zonelen, packet); } } @@ -2732,13 +2732,13 @@ serviced_tcp_callback(struct comm_point* c, void* arg, int error, if(addr_is_ip6(&sq->addr, sq->addrlen)) { log_addr(VERB_ALGO, "response from upstream", &sq->addr, sq->addrlen); log_addr(VERB_ALGO, "to local addr", &sq->outnet->ip6_ifs->addr, sq->outnet->ip6_ifs->addrlen); - dt_msg_send_outside_response(sq->outnet->dtenv, &sq->addr, &sq->outnet->ip6_ifs->addr, + dt_msg_send_outside_response(sq->outnet->dtenv, &sq->addr, &sq->outnet->ip6_ifs->addr, c->type, sq->zone, sq->zonelen, sq->qbuf, sq->qbuflen, &sq->last_sent_time, sq->outnet->now_tv, c->buffer); } else { log_addr(VERB_ALGO, "response from upstream", &sq->addr, sq->addrlen); log_addr(VERB_ALGO, "to local addr", &sq->outnet->ip4_ifs->addr, sq->outnet->ip4_ifs->addrlen); - dt_msg_send_outside_response(sq->outnet->dtenv, &sq->addr, &sq->outnet->ip4_ifs->addr, + dt_msg_send_outside_response(sq->outnet->dtenv, &sq->addr, &sq->outnet->ip4_ifs->addr, c->type, sq->zone, sq->zonelen, sq->qbuf, sq->qbuflen, &sq->last_sent_time, sq->outnet->now_tv, c->buffer); } diff --git a/util/net_help.c b/util/net_help.c index 9745adcd3..8732ea3df 100644 --- a/util/net_help.c +++ b/util/net_help.c @@ -1632,7 +1632,7 @@ mk_local_addr(void* addr, u_short port, u_char family) struct in6_addr* v6addr = (struct in6_addr*)addr; struct sockaddr_in6 sin6; memset(&sin6, 0, sizeof(sin6)); - sin6.sin6_len = sizeof(sin6); + /* sin6.sin6_len = sizeof(sin6); */ sin6.sin6_family = AF_INET6; sin6.sin6_addr = *v6addr; sin6.sin6_port = port; diff --git a/util/netevent.c b/util/netevent.c index e98b76933..713374827 100644 --- a/util/netevent.c +++ b/util/netevent.c @@ -411,13 +411,13 @@ static void p_ancil(const char* str, struct comm_reply* r) if(r->srctype == 6) { #ifdef IPV6_PKTINFO - char buf[1024]; - if(inet_ntop(AF_INET6, &r->pktinfo.v6info.ipi6_addr, - buf, (socklen_t)sizeof(buf)) == 0) { - (void)strlcpy(buf, "(inet_ntop error)", sizeof(buf)); - } - buf[sizeof(buf)-1]=0; - log_info("%s: %s %d", str, buf, r->pktinfo.v6info.ipi6_ifindex); + char buf[1024]; + if(inet_ntop(AF_INET6, &r->pktinfo.v6info.ipi6_addr, + buf, (socklen_t)sizeof(buf)) == 0) { + (void)strlcpy(buf, "(inet_ntop error)", sizeof(buf)); + } + buf[sizeof(buf)-1]=0; + log_info("%s: %s %d", str, buf, r->pktinfo.v6info.ipi6_ifindex); #endif } else if(r->srctype == 4) { #ifdef IP_PKTINFO @@ -3971,7 +3971,7 @@ comm_point_send_reply(struct comm_reply *repinfo) dst_addr = mk_local_addr(&((struct sockaddr_in6*)repinfo->c->socket->addr->ai_addr)->sin6_addr, ((struct sockaddr_in*)repinfo->c->socket->addr->ai_addr)->sin_port, repinfo->addr.ss_family); log_addr(VERB_ALGO, "from local addr", dst_addr, sizeof(dst_addr)); log_addr(VERB_ALGO, "response to client", &repinfo->addr, repinfo->addrlen); - dt_msg_send_client_response(repinfo->c->tcp_parent->dtenv, &repinfo->addr, dst_addr, repinfo->c->type, + dt_msg_send_client_response(repinfo->c->tcp_parent->dtenv, &repinfo->addr, dst_addr, repinfo->c->type, ( repinfo->c->tcp_req_info? repinfo->c->tcp_req_info->spool_buffer: repinfo->c->buffer )); if(dst_addr) free(dst_addr); diff --git a/util/netevent.h b/util/netevent.h index f43f0f49f..c48359ec4 100644 --- a/util/netevent.h +++ b/util/netevent.h @@ -554,7 +554,7 @@ struct comm_point* comm_point_create_tcp(struct comm_base* base, struct tcl_list* tcp_conn_limit, size_t bufsize, struct sldns_buffer* spoolbuf, enum listen_type port_type, - comm_point_callback_type* callback, void* callback_arg); + comm_point_callback_type* callback, void* callback_arg, struct unbound_socket* socket); /** * Create an outgoing TCP commpoint. No file descriptor is opened, left at -1.