[BUILD] compilation of haproxy-1.4-dev2 on FreeBSD

Please consider the following patches. They are required to
compile haproxy-1.4-dev2 on FreeBSD.

Summary:
1) include <sys/types.h> before <netinet/tcp.h>
2) Use IPPROTO_TCP instead of SOL_TCP
(they are both defined as 6, TCP protocol number)
This commit is contained in:
Dmitry Sivachenko 2009-08-24 15:11:06 +04:00 committed by Willy Tarreau
parent 6db06d3870
commit caf58986fb
4 changed files with 14 additions and 12 deletions

View File

@ -17,6 +17,7 @@
#include <syslog.h> #include <syslog.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <sys/types.h>
#include <common/compat.h> #include <common/compat.h>
#include <common/config.h> #include <common/config.h>

View File

@ -20,6 +20,7 @@
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netinet/tcp.h> #include <netinet/tcp.h>
#include <arpa/inet.h> #include <arpa/inet.h>
@ -670,13 +671,13 @@ struct task *process_chk(struct task *t)
} }
if (s->result == SRV_CHK_UNKNOWN) { if (s->result == SRV_CHK_UNKNOWN) {
#if defined(TCP_QUICKACK) && defined(SOL_TCP) #if defined(TCP_QUICKACK)
/* disabling tcp quick ack now allows /* disabling tcp quick ack now allows
* the request to leave the machine with * the request to leave the machine with
* the first ACK. * the first ACK.
*/ */
if (s->proxy->options2 & PR_O2_SMARTCON) if (s->proxy->options2 & PR_O2_SMARTCON)
setsockopt(fd, SOL_TCP, TCP_QUICKACK, (char *) &zero, sizeof(zero)); setsockopt(fd, IPPROTO_TCP, TCP_QUICKACK, (char *) &zero, sizeof(zero));
#endif #endif
if ((connect(fd, (struct sockaddr *)&sa, sizeof(sa)) != -1) || (errno == EINPROGRESS)) { if ((connect(fd, (struct sockaddr *)&sa, sizeof(sa)) != -1) || (errno == EINPROGRESS)) {
/* OK, connection in progress or established */ /* OK, connection in progress or established */

View File

@ -18,14 +18,14 @@
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <netinet/tcp.h>
#include <sys/param.h> #include <sys/param.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/un.h> #include <sys/un.h>
#include <netinet/tcp.h>
#include <common/cfgparse.h> #include <common/cfgparse.h>
#include <common/compat.h> #include <common/compat.h>
#include <common/config.h> #include <common/config.h>
@ -368,13 +368,13 @@ int tcpv4_connect_server(struct stream_interface *si,
} }
} }
#if defined(TCP_QUICKACK) && defined(SOL_TCP) #if defined(TCP_QUICKACK)
/* disabling tcp quick ack now allows the first request to leave the /* 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 * machine with the first ACK. We only do this if there are pending
* data in the buffer. * data in the buffer.
*/ */
if ((be->options2 & PR_O2_SMARTCON) && si->ob->send_max) if ((be->options2 & PR_O2_SMARTCON) && si->ob->send_max)
setsockopt(fd, SOL_TCP, TCP_QUICKACK, (char *) &zero, sizeof(zero)); setsockopt(fd, IPPROTO_TCP, TCP_QUICKACK, (char *) &zero, sizeof(zero));
#endif #endif
if ((connect(fd, (struct sockaddr *)srv_addr, sizeof(struct sockaddr_in)) == -1) && if ((connect(fd, (struct sockaddr *)srv_addr, sizeof(struct sockaddr_in)) == -1) &&
@ -511,9 +511,9 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen)
} }
} }
#endif #endif
#if defined(TCP_MAXSEG) && defined(SOL_TCP) #if defined(TCP_MAXSEG)
if (listener->maxseg) { if (listener->maxseg) {
if (setsockopt(fd, SOL_TCP, TCP_MAXSEG, if (setsockopt(fd, IPPROTO_TCP, TCP_MAXSEG,
&listener->maxseg, sizeof(listener->maxseg)) == -1) { &listener->maxseg, sizeof(listener->maxseg)) == -1) {
msg = "cannot set MSS"; msg = "cannot set MSS";
err |= ERR_WARN; err |= ERR_WARN;
@ -532,9 +532,9 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen)
goto tcp_close_return; goto tcp_close_return;
} }
#if defined(TCP_QUICKACK) && defined(SOL_TCP) #if defined(TCP_QUICKACK)
if (listener->options & LI_O_NOQUICKACK) if (listener->options & LI_O_NOQUICKACK)
setsockopt(fd, SOL_TCP, TCP_QUICKACK, (char *) &zero, sizeof(zero)); setsockopt(fd, IPPROTO_TCP, TCP_QUICKACK, (char *) &zero, sizeof(zero));
#endif #endif
/* the socket is ready */ /* the socket is ready */

View File

@ -16,12 +16,12 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <netinet/tcp.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <netinet/tcp.h>
#include <common/compat.h> #include <common/compat.h>
#include <common/config.h> #include <common/config.h>
#include <common/debug.h> #include <common/debug.h>