[lug] Perl 101

John Karns jkarns at csd.net
Fri Apr 19 22:39:54 MDT 2002


On Fri, 19 Apr 2002, rise said:

> On Fri, 19 Apr 2002, John Hernandez wrote:

> > Also, I think the original poster mentioned that command line pings to
> > that address work fine, so his problem is likely in the code somewhere.
>
> I'd be more inclined to guess firewalling that dislikes some
> particular of Net::Ping's ICMP packets - he does note that he sees
> activity lights for the pings and that code works for me with every
> pingable IP I've tried (including setting up 192.168.1.108 on one of
> my local interfaces).  The best way is probably to slap something
> user-friendly like ipgrab on the interface and compare a command-line
> ping with one from Net::Ping.

Good suggestion - I'll try it.

Of the 3 boxes on my subnet, I have firewalling on one; the other two have
none.  All are Linux boxen running a 2.2.20 kernel, each one with a
different version of SuSE.  I can't get the code to work between any two
without specifying the icmp in the call.

Moreover, declaring the fxn call pointer (if that's the correct jargon) to
be

$p = Net::Ping->new("icmp");

succeeds, while declaring it as

$p = Net::Ping->new();

conjures the error:

Bad arg length for Socket::unpack_sockaddr_in, length is 0, should be 16
at /usr/lib/perl5/5.00503/i586-linux/Socket.pm line 295

ditto for 5.6.0, with 311 as the cited line #.  So there seems to be
something strange going on here.  It seems like the library function call
is not defaulting to tcp, as stated in my reference.  If I make the call
with an explicit "tcp"

$p = Net::Ping->new("tcp");

then no error, but the call fails as I originally mentioned.

All machines are SuSE (6.2, 7.1 and 7.2), all have Perl installed from the
binary rpm matching the distro version.  All exhibit the same behavior.

The oldest installation has Perl 5.00503, while the other two are 5.6.0

----------------------------------------------------------------
John Karns                                        jkarns at csd.net






More information about the LUG mailing list