Bug 79360 - Net::Ping succeeds regardless of port assignment
Summary: Net::Ping succeeds regardless of port assignment
Alias: None
Product: Fedora
Classification: Fedora
Component: perl
Version: rawhide
Hardware: i686
OS: Linux
Target Milestone: ---
Assignee: Jason Vas Dias
QA Contact: David Lawrence
Depends On:
TreeView+ depends on / blocked
Reported: 2002-12-10 18:29 UTC by Vince Broz
Modified: 2007-11-30 22:10 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2006-01-19 23:19:00 UTC
Type: ---

Attachments (Terms of Use)
Test script (310 bytes, text/plain)
2002-12-10 18:30 UTC, Vince Broz
no flags Details

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:

Steps to Reproduce:
1. Run the attached script, modifying it to point to a port that is listening on
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 
before the 
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.

Note You need to log in before you can comment on or make changes to this bug.