[sr-dev] [kamailio/kamailio] core: Add PROXY protocol implementation (#1765)

Sebastian Lauwers notifications at github.com
Tue Dec 18 11:14:30 CET 2018


teotwaki commented on this pull request.



> -	if (likely(local_addr)){
-		su2ip_addr(&c->rcv.dst_ip, local_addr);
-		c->rcv.dst_port=su_getport(local_addr);
-	}else if (ba){
-		c->rcv.dst_ip=ba->address;
-		c->rcv.dst_port=ba->port_no;
+	if (unlikely(ksr_tcp_accept_haproxy && state == S_CONN_ACCEPT)) {
+		ret = tcpconn_read_haproxy(c);
+
+		if (ret == -1) {
+			LM_ERR("invalid PROXY protocol header\n");
+			goto error;
+		} else if (ret == 1) {
+			LM_DBG("PROXY protocol did not override IP addresses\n");
+			goto read_ip_info;
+		}

There is an `LM_DBG()` indicating whether we received a PROXY v1 or PROXY v2 header. Do you feel that a parsing-success message is strictly required here (as opposed to a lack of parsing-failure message)?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1765#discussion_r242476737
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20181218/d7fd698b/attachment.html>


More information about the sr-dev mailing list