From: Willy Tarreau Date: Sun, 16 Aug 2009 12:13:47 +0000 (+0200) Subject: [BUILD] fix build for systems without SOL_TCP X-Git-Tag: v1.4-dev3~49 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c9fce2fee83cfaaee026595db8ce020f7b264d02;p=thirdparty%2Fhaproxy.git [BUILD] fix build for systems without SOL_TCP Andrew Azarov reported that haproxy-1.4-dev1 does not build under FreeBSD 7.2 because SOL_TCP is not defined. So add a check for its definition before using it. This only impacts network optimisations anyway. --- diff --git a/src/backend.c b/src/backend.c index a67d648462..baa301a552 100644 --- a/src/backend.c +++ b/src/backend.c @@ -1968,7 +1968,7 @@ int connect_server(struct session *s) } } -#ifdef TCP_QUICKACK +#if defined(TCP_QUICKACK) && defined(SOL_TCP) /* disabling tcp quick ack now allows the first request to leave the * machine with the first ACK. We only do this if there are pending * data in the buffer. diff --git a/src/checks.c b/src/checks.c index 40fb698ef9..211a2ec59a 100644 --- a/src/checks.c +++ b/src/checks.c @@ -678,7 +678,7 @@ struct task *process_chk(struct task *t) } if (s->result == SRV_CHK_UNKNOWN) { -#ifdef TCP_QUICKACK +#if defined(TCP_QUICKACK) && defined(SOL_TCP) /* disabling tcp quick ack now allows * the request to leave the machine with * the first ACK. diff --git a/src/proto_tcp.c b/src/proto_tcp.c index 99900e452c..0091464dcc 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -251,7 +251,7 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen) } } #endif -#ifdef TCP_MAXSEG +#if defined(TCP_MAXSEG) && defined(SOL_TCP) if (listener->maxseg) { if (setsockopt(fd, SOL_TCP, TCP_MAXSEG, &listener->maxseg, sizeof(listener->maxseg)) == -1) { @@ -272,7 +272,7 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen) goto tcp_close_return; } -#ifdef TCP_QUICKACK +#if defined(TCP_QUICKACK) && defined(SOL_TCP) if (listener->options & LI_O_NOQUICKACK) setsockopt(fd, SOL_TCP, TCP_QUICKACK, (char *) &zero, sizeof(zero)); #endif diff --git a/src/stream_sock.c b/src/stream_sock.c index 00cb9e8be0..f20bb3f0cd 100644 --- a/src/stream_sock.c +++ b/src/stream_sock.c @@ -587,7 +587,7 @@ static int stream_sock_write_loop(struct stream_interface *si, struct buffer *b) max = b->send_max; -#ifdef TCP_CORK +#if defined(TCP_CORK) && defined(SOL_TCP) /* * Check if we want to cork output before sending. This typically occurs * when there are data left in the buffer, or when we reached the end of @@ -670,7 +670,7 @@ static int stream_sock_write_loop(struct stream_interface *si, struct buffer *b) */ if (unlikely((fdtab[si->fd].flags & (FD_FL_TCP|FD_FL_TCP_NODELAY)) == FD_FL_TCP && (b->flags & BF_EMPTY))) { if ((b->flags & (BF_SHUTW|BF_SHUTW_NOW|BF_HIJACK|BF_WRITE_ENA|BF_SHUTR)) != (BF_WRITE_ENA|BF_SHUTR)) { -#ifdef TCP_CORK +#if defined(TCP_CORK) && defined(SOL_TCP) if (fdtab[si->fd].flags & FD_FL_TCP_CORK) setsockopt(si->fd, SOL_TCP, TCP_CORK, (char *) &zero, sizeof(zero)); #endif