I've played around some with NetPacket::ICMP and such. What I think you'd need to do, to test that particular UDP port, would be to listen locally on the ICMP port (which is a protocol like UDP and TCP), and read any incoming packets that occur when you connect via UDP.

Anyway, this is as far as I got, it doesn't seem to get a ICMP packet type that makes any sense, though, anyone have an idea why?

#!/usr/bin/perl -w use Data::Dumper; use NetPacket::ICMP; use IO::Socket; my $icmps = IO::Socket::INET->new("LocalHost" => "192.168.1.2", "Proto" => "icmp") or die "Cant icmp listen ($!)"; print "boo\n"; my $udptest = IO::Socket::INET->new("PeerAddr" => "192.168.1.20", "PeerPort" => "2222", "Proto" => "udp", "Timeout" => 20); $udptest->print("test"); my $y = $icmps->recv($buffer, 1024, 0); if($y) { ($xport, $iaddr) = unpack_sockaddr_in($y); $remotehost = inet_ntoa($iaddr); print("peerhost $remotehost:$xport\n"); } my $dec = NetPacket::ICMP->decode($buffer); print Dumper($dec);
Which outputs:
boo peerhost 192.168.1.20:0 $VAR1 = bless( { '_parent' => undef, 'data' => 'c @À¨À¨E Àl@@öùÀ¨À¨® qtest', 'cksum' => 60, 'type' => 69, '_frame' => 'EÀ<c @À¨À¨E Àl@@öùÀ¨À¨® qtest', 'code' => 192 }, 'NetPacket::ICMP' );
Where 69 is not any of the possible packet types listed in NetPacket::ICMP.. So, no clue whats going haywire..

C.


In reply to Re: How read ICMP UDP port unreachable? by castaway
in thread How read ICMP UDP port unreachable? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.