mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 05:41:26 +02:00
MINOR: accept-proxy: support proxy protocol v2 CRC32c checksum
When proxy protocol v2 CRC32c tlv is received, check it before accept connection (as describe in "doc/proxy-protocol.txt").
This commit is contained in:
parent
4399c75f6c
commit
115df3e38e
@ -613,6 +613,14 @@ int conn_recv_proxy(struct connection *conn, int flag)
|
|||||||
tlv_offset += tlv_len + TLV_HEADER_SIZE;
|
tlv_offset += tlv_len + TLV_HEADER_SIZE;
|
||||||
|
|
||||||
switch (tlv_packet->type) {
|
switch (tlv_packet->type) {
|
||||||
|
case PP2_TYPE_CRC32C: {
|
||||||
|
void *tlv_crc32c_p = (void *)tlv_packet->value;
|
||||||
|
uint32_t n_crc32c = ntohl(read_u32(tlv_crc32c_p));
|
||||||
|
write_u32(tlv_crc32c_p, 0);
|
||||||
|
if (hash_crc32c(trash.str, PP2_HEADER_LEN + ntohs(hdr_v2->len)) != n_crc32c)
|
||||||
|
goto bad_header;
|
||||||
|
break;
|
||||||
|
}
|
||||||
#ifdef CONFIG_HAP_NS
|
#ifdef CONFIG_HAP_NS
|
||||||
case PP2_TYPE_NETNS: {
|
case PP2_TYPE_NETNS: {
|
||||||
const struct netns_entry *ns;
|
const struct netns_entry *ns;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user