[prev in list] [next in list] [prev in thread] [next in thread]
List: openser-devel
Subject: [sr-dev] git:master:c5237830: core: fixed haproxy protocol parser
From: Daniel-Constantin Mierla via sr-dev <sr-dev () lists ! kamailio ! org>
Date: 2023-12-28 10:05:41
Message-ID: E1rInGn-0000Tj-Cj () www ! kamailio ! org
[Download RAW message or body]
Module: kamailio
Branch: master
Commit: c5237830f3e7fbeec403a0190471a066081c1117
URL: https://github.com/kamailio/kamailio/commit/c5237830f3e7fbeec403a0190471a066081c1117
Author: Nikolay Ivanuschak <ivanuschak.nikolay@gmail.com>
Committer: Daniel-Constantin Mierla <miconda@gmail.com>
Date: 2023-12-28T11:05:14+01:00
core: fixed haproxy protocol parser
fixes GH #3683
---
Modified: src/core/tcp_main.c
---
Diff: https://github.com/kamailio/kamailio/commit/c5237830f3e7fbeec403a0190471a066081c1117.diff
Patch: https://github.com/kamailio/kamailio/commit/c5237830f3e7fbeec403a0190471a066081c1117.patch
---
diff --git a/src/core/tcp_main.c b/src/core/tcp_main.c
index 4972b7d20af..35034d1baa8 100644
--- a/src/core/tcp_main.c
+++ b/src/core/tcp_main.c
@@ -1018,12 +1018,12 @@ int tcpconn_read_haproxy(struct tcp_connection *c)
src_ip->af = AF_INET;
src_ip->len = 4;
src_ip->u.addr32[0] = hdr.v2.addr.ip4.src_addr;
- c->rcv.src_port = hdr.v2.addr.ip4.src_port;
+ c->rcv.src_port = htons(hdr.v2.addr.ip4.src_port);
dst_ip->af = AF_INET;
dst_ip->len = 4;
dst_ip->u.addr32[0] = hdr.v2.addr.ip4.dst_addr;
- c->rcv.dst_port = hdr.v2.addr.ip4.dst_port;
+ c->rcv.dst_port = htons(hdr.v2.addr.ip4.dst_port);
goto done;
@@ -1031,12 +1031,12 @@ int tcpconn_read_haproxy(struct tcp_connection *c)
src_ip->af = AF_INET6;
src_ip->len = 16;
memcpy(src_ip->u.addr, hdr.v2.addr.ip6.src_addr, 16);
- c->rcv.src_port = hdr.v2.addr.ip6.src_port;
+ c->rcv.src_port = htons(hdr.v2.addr.ip6.src_port);
dst_ip->af = AF_INET6;
dst_ip->len = 16;
- memcpy(dst_ip->u.addr, hdr.v2.addr.ip6.src_addr, 16);
- c->rcv.dst_port = hdr.v2.addr.ip6.dst_port;
+ memcpy(dst_ip->u.addr, hdr.v2.addr.ip6.dst_addr, 16);
+ c->rcv.dst_port = htons(hdr.v2.addr.ip6.dst_port);
goto done;
_______________________________________________
Kamailio (SER) - Development Mailing List
To unsubscribe send an email to sr-dev-leave@lists.kamailio.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic