Remove unused whitespace, add missing header change, make it compile

This commit is contained in:
W.C.A. Wijngaards 2020-12-09 11:13:58 +01:00
parent bdfa65c6ab
commit 31cedb47cb
7 changed files with 20 additions and 20 deletions

View file

@ -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;

View file

@ -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)

View file

@ -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;
};

View file

@ -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);
}

View file

@ -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;

View file

@ -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);

View file

@ -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.