Bug 79360

Summary: Net::Ping succeeds regardless of port assignment
Product: [Fedora] Fedora Reporter: Vince Broz <vince>
Component: perlAssignee: Jason Vas Dias <jvdias>
Status: CLOSED NOTABUG QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: perl-devel, scop
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-01-19 23:19:00 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
Test script none

Description Vince Broz 2002-12-10 18:29:30 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.1) Gecko/20020826

Description of problem:
Net::Ping succeeds regardless of port assignment

The Net::Ping library, on Red Hat Linux 8.0, seems to ignore the port specified
and only checks whether a given host is active or not.


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Run the attached script, modifying it to point to a port that is listening on
localhost.
2. Run the attached script, modifying it to point to a port that is NOT
listening on localhost.

Actual Results:  On Red Hat Linux 8.0:

1. Script printed "Able to connect..."
2. Script printed "Able to connect..."


Expected Results:  Observed on Red Hat Linux 7.3:

1. Script prints "Able to connect..."
2. Script prints "Unable to connect..."

Additional info:

Comment 1 Vince Broz 2002-12-10 18:31:00 UTC
Created attachment 88250 [details]
Test script

Comment 2 Warren Togami 2005-05-28 07:28:49 UTC
Can someone test the script provided in this report and verify if this is still
an issue?


Comment 3 Ville Skyttä 2005-06-01 17:53:17 UTC
Yep, it's an issue on FC3 (perl-5.8.5-12.FC3) and FC4 (perl-5.8.6-15).  I could
reproduce the failure on a Solaris and a Debian box too, so it looks like an
upstream issue.  See also http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-Ping

On a side note, the issue (all tcp pings succeed even for non-open ports) seems
to occur here only when pinging a local IP address, others appear to work as
expected.  But that could be a coincidence.

Comment 4 Jason Vas Dias 2006-01-19 23:19:00 UTC
I'm not sure this is actually a bug.

As the Net::Ping manual states:

   $p->service_check( { 0 | 1 } );
        Set whether or not the connect behavior should enforce remote service 
        availability as well as reachability.  Normally, if the remote server 
        reported ECONNREFUSED, it must have been reachable because of the 
        status packet that it reported.  With this option enabled, the full   
        three-way tcp handshake must have been established successfully before
        it will claim it is reachable.

So adding 
        $p->service_check(1);
before the 
        $p->ping($host);
in the example script attachment makes it only succeed if a tcp server
is actually listening to the $port on $host, which I believe was the 
intent, and which resolves the problem described in this bug.

Yes, I agree if a port is specified for a TCP ping, a full connect(2) attempt
should be made, but this is not how Net::Ping was designed or documented to
work - a tcp ping only verifies that the host is reachable, unless the 
service_check(1) option is specified .

Hence, this bug is being closed as NOTABUG - if you disagree, please re-open it.