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