Subject: | "Connection refused" not handled on port scan |
The return code ECONNREFUSED is not handled explicitly by Net:RSh v0.02
The port scan should continue if ECONNREFUSED "Connection refused" is
returned, in the same way as for EADDRINUSE "Address already in use".
See man listen(2) [Linux Programmer's Manual] for an explanation of how
ECONNREFUSED can be returned if the 'backlog' parameter is exceeded.
Conditions: any
* Distribution name and version: Net::Rsh v0.02
* Perl version: v5.8.7 built for i486-linux-gnu-thread-multi
* Operating System: Linux
* Linux Distribution: Ubuntu 5.10 (Breezy)
* Kernel: 2.6.12-10-386 #1 Fri Sep 15 16:31:49 UTC 2006 i686 GNU/Linux
Proposed correction:
if ($!{EADDRINUSE} || $!{ECONNREFUSED}) {
$port-=1;
} else {
Test output using additional line of trace:
printf("Port: %d - errno: %d: %s\n", $port, $!, $!);
Port: 1023 - errno: 98: Address already in use
Port: 1022 - errno: 98: Address already in use
Port: 1021 - errno: 111: Connection refused