[Nottingham] Perl - NetPacket modules

Jarrod Robinson jarrodr at gmail.com
Thu Dec 28 13:01:16 GMT 2006


At the risk of getting flamed, is it because your missing a semi colon at
the end of that line.....

Jarrod.


On 12/28/06, Graeme Fowler <graeme at graemef.net> wrote:
>
> On Thu, 2006-12-28 at 11:46 +0000, Michael Erskine (at home!) wrote:
> > OK, how are you calling the encode method? From the docs on cpan
> > (http://search.cpan.org/~atrak/NetPacket-0.04/NetPacket/IP.pm) I see
> > that encode expects a scalar containing an object ref but you seem to be
> > passing something else (perhaps by mistake). Post a bit of code that
> > gives you the problem.
>
> Slightly edited to remove the surrounding and contained cruft, we have:
>
> print "entering loop...\n" if ($debug > 0);
> while (1) {
> if (!defined($packet = $queue->get_message($timeout))) {
>    if (IPTables::IPv4::IPQueue->errstr=~/Timeout/) {
>      print "Timeout...\n" if ($debug > 1);
>    } else {
>      die "ERROR: ". IPTables::IPv4::IPQueue->errstr . "\n";
>    }
> } else {
>    print "packet!\n" if ($debug > 1);
>    if(defined($ip = NetPacket::IP->decode($packet->payload()))) {
>
>      # at this point, $ip is a scalar hashref
>
>      #...various tests to determine where the packet came from, what
>      # it's doing, etc etc and set various flags
>      $src_ip_addr = $ip->{src_ip};
>      $dst_ip_addr = $ip->{dst_ip};
>      if ($ip->{proto}==6) {
>        $tcp = NetPacket::TCP->decode($ip->{data});
>        $dst_port = $tcp{dest_port};
>        $proto="TCP";
>      }
>    } else {
>      # something isn't right
>      die "Exiting: decode failed\n";
>    }
>    $retpack = NetPacket::IP->encode($ip)
>    print "Passing packet back to kernel...\n" if ($debug > 1);
>    $queue->set_verdict($packet->packet_id(), NF_ACCEPT);
> }
> }
>
>
> The line defining $retpack is where it throws the error, every time. I
> can call it with the scalar hashref or try to create an empty
> constructor, the error is the same.
>
> Graeme
>
>
> _______________________________________________
> Nottingham mailing list
> Nottingham at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/nottingham
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.lug.org.uk/pipermail/nottingham/attachments/20061228/50517291/attachment.html


More information about the Nottingham mailing list