[sr-dev] git:master:a4d78bb0: core: tcp - allow plain connections when tcp_accept_haproxy=yes

Daniel-Constantin Mierla miconda at gmail.com
Wed Feb 5 17:58:11 CET 2020


Module: kamailio
Branch: master
Commit: a4d78bb01149c4c6bd8adc679e3547af270001a1
URL: https://github.com/kamailio/kamailio/commit/a4d78bb01149c4c6bd8adc679e3547af270001a1

Author: iurri <iurri at messagebird.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2020-02-05T17:56:44+01:00

core: tcp - allow plain connections when tcp_accept_haproxy=yes

- PR #2206

---

Modified: src/core/tcp_main.c

---

Diff:  https://github.com/kamailio/kamailio/commit/a4d78bb01149c4c6bd8adc679e3547af270001a1.diff
Patch: https://github.com/kamailio/kamailio/commit/a4d78bb01149c4c6bd8adc679e3547af270001a1.patch

---

diff --git a/src/core/tcp_main.c b/src/core/tcp_main.c
index a9fdf8445a..e0a66be619 100644
--- a/src/core/tcp_main.c
+++ b/src/core/tcp_main.c
@@ -1107,10 +1107,9 @@ int tcpconn_read_haproxy(struct tcp_connection *c) {
 		}
 	} else if (bytes == 0) {
 		return 1; /* EOF? Return "no IP change" in any case */
-	}
-	else {
-		/* Wrong protocol */
-		return -1;
+	} else {
+		/* not haproxy protocol */
+		return 2;
 	}
 
 done:
@@ -1167,6 +1166,8 @@ struct tcp_connection* tcpconn_new(int sock, union sockaddr_union* su,
 			goto error;
 		} else if (ret == 1) {
 			LM_DBG("PROXY protocol did not override IP addresses\n");
+		} else if (ret == 2) {
+			LM_DBG("PROXY protocol header not found\n");
 		}
 	}
 	print_ip("tcpconn_new: new tcp connection: ", &c->rcv.src_ip, "\n");




More information about the sr-dev mailing list