Skip to content

Commit

Permalink
core: fixed haproxy protocol parser
Browse files Browse the repository at this point in the history
fixes GH #3683
  • Loading branch information
ivanuschak authored and miconda committed Dec 28, 2023
1 parent 23a1d06 commit c523783
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/core/tcp_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1018,25 +1018,25 @@ 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;

case 0x21: /* TCPv6 */
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;

Expand Down

0 comments on commit c523783

Please sign in to comment.