diff --git a/src/server.c b/src/server.c index 5b1edd86..4339d593 100644 --- a/src/server.c +++ b/src/server.c @@ -863,7 +863,7 @@ static getdns_return_t add_listeners(listen_set *set) &enable, sizeof(enable)) < 0) { ; /* Ignore */ } -#ifdef HAVE_DECL_TCP_FASTOPEN +#if defined(HAVE_DECL_TCP_FASTOPEN) && HAVE_DECL_TCP_FASTOPEN if (setsockopt(l->fd, IPPROTO_TCP, TCP_FASTOPEN, &enable, sizeof(enable)) < 0) { ; /* Ignore */ diff --git a/src/stub.c b/src/stub.c index c71ce1ca..0a5b4b46 100644 --- a/src/stub.c +++ b/src/stub.c @@ -412,16 +412,16 @@ tcp_connect(getdns_upstream *upstream, getdns_transport_list_t transport) /* Note that error detection is different with TFO. Since the handshake doesn't start till the sendto() lack of connection is often delayed until then or even the subsequent event depending on the error and platform.*/ -# ifdef HAVE_DECL_TCP_FASTOPEN_CONNECT +# if defined(HAVE_DECL_TCP_FASTOPEN_CONNECT) && HAVE_DECL_TCP_FASTOPEN_CONNECT (void)setsockopt( fd, IPPROTO_TCP, TCP_FASTOPEN_CONNECT , (void *)&enable, sizeof(enable)); # else /* HAVE_DECL_TCP_FASTOPEN_CONNECT */ -# ifdef HAVE_DECL_TCP_FASTOPEN +# if defined(HAVE_DECL_TCP_FASTOPEN) && HAVE_DECL_TCP_FASTOPEN (void)setsockopt( fd, IPPROTO_TCP, TCP_FASTOPEN , (void *)&enable, sizeof(enable)); # endif/* HAVE_DECL_TCP_FASTOPEN*/ # endif /* HAVE_DECL_TCP_FASTOPEN_CONNECT */ -# ifdef HAVE_DECL_MSG_FASTOPEN +# if defined(HAVE_DECL_MSG_FASTOPEN) && HAVE_DECL_MSG_FASTOPEN /* Leave the connect to the later call to sendto() if using TCP*/ if (transport == GETDNS_TRANSPORT_TCP) return fd; @@ -760,7 +760,7 @@ stub_tcp_write(int fd, getdns_tcp_state *tcp, getdns_network_req *netreq) /* We use sendto() here which will do both a connect and send */ #ifdef USE_TCP_FASTOPEN written = sendto(fd, netreq->query - 2, pkt_len + 2, -# ifdef HAVE_DECL_MSG_FASTOPEN +# if defined(HAVE_DECL_MSG_FASTOPEN) && HAVE_DECL_MSG_FASTOPEN MSG_FASTOPEN, # else 0,