mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-22 10:10:06 +00:00
The commit adds a fairly comprehensive unit test suite for our new PROXYv2 handling code. The unit tests suite ensures both the correctness of the code and ensures that the part responsible for handling incoming headers is very strict regarding what to accept as valid.
62 lines
2.8 KiB
C
62 lines
2.8 KiB
C
/*
|
|
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
*
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
*
|
|
* See the COPYRIGHT file distributed with this work for additional
|
|
* information regarding copyright ownership.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
static char proxy_v2_header[] = { 0x0d, 0x0a, 0x0d, 0x0a, 0x00, 0x0d, 0x0a,
|
|
0x51, 0x55, 0x49, 0x54, 0x0a, 0x21, 0x11,
|
|
0x00, 0x0c, 0x7f, 0x00, 0x00, 0x01, 0x7f,
|
|
0x00, 0x00, 0x42, 0xdd, 0xd0, 0x2e, 0x6b };
|
|
|
|
static char proxy_v2_header_with_TLS[] = {
|
|
0x0d, 0x0a, 0x0d, 0x0a, 0x00, 0x0d, 0x0a, 0x51, 0x55, 0x49, 0x54, 0x0a,
|
|
0x21, 0x11, 0x00, 0x1e, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00, 0x00, 0x43,
|
|
0x9b, 0x4a, 0x2e, 0x6b, 0x20, 0x00, 0x0f, 0x01, 0x00, 0x00, 0x00, 0x00,
|
|
0x21, 0x00, 0x07, 0x54, 0x4c, 0x53, 0x76, 0x31, 0x2e, 0x32
|
|
};
|
|
|
|
static char proxy_v2_header_with_TLS_CN[] = {
|
|
0x0d, 0x0a, 0x0d, 0x0a, 0x00, 0x0d, 0x0a, 0x51, 0x55, 0x49, 0x54, 0x0a,
|
|
0x21, 0x11, 0x00, 0x2a, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00, 0x00, 0x43,
|
|
0x9d, 0xd2, 0x2e, 0x6b, 0x20, 0x00, 0x1b, 0x07, 0x00, 0x00, 0x00, 0x00,
|
|
0x21, 0x00, 0x07, 0x54, 0x4c, 0x53, 0x76, 0x31, 0x2e, 0x32, 0x22, 0x00,
|
|
0x09, 0x6d, 0x71, 0x74, 0x74, 0x75, 0x73, 0x65, 0x72, 0x31
|
|
};
|
|
|
|
/*
|
|
* SRC ADDR: /run/src.sock
|
|
* DST ADDR: /run/dst.sock
|
|
*/
|
|
static char proxy_v2_header_with_AF_UNIX[] = {
|
|
0x0d, 0x0a, 0x0d, 0x0a, 0x00, 0x0d, 0x0a, 0x51, 0x55, 0x49, 0x54, 0x0a,
|
|
0x21, 0x32, 0x00, 0xd8, 0x2f, 0x72, 0x75, 0x6e, 0x2f, 0x73, 0x72, 0x63,
|
|
0x2e, 0x73, 0x6f, 0x63, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x2f, 0x72, 0x75, 0x6e, 0x2f, 0x64, 0x73, 0x74,
|
|
0x2e, 0x73, 0x6f, 0x63, 0x6b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
0x00, 0x00, 0x00, 0x00
|
|
};
|