summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilly Tarreau <w@1wt.eu>2014-06-14 11:41:36 +0200
committerWilly Tarreau <w@1wt.eu>2014-06-14 11:46:02 +0200
commit4c20d29c296d6bce6a0e173a26011d8c406aba6d (patch)
tree81a0e437e42145c2a6262b8db91fe4df1e27685d
parentb00d17a034ec3853c3bb406626f6aff167dd6c68 (diff)
downloadhaproxy-4c20d29c296d6bce6a0e173a26011d8c406aba6d.tar.gz
BUG/MINOR: connection: make proxy protocol v1 support the UNKNOWN protocol
If haproxy receives a connection over a unix socket and forwards it to another haproxy instance using proxy protocol v1, it sends an UNKNOWN protocol, which is rejected by the other side. Make the receiver accept the UNKNOWN protocol as per the spec, and only use the local connection's address for this.
-rw-r--r--src/connection.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/connection.c b/src/connection.c
index 91ad0b63d..93db7e5ac 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -286,7 +286,7 @@ int conn_recv_proxy(struct connection *conn, int flag)
}
line += 6;
- if (trash.len < 18) /* shortest possible line */
+ if (trash.len < 9) /* shortest possible line */
goto missing;
if (!memcmp(line, "TCP4 ", 5) != 0) {
@@ -391,8 +391,12 @@ int conn_recv_proxy(struct connection *conn, int flag)
((struct sockaddr_in6 *)&conn->addr.to)->sin6_port = htons(dport);
conn->flags |= CO_FL_ADDR_FROM_SET | CO_FL_ADDR_TO_SET;
}
+ else if (memcmp(line, "UNKNOWN\r\n", 9) == 0) {
+ /* This can be a UNIX socket forwarded by an haproxy upstream */
+ line += 9;
+ }
else {
- /* The protocol does not match something known (TCP4/TCP6) */
+ /* The protocol does not match something known (TCP4/TCP6/UNKNOWN) */
conn->err_code = CO_ER_PRX_BAD_PROTO;
goto fail;
}