<div>At the risk of getting flamed, is it because your missing a semi colon at the end of that line.....</div>
<div>&nbsp;</div>
<div>Jarrod.<br><br>&nbsp;</div>
<div><span class="gmail_quote">On 12/28/06, <b class="gmail_sendername">Graeme Fowler</b> &lt;<a href="mailto:graeme@graemef.net">graeme@graemef.net</a>&gt; 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>&gt; OK, how are you calling the encode method? From the docs on cpan
<br>&gt; (<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>&gt; that encode expects a scalar containing an object ref but you seem to be
<br>&gt; passing something else (perhaps by mistake). Post a bit of code that<br>&gt; gives you the problem.<br><br>Slightly edited to remove the surrounding and contained cruft, we have:<br><br>print &quot;entering loop...\n&quot; if ($debug &gt; 0);
<br>while (1) {<br>if (!defined($packet = $queue-&gt;get_message($timeout))) {<br>&nbsp;&nbsp; if (IPTables::IPv4::IPQueue-&gt;errstr=~/Timeout/) {<br>&nbsp;&nbsp;&nbsp;&nbsp; print &quot;Timeout...\n&quot; if ($debug &gt; 1);<br>&nbsp;&nbsp; } else {<br>&nbsp;&nbsp;&nbsp;&nbsp; die &quot;ERROR: &quot;. IPTables::IPv4::IPQueue-&gt;errstr . &quot;\n&quot;;
<br>&nbsp;&nbsp; }<br>} else {<br>&nbsp;&nbsp; print &quot;packet!\n&quot; if ($debug &gt; 1);<br>&nbsp;&nbsp; if(defined($ip = NetPacket::IP-&gt;decode($packet-&gt;payload()))) {<br><br>&nbsp;&nbsp;&nbsp;&nbsp; # at this point, $ip is a scalar hashref<br><br>&nbsp;&nbsp;&nbsp;&nbsp; #...various tests to determine where the packet came from, what
<br>&nbsp;&nbsp;&nbsp;&nbsp; # it&#39;s doing, etc etc and set various flags<br>&nbsp;&nbsp;&nbsp;&nbsp; $src_ip_addr = $ip-&gt;{src_ip};<br>&nbsp;&nbsp;&nbsp;&nbsp; $dst_ip_addr = $ip-&gt;{dst_ip};<br>&nbsp;&nbsp;&nbsp;&nbsp; if ($ip-&gt;{proto}==6) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $tcp = NetPacket::TCP-&gt;decode($ip-&gt;{data});
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $dst_port = $tcp{dest_port};<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $proto=&quot;TCP&quot;;<br>&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp; } else {<br>&nbsp;&nbsp;&nbsp;&nbsp; # something isn&#39;t right<br>&nbsp;&nbsp;&nbsp;&nbsp; die &quot;Exiting: decode failed\n&quot;;<br>&nbsp;&nbsp; }<br>&nbsp;&nbsp; $retpack = NetPacket::IP-&gt;encode($ip)
<br>&nbsp;&nbsp; print &quot;Passing packet back to kernel...\n&quot; if ($debug &gt; 1);<br>&nbsp;&nbsp; $queue-&gt;set_verdict($packet-&gt;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>