From caf58986fbb59a0b38bf81170a0a55fefc8c74bf Mon Sep 17 00:00:00 2001 From: Dmitry Sivachenko Date: Mon, 24 Aug 2009 15:11:06 +0400 Subject: [PATCH] [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 before 2) Use IPPROTO_TCP instead of SOL_TCP (they are both defined as 6, TCP protocol number) --- src/backend.c | 1 + src/checks.c | 5 +++-- src/proto_tcp.c | 16 ++++++++-------- src/stream_sock.c | 4 ++-- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/backend.c b/src/backend.c index 7a6b7b8f4..05ce1ef21 100644 --- a/src/backend.c +++ b/src/backend.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include diff --git a/src/checks.c b/src/checks.c index 00751fefd..99c21224f 100644 --- a/src/checks.c +++ b/src/checks.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -670,13 +671,13 @@ struct task *process_chk(struct task *t) } if (s->result == SRV_CHK_UNKNOWN) { -#if defined(TCP_QUICKACK) && defined(SOL_TCP) +#if defined(TCP_QUICKACK) /* disabling tcp quick ack now allows * the request to leave the machine with * the first ACK. */ 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 if ((connect(fd, (struct sockaddr *)&sa, sizeof(sa)) != -1) || (errno == EINPROGRESS)) { /* OK, connection in progress or established */ diff --git a/src/proto_tcp.c b/src/proto_tcp.c index 6f368da98..73a2ba6eb 100644 --- a/src/proto_tcp.c +++ b/src/proto_tcp.c @@ -18,14 +18,14 @@ #include #include -#include - #include #include #include #include #include +#include + #include #include #include @@ -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 * machine with the first ACK. We only do this if there are pending * data in the buffer. */ 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 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 -#if defined(TCP_MAXSEG) && defined(SOL_TCP) +#if defined(TCP_MAXSEG) if (listener->maxseg) { - if (setsockopt(fd, SOL_TCP, TCP_MAXSEG, + if (setsockopt(fd, IPPROTO_TCP, TCP_MAXSEG, &listener->maxseg, sizeof(listener->maxseg)) == -1) { msg = "cannot set MSS"; err |= ERR_WARN; @@ -532,9 +532,9 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen) goto tcp_close_return; } -#if defined(TCP_QUICKACK) && defined(SOL_TCP) +#if defined(TCP_QUICKACK) 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 /* the socket is ready */ diff --git a/src/stream_sock.c b/src/stream_sock.c index 79426fb14..b2bacdcfb 100644 --- a/src/stream_sock.c +++ b/src/stream_sock.c @@ -16,12 +16,12 @@ #include #include -#include - #include #include #include +#include + #include #include #include