From 9a3327676c054ea294db2b5d7c14c5b9eaf1d406 Mon Sep 17 00:00:00 2001 From: Trekkie Coder Date: Sun, 24 Nov 2024 13:37:03 +0900 Subject: [PATCH] loxilb-io/loxilb#675 Initial support for proxy protocol v2 --- common/parsing_helpers.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/common/parsing_helpers.h b/common/parsing_helpers.h index 2b16a69..8e49f7e 100644 --- a/common/parsing_helpers.h +++ b/common/parsing_helpers.h @@ -359,6 +359,27 @@ struct sctp_cookie { __be32 cookie; }; +struct proxy_hdr_v2 { + __u8 sig[12]; /* hex 0D 0A 0D 0A 00 0D 0A 51 55 49 54 0A */ + __u8 ver_cmd; /* protocol version and command */ + __u8 family; /* protocol family and address */ + __be16 len; /* number of following bytes part of the header */ +}; + +struct proxy_ipv4_hdr { /* for TCP/UDP over IPv4, len = 12 */ + __be32 src_addr; + __be32 dst_addr; + __be16 src_port; + __be16 dst_port; +}; + +struct proxy_ipv6_hdr { /* for TCP/UDP over IPv4, len = 36 */ + __u8 src_addr[16]; + __u8 dst_addr[16]; + __be16 src_port; + __be16 dst_port; +}; + struct mkrt_args { uint32_t seq; uint8_t fin:1;