Nikos Mavrogiannopoulos
bc961061d1
worker: fix PP2_SUBTYPE_SSL_CN parsed as top-level TLV instead of sub-TLV
...
Per proxy protocol v2 spec §2.2.6, PP2_SUBTYPE_SSL_CN (0x22) is a
sub-TLV inside the PP2_TYPE_SSL body, not a top-level TLV in the TLV
stream. The previous code looked for 0x22 at the top level, where
haproxy never sends it, so client certificate CN was never extracted
via proxy protocol.
Fix parse_ssl_tlvs() to scan the bytes after the fixed pp2_tlv_ssl
header as a nested sub-TLV loop when cert_auth_ok is set.
Also fix htons() -> ntohs() for the TLV length byte-swap (functionally
identical but semantically correct for a network-to-host conversion),
and update the misleading comment that claimed the field was
little-endian.
Add tests/proxyproto-v2.c, a unit test that feeds a binary proxy
protocol v2 packet with PP2_TYPE_SSL + PP2_SUBTYPE_SSL_CN sub-TLV
through parse_proxy_proto_header() and verifies that cert_auth_ok and
cert_username are populated correctly. Also covers verify!=0, missing
CERT_SESS flag, no CN sub-TLV, and TCP conn_type (TLV parsing skipped).
Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com >
2026-04-16 22:46:41 +02:00
..
2026-02-28 11:46:56 +01:00
2026-04-14 13:26:32 -04:00
2021-10-09 17:57:11 +02:00
2026-04-14 13:26:32 -04:00
2021-10-31 22:26:25 +01:00
2022-11-28 11:22:33 +01:00
2026-03-20 20:47:35 +01:00
2026-03-20 20:47:35 +01:00
2026-03-20 20:47:35 +01:00
2026-03-20 20:47:35 +01:00
2023-06-10 16:21:34 +08:00
2021-11-01 10:23:01 +01:00
2026-04-02 23:04:29 +02:00
2026-03-22 12:29:59 +01:00
2023-06-10 16:21:34 +08:00
2026-04-14 13:26:32 -04:00
2026-03-29 17:32:23 +02:00
2026-03-22 12:29:59 +01:00
2022-11-28 11:22:33 +01:00
2026-03-20 20:47:27 +01:00
2026-03-20 20:47:27 +01:00
2026-03-29 17:32:16 +02:00
2026-03-22 12:29:59 +01:00
2026-03-29 21:13:28 +02:00
2026-03-22 12:29:59 +01:00
2023-06-10 16:21:34 +08:00
2023-06-10 16:21:34 +08:00
2023-06-10 16:21:34 +08:00
2026-03-29 16:55:12 +02:00
2026-03-29 16:55:12 +02:00
2024-12-06 12:08:52 +01:00
2023-06-10 16:21:34 +08:00
2026-03-22 12:29:59 +01:00
2026-03-22 12:29:59 +01:00
2026-03-22 12:29:59 +01:00
2026-01-07 15:46:16 -05:00
2026-01-07 15:46:16 -05:00
2026-03-22 12:29:59 +01:00
2020-08-09 13:14:22 +02:00
2026-01-07 15:46:16 -05:00
2026-03-22 12:29:59 +01:00
2026-01-07 15:46:16 -05:00
2026-03-22 12:29:59 +01:00
2026-03-22 12:29:59 +01:00
2024-12-01 17:01:05 +01:00
2026-03-22 12:29:59 +01:00
2026-01-07 15:46:16 -05:00
2026-03-22 12:29:59 +01:00
2026-03-22 12:29:59 +01:00
2026-04-16 22:46:41 +02:00
2023-06-10 16:21:34 +08:00
2026-03-20 20:47:35 +01:00
2026-03-22 12:29:59 +01:00
2023-06-10 16:21:34 +08:00
2023-06-10 16:21:34 +08:00
2026-03-15 21:05:36 +01:00
2026-03-20 20:47:35 +01:00
2026-03-20 20:47:35 +01:00
2026-04-13 22:43:52 +02:00
2023-06-10 16:21:34 +08:00
2026-01-07 15:46:16 -05:00
2026-03-29 17:32:16 +02:00
2026-04-16 22:46:41 +02:00
2026-03-20 20:47:35 +01:00
2026-03-20 20:47:35 +01:00
2026-03-22 12:29:59 +01:00
2026-03-22 12:29:59 +01:00
2026-03-22 12:29:59 +01:00
2026-03-22 12:29:59 +01:00
2026-04-06 21:27:28 +02:00
2026-03-22 12:29:59 +01:00
2023-12-29 21:18:28 +01:00
2023-12-29 21:18:28 +01:00
2026-01-11 09:04:18 +01:00
2020-08-09 13:14:22 +02:00
2020-08-09 13:14:22 +02:00
2026-03-22 12:29:59 +01:00
2026-03-20 20:47:35 +01:00
2026-01-07 15:46:16 -05:00
2024-12-01 17:01:05 +01:00
2026-03-22 12:29:59 +01:00
2026-03-20 20:47:35 +01:00
2026-03-22 12:29:59 +01:00
2026-03-22 12:29:59 +01:00
2026-03-20 20:47:35 +01:00
2023-06-10 16:21:34 +08:00
2023-06-10 16:21:34 +08:00
2026-03-20 20:47:35 +01:00
2023-07-11 22:48:22 +12:00
2023-06-10 16:21:34 +08:00
2023-12-29 21:18:28 +01:00
2024-04-23 21:35:00 +02:00
2024-04-23 21:35:00 +02:00
2026-03-20 20:47:35 +01:00
2026-03-20 20:47:35 +01:00
2026-03-20 20:47:35 +01:00
2023-06-10 16:21:34 +08:00
2026-03-20 20:47:35 +01:00
2023-06-10 16:21:34 +08:00
2026-03-29 16:55:12 +02:00
2020-08-09 13:14:22 +02:00
2023-06-22 12:29:02 +02:00
2020-08-09 13:14:22 +02:00
2023-06-10 16:21:34 +08:00
2020-08-09 13:14:22 +02:00
2023-06-10 16:21:34 +08:00
2023-06-10 16:21:34 +08:00
2023-06-10 16:21:34 +08:00
2026-03-20 20:47:35 +01:00
2023-06-10 16:21:34 +08:00
2026-03-22 12:29:59 +01:00
2026-03-22 12:29:59 +01:00
2026-03-22 12:29:59 +01:00
2026-03-22 12:29:59 +01:00
2026-04-14 13:26:32 -04:00
2026-03-22 12:29:59 +01:00
2026-03-22 12:29:59 +01:00
2026-03-20 20:47:35 +01:00
2026-04-03 13:58:18 +02:00
2026-03-20 20:47:35 +01:00
2022-11-28 11:22:33 +01:00
2023-06-10 16:21:34 +08:00
2023-06-10 16:21:34 +08:00
2026-04-03 12:29:01 +02:00
2026-04-03 12:29:01 +02:00
2026-02-28 11:46:56 +01:00
2023-06-10 16:21:34 +08:00
2023-06-10 16:21:34 +08:00
2026-03-20 20:47:35 +01:00
2026-03-22 12:29:59 +01:00
2023-06-10 16:21:34 +08:00
2023-07-11 22:48:22 +12:00
2026-03-22 12:29:59 +01:00
2023-06-10 16:21:34 +08:00
2026-03-22 22:54:48 +01:00
2023-06-10 16:21:34 +08:00
2020-08-09 13:14:22 +02:00
2023-06-10 16:21:34 +08:00
2026-03-20 20:47:35 +01:00
2026-03-20 20:47:35 +01:00
2026-03-20 20:47:35 +01:00
2026-04-09 20:20:45 -04:00
2026-04-14 13:59:05 -04:00
2026-03-22 12:29:59 +01:00
2026-01-07 15:46:16 -05:00
2026-01-11 09:15:14 +01:00
2026-03-22 12:29:59 +01:00