r12262 - in /branches/upstream/libnet-rawip-perl/current: ./ lib/Net/ lib/Net/RawIP/ t/

ghostbar-guest at users.alioth.debian.org ghostbar-guest at users.alioth.debian.org
Wed Jan 9 02:28:13 UTC 2008


Author: ghostbar-guest
Date: Wed Jan  9 02:28:13 2008
New Revision: 12262

URL: http://svn.debian.org/wsvn/?sc=1&rev=12262
Log:
[svn-upgrade] Integrating new upstream version, libnet-rawip-perl (0.23)

Added:
    branches/upstream/libnet-rawip-perl/current/TODO
    branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/
    branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/ethhdr.pm
    branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/generichdr.pm
    branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/icmphdr.pm
    branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/iphdr.pm
    branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/opt.pm
    branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/tcphdr.pm
    branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/udphdr.pm
    branches/upstream/libnet-rawip-perl/current/t/critic.t
    branches/upstream/libnet-rawip-perl/current/t/timem.t
Modified:
    branches/upstream/libnet-rawip-perl/current/Changes
    branches/upstream/libnet-rawip-perl/current/MANIFEST
    branches/upstream/libnet-rawip-perl/current/META.yml
    branches/upstream/libnet-rawip-perl/current/Makefile.PL
    branches/upstream/libnet-rawip-perl/current/RawIP.xs
    branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP.pm
    branches/upstream/libnet-rawip-perl/current/t/memory_leak.t
    branches/upstream/libnet-rawip-perl/current/t/set_icmp.t

Modified: branches/upstream/libnet-rawip-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-rawip-perl/current/Changes?rev=12262&op=diff
==============================================================================
--- branches/upstream/libnet-rawip-perl/current/Changes (original)
+++ branches/upstream/libnet-rawip-perl/current/Changes Wed Jan  9 02:28:13 2008
@@ -1,4 +1,17 @@
 Revision history for Perl extension Net::RawIP.
+
+0.23 Tue Jan8  2007
+    - add version number to submodules
+
+0.22 Tue Jan8  2007
+    - remove dependency on List::MoreUtils
+
+0.22_01 Mon Jul 16 2007 (Steve Bonds)
+    - fix endianness bug in ICMP packet creation
+    - add lots of comments on what's going on in the ICMP portion
+      of the RawIP.xs and RawIP.pm files
+    - break out sub-packages to their own files so "make test"
+      works even with Critic enabled
 
 0.21 Mon Mar 26 22:53:48 2007
     - fix looping bug in set_icmp (Micha Nasriachi) 
@@ -220,3 +233,4 @@
       including discovering mac adresses
 
  
+

Modified: branches/upstream/libnet-rawip-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-rawip-perl/current/MANIFEST?rev=12262&op=diff
==============================================================================
--- branches/upstream/libnet-rawip-perl/current/MANIFEST (original)
+++ branches/upstream/libnet-rawip-perl/current/MANIFEST Wed Jan  9 02:28:13 2008
@@ -4,9 +4,16 @@
 Makefile.PL
 README
 README.Devel
-META.yml
+TODO
 
 lib/Net/RawIP.pm
+lib/Net/RawIP/ethhdr.pm
+lib/Net/RawIP/generichdr.pm
+lib/Net/RawIP/icmphdr.pm
+lib/Net/RawIP/iphdr.pm
+lib/Net/RawIP/opt.pm
+lib/Net/RawIP/tcphdr.pm
+lib/Net/RawIP/udphdr.pm
 RawIP.xs
 RawIP/libpcap.pod
 eth.c
@@ -37,3 +44,6 @@
 t/pod.t
 t/pod-coverage.t
 t/set_icmp.t
+t/critic.t
+t/timem.t
+META.yml                                 Module meta-data (added by MakeMaker)

Modified: branches/upstream/libnet-rawip-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-rawip-perl/current/META.yml?rev=12262&op=diff
==============================================================================
--- branches/upstream/libnet-rawip-perl/current/META.yml (original)
+++ branches/upstream/libnet-rawip-perl/current/META.yml Wed Jan  9 02:28:13 2008
@@ -1,12 +1,12 @@
 --- #YAML:1.0
 name:                Net-RawIP
-version:             0.21
+version:             0.23
 abstract:            ~
 license:             ~
-generated_by:        ExtUtils::MakeMaker version 6.32
+author:              ~
+generated_by:        ExtUtils::MakeMaker version 6.42
 distribution_type:   module
 requires:     
-    List::MoreUtils:               0
 meta-spec:
-    url:     http://module-build.sourceforge.net/META-spec-v1.2.html
-    version: 1.2
+    url:     http://module-build.sourceforge.net/META-spec-v1.3.html
+    version: 1.3

Modified: branches/upstream/libnet-rawip-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-rawip-perl/current/Makefile.PL?rev=12262&op=diff
==============================================================================
--- branches/upstream/libnet-rawip-perl/current/Makefile.PL (original)
+++ branches/upstream/libnet-rawip-perl/current/Makefile.PL Wed Jan  9 02:28:13 2008
@@ -66,6 +66,9 @@
 print $config{$name}->[2];
 eval $config{$name}->[3];
 
+print "Compiler: $Config{cc}\n";
+system "$Config{cc} --version";
+
 locate_pcap();
 
 
@@ -77,7 +80,6 @@
     INC            => '',      
     OBJECT         => $obj,
     PREREQ_PM      => {
-        'List::MoreUtils'  => 0,
     },
 );
 

Modified: branches/upstream/libnet-rawip-perl/current/RawIP.xs
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-rawip-perl/current/RawIP.xs?rev=12262&op=diff
==============================================================================
--- branches/upstream/libnet-rawip-perl/current/RawIP.xs (original)
+++ branches/upstream/libnet-rawip-perl/current/RawIP.xs Wed Jan  9 02:28:13 2008
@@ -985,6 +985,11 @@
 OUTPUT:
     RETVAL  
 
+ # This assembles an ICMP packet based on the data passed in as an
+ # array reference from the Perl module.  Populating this are with
+ # comments as I try to understand the code better so I'll remember
+ # what I thought each bit did.
+ # Steve Bonds
 
 SV *
 icmp_pkt_creat(p)
@@ -999,9 +1004,25 @@
     opt = 0;
     iplen = 20;
     if (SvTYPE(SvRV(p)) == SVt_PVAV)
+	/* pkt allows for easy access in C to the original parameter, p.  
+           Steve Bonds */
         pkt = (AV *)SvRV(p);
     else
         croak("Not array reference\n");
+
+    /* Populate the C pii ICMP packet structure with information from "pkt", which
+       is the C char pointer to the array reference passed in.  The perlguts
+       man page recommends checking that this returns non-null before calling
+       SvIV on it, probably to follow the Second Commandment of C:
+
+         Thou shalt not follow the NULL pointer, for chaos and madness await thee at its end.
+
+       (http://web.archive.org/web/19961109205914/http://www.lysator.liu.se/c/ten-commandments.html)
+
+       however, it would appear that the original author didn't and I don't want to
+       make too many changes yet, so I'll pretend I didn't see it for now...
+
+       Steve Bonds */
     pii.ih.version = SvIV(*av_fetch(pkt,0,0));
     pii.ih.ihl = SvIV(*av_fetch(pkt,1,0));
     pii.ih.tos = SvIV(*av_fetch(pkt,2,0));
@@ -1016,25 +1037,99 @@
     pii.ih.saddr = htonl(SvIV(*av_fetch(pkt,9,0)));
     pii.ih.daddr = htonl(SvIV(*av_fetch(pkt,10,0)));
     if (!pii.ih.check)
-        pii.ih.check = in_cksum((unsigned short *)&pii,iplen); 
+        pii.ih.check = in_cksum((unsigned short *)&pii,iplen);
+
+    /* We're done with the basic IP header assembly into the pii
+    structure.  Move on to the ICMP header specifics.  Steve Bonds */
+
     pii.ich.type = SvIV(*av_fetch(pkt,11,0));
     pii.ich.code = SvIV(*av_fetch(pkt,12,0));
     pii.ich.checksum = htons(SvIV(*av_fetch(pkt,13,0)));
     pii.ich.un.gateway = SvIV(*av_fetch(pkt,14,0));
+
+    /* Array index 20 is the "data" area of the ICMP packet.  av_fetch only
+    returns a scalar so the data area must be one, which explains why it
+    didn't work so great when I used an array reference here based on my
+    incorrect understanding of the POD docs.  Steve Bonds */
     if (av_fetch(pkt,20,0)) {
         if (SvROK(*av_fetch(pkt,20,0))) {
             opt++;
+
+	    /* I don't understand why this module calls an internal parsing function
+	       on a raw data field supplied by the user.  This may or may not
+	       associate with an actual IP structure, depending on what the
+	       user of this module decides.  It appears that this is done to
+               get the proper packet length for the IP header, but this could
+               also be done based on the scalar length of the raw data area
+               itself (SvCUR).  
+
+	       Why wouldn't the sum of these work for the total IP packet length:
+	         + IP header (20)
+		 + ICMP header (8)
+		   - type (1)
+		   - code (1)
+		   - checksum (2)
+		   - id or unused (2)
+		   - sequence or mtu (2)
+		 + ICMP data (variable length)
+
+	       Finding the total length shouldn't require any decoding of the ICMP
+	       data area.  Doing so just gives this module additional places to
+	       either break/crash or mangle the intended data on its way out.
+
+	       In the interest of not breaking the module until I understand it better,
+	       leave it alone for now.
+
+	       Steve Bonds */
             ip_opts = ip_opts_creat(*av_fetch(pkt,20,0));
             pii.ih.ihl = 5 + SvCUR(ip_opts)/4;
             iplen = 4*pii.ih.ihl;
+
+            /* Array index 19 is the MTU or Sequence.  SvCUR returns the length of that scalar.
+               Steve Bonds */
             pii.ih.tot_len = BSDFIX(iplen + 8 + SvCUR(*av_fetch(pkt,19,0)));
             pii.ih.check = 0;
+
+	    /* Create a place to copy the pii structure for rebuilding the checksum.
+               Steve Bonds */
             ptr = (u_char*)safemalloc(iplen + 8);
+	    /* Copy the 20 byte IP header in */
             memcpy(ptr,(u_char*)&pii,20);
+
+	    /* Either this is a bug or I don't understand something going on here.
+	       ip_opts is derived above from field 20 of "pkt" which is the
+	       user-supplied data area of the ICMP packet they want to send.
+	       This data area is supposed to be an IP packet, but since they
+	       can set it to any arbitrary string of bytes, it doesn't necessarily
+	       have to be.  So it looks to me like we just joined the 20 byte IP
+	       header with the 8 bytes ip_opts creates from the user data area.
+	       I would instead have expected this to be the 8 bytes of ICMP
+	       packet header we created above.  Steve Bonds */
             memcpy(ptr+20,SvPV(ip_opts,PL_na),SvCUR(ip_opts));
+
+	    /* Here's the 8 bytes we created above getting copied in.  I would have
+	       expected this line to be before the above line. */
             memcpy(ptr+20+SvCUR(ip_opts),(u_char*)&pii + 20,8);
+
+	    /* Re-build a valid IP checksum for our packet. */
             ((struct iphdr*)ptr)->check = in_cksum((unsigned short *)ptr,iplen);
+
+	    /* Create a new scalar that will contain the string value contained
+	       in our temporary spot *ptr.  This in essence becomes a packed
+	       string value in perl when it gets sent back.  Steve Bonds */
             RETVAL = newSVpv((char*)ptr, sizeof(IIPKT)+SvCUR(ip_opts));
+
+	    /* Toss field 19 from the original array (MTU/Sequence) onto 
+	       the end of the RETVAL scalar created above.  Alas, these are
+	       2-byte values so these need to be converted to proper network 
+	       byte order before they will be valid.  This looks like the 
+	       bug I came here to find.
+
+	       I think it may be simpler to convert this to network byte order
+	       via Perl before it gets passed in to this code so as to minimize 
+	       the changes needed inside this harder-to-follow .xs file.
+
+	       Steve Bonds */
             sv_catsv(RETVAL, *av_fetch(pkt, 19, 0));
             Safefree(ptr);
             sv_2mortal(ip_opts);

Added: branches/upstream/libnet-rawip-perl/current/TODO
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-rawip-perl/current/TODO?rev=12262&op=file
==============================================================================
--- branches/upstream/libnet-rawip-perl/current/TODO (added)
+++ branches/upstream/libnet-rawip-perl/current/TODO Wed Jan  9 02:28:13 2008
@@ -1,0 +1,26 @@
+
+svk diff -r11153:11154  | less
+add warnings !!
+
+
+
+$ [~/Net-RawIP-0.21_02]# perl -I../perl5lib/lib -Iblib/lib -I blib/arch t/iflist.t
+Must have EUID == 0 to use Net::RawIP at t/iflist.t line 10
+1..7
+ok 1 - ifaddrlist retursn HASH ref
+not ok 2 - lo interface exists
+#     Failed test (t/iflist.t at line 16)
+not ok 3 - lo interface is 127.0.0.1
+#     Failed test (t/iflist.t at line 17)
+#          got: undef
+#     expected: '127.0.0.1'
+# ifaddrelist returns: $VAR1 = {
+#           'eri0' => '10.56.22.43',
+#           'lo0' => '127.0.0.1'
+#         };
+rdev() is not implemented on this system at blib/lib/Net/RawIP.pm line 651.
+# Looks like you planned 7 tests but only ran 3.
+# Looks like your test died just after 3.
+
+
+

Modified: branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP.pm?rev=12262&op=diff
==============================================================================
--- branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP.pm (original)
+++ branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP.pm Wed Jan  9 02:28:13 2008
@@ -1,55 +1,3 @@
-# Create sub modules 
-package Net::RawIP::iphdr;
-use strict;
-use warnings;
-use Class::Struct qw(struct);
-our @iphdr 
-    = qw(version ihl tos tot_len id frag_off ttl protocol check saddr daddr);
-struct ( 'Net::RawIP::iphdr' => [ map { $_ => '$' } @iphdr ] );
-
-package Net::RawIP::tcphdr;
-use strict;
-use warnings;
-use Class::Struct qw(struct);
-our @tcphdr = qw(source dest seq ack_seq doff res1 res2 urg ack psh rst syn
-    fin window check urg_ptr data);
-struct ( 'Net::RawIP::tcphdr' => [map { $_ => '$' } @tcphdr ] );
-
-package Net::RawIP::udphdr;
-use strict;
-use warnings;
-use Class::Struct qw(struct);
-our @udphdr = qw(source dest len check data);
-struct ( 'Net::RawIP::udphdr' => [map { $_ => '$' } @udphdr ] );
-
-package Net::RawIP::icmphdr;
-use strict;
-use warnings;
-use Class::Struct qw(struct);
-our @icmphdr = qw(type code check gateway id sequence unused mtu data);
-struct ( 'Net::RawIP::icmphdr' => [map { $_ => '$' } @icmphdr ] );
-
-package Net::RawIP::generichdr;
-use strict;
-use warnings;
-use Class::Struct qw(struct);
-our @generichdr = qw(data);
-struct ( 'Net::RawIP::generichdr' => [map { $_ => '$' } @generichdr ] );
-
-package Net::RawIP::opt;
-use strict;
-use warnings;
-use Class::Struct qw(struct);
-my @opt = qw(type len data);
-struct ( 'Net::RawIP::opt' => [map { $_ => '@' } @opt ] );
-
-package Net::RawIP::ethhdr;
-use strict;
-use warnings;
-use Class::Struct qw(struct);
-our @ethhdr = qw(dest source proto);
-struct ( 'Net::RawIP::ethhdr' => [map { $_ => '$' } @ethhdr ] );
-
 # Main package 
 package Net::RawIP;
 use strict;
@@ -60,6 +8,13 @@
 use subs qw(timem ifaddrlist);
 
 use English qw( -no_match_vars );
+use Net::RawIP::iphdr;
+use Net::RawIP::tcphdr;
+use Net::RawIP::udphdr;
+use Net::RawIP::icmphdr;
+use Net::RawIP::generichdr;
+use Net::RawIP::opt;
+use Net::RawIP::ethhdr;
 
 require Exporter;
 require DynaLoader;
@@ -83,8 +38,7 @@
                             ]
 );
 
-$VERSION = '0.21';
-use List::MoreUtils qw(none);
+$VERSION = '0.23';
 
 # The number of members in the sub modules
 my %n = (
@@ -131,7 +85,7 @@
     $ref ||= {};
     foreach my $k (keys %$ref) {
         croak "'$k' is not a valid key\n" 
-            if none {$_ eq $k} (@valid_protocols, 'ip');
+            if not grep {$_ eq $k} (@valid_protocols, 'ip');
     }
     $self->proto($ref);
 
@@ -396,8 +350,29 @@
     @{$class->{generichdr}} = ('');
 }
 
+# 2xS = 16bits
+# 1xI = 32bits or more
+# Byte ordering is unspecified, so it's probably native ordering.
+# To me using I seems like a bad idea since in some cases this might
+# be more than 32 bits yet the network structures require exactly
+# 32 bits, plus they must always be in network byte order (big-endian)
+# Steve Bonds
 sub s2i {
     return unpack("I1", pack("S2", @_))
+}
+
+# This lies a bit-- the original values passed in may not be in
+# network byte order but this will reverse them on little-endian hosts
+# while (hopefully) leaving them alone on big-endian hosts, resulting
+# in the correct on-the-wire byte ordering.  Steve Bonds
+sub n2L {
+    return unpack("L1", pack("n2", @_));
+}
+
+# This does the same thing, but for the whole 32 bits at once, suitable
+# for ICMP packets with the gateway hash key set.
+sub N2L {
+    return unpack("L1", pack("N1", @_));
 }
 
 sub _pack {
@@ -405,6 +380,7 @@
     if (@_) {
         # A low level *_pkt_creat() functions take reference of array 
         # with all of fields of the packet and return properly packed scalar  
+        # These are defined in the Raw.xs file.
         my $function = $self->{proto} . '_pkt_creat';
         ## no critic (ProhibitNoStrict)
         no strict 'refs';
@@ -424,7 +400,25 @@
 
 sub set {
     my ($self, $hash) = @_;
-    # To handle C union in the ICMP header
+    # To handle C union in the ICMP header.  That C union is either:
+    # struct
+    # {
+    #   u_int16_t id;
+    #   u_int16_t sequence;
+    # } echo;         /* echo datagram */
+    # u_int32_t   gateway;    /* gateway address */
+    # struct
+    # {
+    #   u_int16_t unused;
+    #   u_int16_t mtu;
+    # } frag;         /* path mtu discovery */
+    # So we can either set:
+    #  + id and sequence, or
+    #  + a single gateway address, or
+    #  + unused and MTU
+
+    # My guess is that this exists simply to make it easier to call
+    # things in Perl by the same name as the C union.  Steve Bonds
     my %un = (
             id     => 'sequence',
             unused => 'mtu',
@@ -445,27 +439,37 @@
         }
     }
 
+    # This looks like a good spot to apply the endianness fixes for
+    # id/sequence and/or mtu/unused.  Steve Bonds
     if (exists $hash->{icmp}) {
         foreach my $k (keys %{ $hash->{icmp} }) {
             $self->{icmphdr}->$k( $hash->{icmp}->{$k} );
             if ($k !~ /gateway/) {
                 if ($un{$k}) { 
+                    # if $k is "id" or "unused"
                     my $meth = $un{$k};
-                    $self->{icmphdr}->gateway(s2i(
-                                    ($self->{icmphdr}->$k()),
-                                    ($self->{icmphdr}->$meth())
-                                    ));
+                    $self->{icmphdr}->gateway(n2L(
+                       $self->{icmphdr}->$k(),
+                       $self->{icmphdr}->$meth()
+                    ));
                 }       
                 elsif ($revun{$k}) {
+                    # if $k is "sequence" or "mtu"
                     my $meth = $revun{$k};
-                    $self->{icmphdr}->gateway(s2i(
-                                        ($self->{icmphdr}->$meth()),
-                                        ($self->{icmphdr}->$k())
-                                        ));
+                    $self->{icmphdr}->gateway(n2L(
+                       $self->{icmphdr}->$meth(),
+                       $self->{icmphdr}->$k()
+                    ));
                 }
+            } else {
+              # $k =~ /gateway/
+              # Not setting icmp => gateway since it's set by the user
+              # However, it may still be in the wrong byte order so
+              # reverse it if needed.  Steve Bonds
+              $self->{icmphdr}->gateway(N2L( $hash->{icmp}->{gateway} ));
             }
         }
-    }
+      }
 
     my $saddr = $self->{iphdr}->saddr;
     my $daddr = $self->{iphdr}->daddr;
@@ -683,19 +687,19 @@
 =head1 SYNOPSIS
 
   use Net::RawIP;
-  $n = Net::RawIP->new;
-  $n->set({
-            ip  => {
-                    saddr => 'my.target.lan',
-                    daddr => 'my.target.lan',
-                    },
-            tcp => {
-                    source => 139,
-                    dest   => 139,
-                    psh    => 1,
-                    syn    => 1,
-                    },
-         });
+  $n = Net::RawIP->new({
+                        ip  => {
+                                saddr => 'my.target.lan',
+                                daddr => 'my.target.lan',
+                               },
+                       });
+                        tcp => {
+                                source => 139,
+                                dest   => 139,
+                                psh    => 1,
+                                syn    => 1,
+                               },
+                       });
   $n->send;
   $n->ethnew("eth0");
   $n->ethset(source => 'my.target.lan', dest =>'my.target.lan');    
@@ -771,7 +775,8 @@
 B<ARGPROTO> is one of (B<tcp>, B<udp>, B<icmp>, B<generic>) defining the
 protcol of the current packet. Defaults to B<tcp>.
 
-You can B<NOT> change protocol in the object after its creation.
+You can B<NOT> change protocol in the object after its creation.  Unless you
+want your packet to be TCP, you must set the protocol type in the new() call.
 
 The possible values of B<PROTOKEY> depend on the value of ARGPROTO
 
@@ -789,6 +794,8 @@
 
 If ARGPROTO is B<generic> PROTOKEY can be B<data> only.
 
+The B<data> entries are scalars containing packed network byte order
+data.
 
 As the real icmp packet is a C union one can specify specify only one 
 of the following set of values.
@@ -1084,6 +1091,11 @@
 software; you can redistribute it and/or modify it under the same terms
 as Perl itself.
 
+=head1 CREDITS
+
+Steve Bonds <u5rhsiz02 at sneakemail.com>
+  + work on some endianness bugs and improving code comments
+
 =head1 SEE ALSO
 
 perl(1),Net::RawIP::libpcap(3pm),tcpdump(1),RFC 791-793,RFC 768.

Added: branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/ethhdr.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/ethhdr.pm?rev=12262&op=file
==============================================================================
--- branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/ethhdr.pm (added)
+++ branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/ethhdr.pm Wed Jan  9 02:28:13 2008
@@ -1,0 +1,9 @@
+package Net::RawIP::ethhdr;
+use strict;
+use warnings;
+our $VERSION = '0.23';
+use Class::Struct qw(struct);
+our @ethhdr = qw(dest source proto);
+struct ( 'Net::RawIP::ethhdr' => [map { $_ => '$' } @ethhdr ] );
+
+1;

Added: branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/generichdr.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/generichdr.pm?rev=12262&op=file
==============================================================================
--- branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/generichdr.pm (added)
+++ branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/generichdr.pm Wed Jan  9 02:28:13 2008
@@ -1,0 +1,9 @@
+package Net::RawIP::generichdr;
+use strict;
+use warnings;
+our $VERSION = '0.23';
+use Class::Struct qw(struct);
+our @generichdr = qw(data);
+struct ( 'Net::RawIP::generichdr' => [map { $_ => '$' } @generichdr ] );
+
+1;

Added: branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/icmphdr.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/icmphdr.pm?rev=12262&op=file
==============================================================================
--- branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/icmphdr.pm (added)
+++ branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/icmphdr.pm Wed Jan  9 02:28:13 2008
@@ -1,0 +1,9 @@
+package Net::RawIP::icmphdr;
+use strict;
+use warnings;
+our $VERSION = '0.23';
+use Class::Struct qw(struct);
+our @icmphdr = qw(type code check gateway id sequence unused mtu data);
+struct ( 'Net::RawIP::icmphdr' => [map { $_ => '$' } @icmphdr ] );
+
+1;

Added: branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/iphdr.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/iphdr.pm?rev=12262&op=file
==============================================================================
--- branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/iphdr.pm (added)
+++ branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/iphdr.pm Wed Jan  9 02:28:13 2008
@@ -1,0 +1,10 @@
+package Net::RawIP::iphdr;
+use strict;
+use warnings;
+our $VERSION = '0.23';
+use Class::Struct qw(struct);
+our @iphdr
+    = qw(version ihl tos tot_len id frag_off ttl protocol check saddr daddr);
+struct ( 'Net::RawIP::iphdr' => [ map { $_ => '$' } @iphdr ] );
+
+1;

Added: branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/opt.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/opt.pm?rev=12262&op=file
==============================================================================
--- branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/opt.pm (added)
+++ branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/opt.pm Wed Jan  9 02:28:13 2008
@@ -1,0 +1,9 @@
+package Net::RawIP::opt;
+use strict;
+use warnings;
+our $VERSION = '0.23';
+use Class::Struct qw(struct);
+my @opt = qw(type len data);
+struct ( 'Net::RawIP::opt' => [map { $_ => '@' } @opt ] );
+
+1;

Added: branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/tcphdr.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/tcphdr.pm?rev=12262&op=file
==============================================================================
--- branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/tcphdr.pm (added)
+++ branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/tcphdr.pm Wed Jan  9 02:28:13 2008
@@ -1,0 +1,10 @@
+package Net::RawIP::tcphdr;
+use strict;
+use warnings;
+our $VERSION = '0.23';
+use Class::Struct qw(struct);
+our @tcphdr = qw(source dest seq ack_seq doff res1 res2 urg ack psh rst syn
+    fin window check urg_ptr data);
+struct ( 'Net::RawIP::tcphdr' => [map { $_ => '$' } @tcphdr ] );
+
+1;

Added: branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/udphdr.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/udphdr.pm?rev=12262&op=file
==============================================================================
--- branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/udphdr.pm (added)
+++ branches/upstream/libnet-rawip-perl/current/lib/Net/RawIP/udphdr.pm Wed Jan  9 02:28:13 2008
@@ -1,0 +1,9 @@
+package Net::RawIP::udphdr;
+use strict;
+use warnings;
+our $VERSION = '0.23';
+use Class::Struct qw(struct);
+our @udphdr = qw(source dest len check data);
+struct ( 'Net::RawIP::udphdr' => [map { $_ => '$' } @udphdr ] );
+
+1;

Added: branches/upstream/libnet-rawip-perl/current/t/critic.t
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-rawip-perl/current/t/critic.t?rev=12262&op=file
==============================================================================
--- branches/upstream/libnet-rawip-perl/current/t/critic.t (added)
+++ branches/upstream/libnet-rawip-perl/current/t/critic.t Wed Jan  9 02:28:13 2008
@@ -1,0 +1,12 @@
+use strict;
+use warnings;
+
+use Test::More;
+eval {
+   require Test::Perl::Critic;
+   import  Test::Perl::Critic;
+};
+plan skip_all => 'Test::Perl::Critic required to criticise code' if $@;
+all_critic_ok('blib');
+#all_critic_ok('blib', 't');
+

Modified: branches/upstream/libnet-rawip-perl/current/t/memory_leak.t
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-rawip-perl/current/t/memory_leak.t?rev=12262&op=diff
==============================================================================
--- branches/upstream/libnet-rawip-perl/current/t/memory_leak.t (original)
+++ branches/upstream/libnet-rawip-perl/current/t/memory_leak.t Wed Jan  9 02:28:13 2008
@@ -72,10 +72,12 @@
                         },
                 });
 }
-my $size_change = get_process_size($$) - $start_size;
+my $end_size = get_process_size($$);
+my $size_change = $end_size - $start_size;
+diag "End size: $end_size";
 diag "Size change was: $size_change";
 cmp_ok($size_change, '<', 200_000, 
-    'normally it should be 0 but we are satisfied with 200,000 here, see commnts in test file');
+    'normally it should be 0 but we are satisfied with 200,000 here, see comments in test file');
 BEGIN { $tests += 1; }
 # Once upon a time there was a memory leak on Solaris created by the above
 # loop.

Modified: branches/upstream/libnet-rawip-perl/current/t/set_icmp.t
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-rawip-perl/current/t/set_icmp.t?rev=12262&op=diff
==============================================================================
--- branches/upstream/libnet-rawip-perl/current/t/set_icmp.t (original)
+++ branches/upstream/libnet-rawip-perl/current/t/set_icmp.t Wed Jan  9 02:28:13 2008
@@ -2,7 +2,6 @@
 
 use strict;
 use warnings;
-use List::MoreUtils	qw{ any 	};
 use Data::Dumper qw(Dumper);
 use English qw( -no_match_vars );
 use Test::More;
@@ -43,7 +42,7 @@
 		},
 	});
 
-	return 0 if any {!defined($_)} @{ $raw->{icmphdr} };
+	return 0 if grep {!defined($_)} @{ $raw->{icmphdr} };
 
 	return 1;
 }

Added: branches/upstream/libnet-rawip-perl/current/t/timem.t
URL: http://svn.debian.org/wsvn/branches/upstream/libnet-rawip-perl/current/t/timem.t?rev=12262&op=file
==============================================================================
--- branches/upstream/libnet-rawip-perl/current/t/timem.t (added)
+++ branches/upstream/libnet-rawip-perl/current/t/timem.t Wed Jan  9 02:28:13 2008
@@ -1,0 +1,15 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+use Test::More;
+my $tests;
+plan tests => 1;
+
+BEGIN {$tests += 1; }
+
+
+#use Net::RawIP;
+#print timem();
+ok(1);
+




More information about the Pkg-perl-cvs-commits mailing list