git://git.exim.org
/
exim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Testsuite: clarify testcase for dnsdb dns:fail event.
[exim.git]
/
src
/
util
/
proxy_protocol_client.pl
diff --git
a/src/util/proxy_protocol_client.pl
b/src/util/proxy_protocol_client.pl
index 7cfc13ddcf88c28f2d3004250b3c7f9325af8846..8253fc4ac1bbde8435ae7288c81d540f91ca6512 100644
(file)
--- a/
src/util/proxy_protocol_client.pl
+++ b/
src/util/proxy_protocol_client.pl
@@
-3,6
+3,7
@@
# Copyright (C) 2014 Todd Lyons
# License GPLv2: GNU GPL version 2
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
# Copyright (C) 2014 Todd Lyons
# License GPLv2: GNU GPL version 2
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
+# SPDX-License-Identifier: GPL-2.0-or-later
#
# This script emulates a proxy which uses Proxy Protocol to communicate
# to a backend server. It should be run from an IP which is configured
#
# This script emulates a proxy which uses Proxy Protocol to communicate
# to a backend server. It should be run from an IP which is configured
@@
-21,6
+22,7
@@
#
use strict;
use warnings;
#
use strict;
use warnings;
+BEGIN { pop @INC if $INC[-1] eq '.' };
use IO::Select;
use IO::Socket;
use Getopt::Long;
use IO::Select;
use IO::Socket;
use Getopt::Long;
@@
-82,10
+84,10
@@
sub generate_preamble {
if (!$opts{version} || $opts{version} == 2) {
@preamble = (
"\x0D\x0A\x0D\x0A\x00\x0D\x0A\x51\x55\x49\x54\x0A", # 12 byte v2 header
if (!$opts{version} || $opts{version} == 2) {
@preamble = (
"\x0D\x0A\x0D\x0A\x00\x0D\x0A\x51\x55\x49\x54\x0A", # 12 byte v2 header
- "\x
02", #
declares v2
-
"\x01", # connection is proxie
d
+ "\x
21", # top 4 bits
declares v2
+
# bottom 4 bits is comman
d
$opts{6} ? "\x21" : "\x11", # inet6/4 and TCP (stream)
$opts{6} ? "\x21" : "\x11", # inet6/4 and TCP (stream)
- $opts{6} ? "\x
24" : "\x0b",
# 36 bytes / 12 bytes
+ $opts{6} ? "\x
00\x24" : "\x00\x0b",
# 36 bytes / 12 bytes
$source_ip,
$dest_ip,
$source_port,
$source_ip,
$dest_ip,
$source_port,