Skip to content

Commit

Permalink
Try forcing a server port
Browse files Browse the repository at this point in the history
  • Loading branch information
fwh-dc committed Jan 19, 2024
1 parent 1454ccf commit dfc42a0
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions util/perl/TLSProxy/Proxy.pm
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ sub init
isdtls => $isdtls,
proxy_port => 0,
client_port => 49152 + int(rand(65535 - 49152)),
server_port => 0,
server_port => 49152 + int(rand(65535 - 49152)),
serverpid => 0,
clientpid => 0,
execute => $execute,
Expand Down Expand Up @@ -266,7 +266,7 @@ sub start
#generation. Using "-ext_cache" replaces the default callback with a
#different one that doesn't get confused.
." -ext_cache"
." -accept $self->{server_addr}:0"
." -accept $self->{server_addr}:$self->{server_port}"
." -cert ".$self->cert." -cert2 ".$self->cert
." -naccept ".$self->serverconnects;
if ($self->{isdtls}) {
Expand Down Expand Up @@ -301,8 +301,7 @@ sub start
while (<>) {
print;
s/\R$//; # Better chomp
next unless (/^ACCEPT\s.*:(\d+)$/);
$self->{server_port} = $1;
next unless (/^ACCEPT$/);
last;
}

Expand Down Expand Up @@ -472,7 +471,7 @@ sub clientstart
if ($server_sock->sysread($indata, 16384)) {
if ($indata = $self->process_packet(1, $indata)) {
print "client_sock->syswrite\n";
if($client_sock->syswrite($indata) == undef) {
if(!$client_sock->syswrite($indata)) {
$printerrno = 1;
goto END;
}
Expand All @@ -488,7 +487,7 @@ sub clientstart
if ($client_sock->sysread($indata, 16384)) {
if ($indata = $self->process_packet(0, $indata)) {
print "server_sock->syswrite\n";
if($server_sock->syswrite($indata) == undef) {
if(!$server_sock->syswrite($indata)) {
$printerrno = 1;
goto END;
}
Expand Down

0 comments on commit dfc42a0

Please sign in to comment.