Linux Netfilter discussions
 help / color / mirror / Atom feed
* iptables::ipv4 problems
@ 2006-08-23 10:57 Vlad Adomnicai
  0 siblings, 0 replies; only message in thread
From: Vlad Adomnicai @ 2006-08-23 10:57 UTC (permalink / raw)
  To: netfilter

Hi,
  I tried to use the iptables::ipv4 perl module to speed up rule adding 
and the other operations. Found out that my 2k lines adding time dropped 
from 40 seconds to just 4s which is very nice and usefull but when I 
wanted to update them I runned into a problem.
  I can add just fine a rule from perl, but I can't delete it from 
cmdline with iptables unless I write the rule number.

I have added two chains TEST and TEST2

#!/usr/bin/perl -w
use IPTables::IPv4;
$filter_table = IPTables::IPv4::init("filter");
%rule = (
  source => '192.168.212.50',
  jump => 'TEST2',
  'out-interface' => 'eth0'
);
$filter_table->append_entry('TEST',\%rule);
$filter_table->commit();

a iptables-save shows the rule beeing added :
:TEST - [0:0]
:TEST2 - [0:0]
-A TEST -s 192.168.212.50 -o eth0 -j TEST2
COMMIT

if I try to do ' iptables -D TEST -s 192.168.212.50 -o eth0 -j TEST2' it 
won't delete the rule printing :
iptables: No chain/target/match by that name

if I use iptables -D TEST 1 it deletes it just fine.

i added anothe rule by hand with the same format: iptables -A TEST -s 
192.168.212.50 -o eth0 -j TEST2 and got in iptables-save
:TEST - [0:0]
:TEST2 - [0:0]
-A TEST -s 192.168.212.50 -o eth0 -j TEST2
-A TEST -s 192.168.212.50 -o eth0 -j TEST2
COMMIT

Now a iptables -D TEST -s 192.168.212.50 -o eth0 -j TEST2 will succeed 
and delete one line. If I run it again I will get the same error as before.

 From the iptables-save I see no difference between the two lines, so 
why can't I delete it with the iptables -D and rule. ?
Is the way I add the rule from perl wrong ?

Vlad Adomnicai






^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-08-23 10:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-23 10:57 iptables::ipv4 problems Vlad Adomnicai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox