Update to 1.8.0

This commit is contained in:
Ryan O'Hara 2018-01-05 09:32:17 -06:00
parent 88f3a94076
commit e7afd2a801
5 changed files with 75 additions and 168 deletions

View File

@ -1,6 +1,21 @@
--- contrib/halog/halog.c.orig 2014-07-25 01:56:07.000000000 -0500
+++ contrib/halog/halog.c 2014-07-25 15:24:56.996876765 -0500
@@ -462,7 +462,7 @@ int convert_date(const char *field)
From f5a4b94ce9febc3b171a40f5d5fb6d0b0f9150e1 Mon Sep 17 00:00:00 2001
From: Ryan O'Hara <rohara@redhat.com>
Date: Fri, 15 Dec 2017 10:01:31 -0600
Subject: [PATCH 2/2] Fix compiler warnings in halog.c
There were several unused variables in halog.c that each caused a
compiler warning [-Wunused-but-set-variable]. This patch simply
removes the declaration of said vairables and any instance where the
unused variable was assigned a value.
---
contrib/halog/halog.c | 25 ++++++++-----------------
1 file changed, 8 insertions(+), 17 deletions(-)
diff --git a/contrib/halog/halog.c b/contrib/halog/halog.c
index fc336b4d..a7248173 100644
--- a/contrib/halog/halog.c
+++ b/contrib/halog/halog.c
@@ -466,7 +466,7 @@ int convert_date(const char *field)
{
unsigned int h, m, s, ms;
unsigned char c;
@ -9,7 +24,7 @@
h = m = s = ms = 0;
e = field;
@@ -477,7 +477,6 @@ int convert_date(const char *field)
@@ -481,7 +481,6 @@ int convert_date(const char *field)
}
/* hour + ':' */
@ -17,7 +32,7 @@
while (1) {
c = *(e++) - '0';
if (c > 9)
@@ -488,7 +487,6 @@ int convert_date(const char *field)
@@ -492,7 +491,6 @@ int convert_date(const char *field)
goto out_err;
/* minute + ':' */
@ -25,7 +40,7 @@
while (1) {
c = *(e++) - '0';
if (c > 9)
@@ -499,7 +497,6 @@ int convert_date(const char *field)
@@ -503,7 +501,6 @@ int convert_date(const char *field)
goto out_err;
/* second + '.' or ']' */
@ -33,7 +48,7 @@
while (1) {
c = *(e++) - '0';
if (c > 9)
@@ -512,7 +509,6 @@ int convert_date(const char *field)
@@ -516,7 +513,6 @@ int convert_date(const char *field)
/* if there's a '.', we have milliseconds */
if (c == (unsigned char)('.' - '0')) {
/* millisecond second + ']' */
@ -41,7 +56,7 @@
while (1) {
c = *(e++) - '0';
if (c > 9)
@@ -535,7 +531,7 @@ int convert_date_to_timestamp(const char
@@ -539,7 +535,7 @@ int convert_date_to_timestamp(const char *field)
{
unsigned int d, mo, y, h, m, s;
unsigned char c;
@ -50,7 +65,7 @@
time_t rawtime;
static struct tm * timeinfo;
static int last_res;
@@ -622,7 +618,6 @@ int convert_date_to_timestamp(const char
@@ -626,7 +622,6 @@ int convert_date_to_timestamp(const char *field)
}
/* hour + ':' */
@ -58,7 +73,7 @@
while (1) {
c = *(e++) - '0';
if (c > 9)
@@ -633,7 +628,6 @@ int convert_date_to_timestamp(const char
@@ -637,7 +632,6 @@ int convert_date_to_timestamp(const char *field)
goto out_err;
/* minute + ':' */
@ -66,7 +81,7 @@
while (1) {
c = *(e++) - '0';
if (c > 9)
@@ -644,7 +638,6 @@ int convert_date_to_timestamp(const char
@@ -648,7 +642,6 @@ int convert_date_to_timestamp(const char *field)
goto out_err;
/* second + '.' or ']' */
@ -74,7 +89,7 @@
while (1) {
c = *(e++) - '0';
if (c > 9)
@@ -686,10 +679,10 @@ void truncated_line(int linenum, const c
@@ -690,10 +683,10 @@ void truncated_line(int linenum, const char *line)
int main(int argc, char **argv)
{
@ -87,7 +102,7 @@
struct timer *t = NULL;
struct eb32_node *n;
struct url_stat *ustat = NULL;
@@ -941,7 +934,7 @@ int main(int argc, char **argv)
@@ -945,7 +938,7 @@ int main(int argc, char **argv)
}
}
@ -96,7 +111,7 @@
/* we have field TIME_FIELD in [time_field]..[e-1] */
p = time_field;
f = 0;
@@ -965,17 +958,15 @@ int main(int argc, char **argv)
@@ -969,17 +962,15 @@ int main(int argc, char **argv)
}
}
@ -115,7 +130,7 @@
}
if (++f == 4)
break;
@@ -1701,7 +1692,7 @@ void filter_count_ip(const char *source_
@@ -1706,7 +1697,7 @@ void filter_count_ip(const char *source_field, const char *accept_field, const c
void filter_graphs(const char *accept_field, const char *time_field, struct timer **tptr)
{
struct timer *t2;
@ -124,7 +139,7 @@
int f, err, array[5];
if (!time_field) {
@@ -1712,7 +1703,7 @@ void filter_graphs(const char *accept_fi
@@ -1717,7 +1708,7 @@ void filter_graphs(const char *accept_field, const char *time_field, struct time
}
}
@ -133,3 +148,6 @@
/* we have field TIME_FIELD in [time_field]..[e-1] */
p = time_field;
--
2.14.2

View File

@ -0,0 +1,34 @@
From 84c6a66cdb51bd5a279ab35216bb6f0710e2a626 Mon Sep 17 00:00:00 2001
From: Ryan O'Hara <rohara@redhat.com>
Date: Fri, 15 Dec 2017 09:58:09 -0600
Subject: [PATCH 1/2] Fix compiler warning in iprange.c
The declaration of main() in iprange.c did not specify a type, causing
a compiler warning [-Wimplicit-int]. This patch simply declares main()
to be type 'int' and calls exit(0) at the end of the function.
---
contrib/iprange/iprange.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/contrib/iprange/iprange.c b/contrib/iprange/iprange.c
index 91690c77..abae0076 100644
--- a/contrib/iprange/iprange.c
+++ b/contrib/iprange/iprange.c
@@ -111,7 +111,7 @@ static void usage(const char *argv0)
"\n", argv0);
}
-main(int argc, char **argv)
+int main(int argc, char **argv)
{
char line[MAXLINE];
int l, lnum;
@@ -198,4 +198,5 @@ main(int argc, char **argv)
convert_range(sa, da, he, NULL);
}
}
+ exit(0);
}
--
2.14.2

View File

@ -1,131 +0,0 @@
From efc843e57ea96ea198c63398c454430bc9e6cbcc Mon Sep 17 00:00:00 2001
From: Willy Tarreau <w@1wt.eu>
Date: Wed, 4 Feb 2015 00:45:58 +0100
Subject: [PATCH] MEDIUM: tcp: implement tcp-ut bind option to set
TCP_USER_TIMEOUT
On Linux since 2.6.37, it's possible to set the socket timeout for
pending outgoing data, with an accuracy of 1 millisecond. This is
pretty handy to deal with dead connections to clients and or servers.
For now we only implement it on the frontend side (bind line) so
that when a client disappears from the net, we're able to quickly
get rid of its connection and possibly release a server connection.
This can be useful with long-lived connections where an application
level timeout is not suited because long pauses are expected (remote
terminals, connection pools, etc).
Thanks to Thijs Houtenbos and John Eckersberg for the suggestion.
---
doc/configuration.txt | 13 +++++++++++++
include/types/listener.h | 1 +
src/proto_tcp.c | 42 +++++++++++++++++++++++++++++++++++++++++-
3 files changed, 55 insertions(+), 1 deletion(-)
diff --git a/doc/configuration.txt b/doc/configuration.txt
index d5ecf6c..b4b7701 100644
--- a/doc/configuration.txt
+++ b/doc/configuration.txt
@@ -8637,6 +8637,19 @@ strict-sni
a certificate. The default certificate is not used.
See the "crt" option for more information.
+tcp-ut <delay>
+ Sets the TCP User Timeout for all incoming connections instanciated from this
+ listening socket. This option is available on Linux since version 2.6.37. It
+ allows haproxy to configure a timeout for sockets which contain data not
+ receiving an acknoledgement for the configured delay. This is especially
+ useful on long-lived connections experiencing long idle periods such as
+ remote terminals or database connection pools, where the client and server
+ timeouts must remain high to allow a long period of idle, but where it is
+ important to detect that the client has disappeared in order to release all
+ resources associated with its connection (and the server's session). The
+ argument is a delay expressed in milliseconds by default. This only works
+ for regular TCP connections, and is ignored for other protocols.
+
tfo
Is an optional keyword which is supported only on Linux kernels >= 3.7. It
enables TCP Fast Open on the listening socket, which means that clients which
diff --git a/include/types/listener.h b/include/types/listener.h
index 83b63af..2d71df6 100644
--- a/include/types/listener.h
+++ b/include/types/listener.h
@@ -175,6 +175,7 @@ struct listener {
struct list wait_queue; /* link element to make the listener wait for something (LI_LIMITED) */
unsigned int analysers; /* bitmap of required protocol analysers */
int maxseg; /* for TCP, advertised MSS */
+ int tcp_ut; /* for TCP, user timeout */
char *interface; /* interface name or NULL */
struct list by_fe; /* chaining in frontend's list of listeners */
diff --git a/src/proto_tcp.c b/src/proto_tcp.c
index cfa62f7..e98a9fb 100644
--- a/src/proto_tcp.c
+++ b/src/proto_tcp.c
@@ -838,6 +838,15 @@ int tcp_bind_listener(struct listener *listener, char *errmsg, int errlen)
}
}
#endif
+#if defined(TCP_USER_TIMEOUT)
+ if (listener->tcp_ut) {
+ if (setsockopt(fd, IPPROTO_TCP, TCP_USER_TIMEOUT,
+ &listener->tcp_ut, sizeof(listener->tcp_ut)) == -1) {
+ msg = "cannot set TCP User Timeout";
+ err |= ERR_WARN;
+ }
+ }
+#endif
#if defined(TCP_DEFER_ACCEPT)
if (listener->options & LI_O_DEF_ACCEPT) {
/* defer accept by up to one second */
@@ -1986,8 +1995,36 @@ static int bind_parse_mss(char **args, int cur_arg, struct proxy *px, struct bin
}
#endif
+#ifdef TCP_USER_TIMEOUT
+/* parse the "tcp-ut" bind keyword */
+static int bind_parse_tcp_ut(char **args, int cur_arg, struct proxy *px, struct bind_conf *conf, char **err)
+{
+ const char *ptr = NULL;
+ struct listener *l;
+ unsigned int timeout;
+
+ if (!*args[cur_arg + 1]) {
+ memprintf(err, "'%s' : missing TCP User Timeout value", args[cur_arg]);
+ return ERR_ALERT | ERR_FATAL;
+ }
+
+ ptr = parse_time_err(args[cur_arg + 1], &timeout, TIME_UNIT_MS);
+ if (ptr) {
+ memprintf(err, "'%s' : expects a positive delay in milliseconds", args[cur_arg]);
+ return ERR_ALERT | ERR_FATAL;
+ }
+
+ list_for_each_entry(l, &conf->listeners, by_bind) {
+ if (l->addr.ss_family == AF_INET || l->addr.ss_family == AF_INET6)
+ l->tcp_ut = timeout;
+ }
+
+ return 0;
+}
+#endif
+
#ifdef SO_BINDTODEVICE
-/* parse the "mss" bind keyword */
+/* parse the "interface" bind keyword */
static int bind_parse_interface(char **args, int cur_arg, struct proxy *px, struct bind_conf *conf, char **err)
{
struct listener *l;
@@ -2056,6 +2093,9 @@ static struct bind_kw_list bind_kws = { "TCP", { }, {
#ifdef TCP_MAXSEG
{ "mss", bind_parse_mss, 1 }, /* set MSS of listening socket */
#endif
+#ifdef TCP_USER_TIMEOUT
+ { "tcp-ut", bind_parse_tcp_ut, 1 }, /* set User Timeout on listening socket */
+#endif
#ifdef TCP_FASTOPEN
{ "tfo", bind_parse_tfo, 0 }, /* enable TCP_FASTOPEN of listening socket */
#endif
--
1.9.3

View File

@ -22,8 +22,8 @@ Source3: %{name}.logrotate
Source4: %{name}.sysconfig
Source5: halog.1
Patch0: halog-unused-variables.patch
Patch1: iprange-return-type.patch
Patch0: contrib-halog-compliler-warnings.patch
Patch1: contrib-iprange-compliler-warnings.patch
BuildRequires: lua-devel
BuildRequires: pcre-devel
@ -52,8 +52,8 @@ availability environments. Indeed, it can:
%prep
%setup -q
%patch0 -p0
%patch1 -p0
%patch0 -p1
%patch1 -p1
%build
regparm_opts=
@ -139,6 +139,9 @@ exit 0
%attr(-,%{haproxy_user},%{haproxy_group}) %dir %{haproxy_home}
%changelog
* Fri Dec 15 2017 Ryan O'Hara <rohara@redhat.com> - 1.8.0-1
- Update to 1.8.0
* Mon Sep 11 2017 Ryan O'Hara <rohara@redhat.com> - 1.7.9-1
- Update to 1.7.9 (#1485084)

View File

@ -1,17 +0,0 @@
--- contrib/iprange/iprange.c.orig 2014-06-27 14:01:26.020159479 -0500
+++ contrib/iprange/iprange.c 2014-06-27 14:01:42.149275554 -0500
@@ -111,7 +111,7 @@ static void usage(const char *argv0)
"\n", argv0);
}
-main(int argc, char **argv)
+int main(int argc, char **argv)
{
char line[MAXLINE];
int l, lnum;
@@ -198,4 +198,5 @@ main(int argc, char **argv)
convert_range(sa, da, he, NULL);
}
}
+ exit(0);
}