Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Vlad Adomnicai <vlada@xana.ro>
To: netfilter@lists.netfilter.org
Subject: iptables::ipv4 problems
Date: Wed, 23 Aug 2006 13:57:26 +0300	[thread overview]
Message-ID: <44EC3496.30502@xana.ro> (raw)

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






                 reply	other threads:[~2006-08-23 10:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44EC3496.30502@xana.ro \
    --to=vlada@xana.ro \
    --cc=netfilter@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox