Skip to contentSkip to conversation

patch for rule insert

DISCUSSION varun 3 participants 3 messages Jul 4, 2006 netfilter

lore
Share & tools
lore

varun

author
#0 lore raw

Hi all,

I would loke to know if any of you have a patch for
inserting rule anywhere in the middle of the chain.
That is with -A we append the new rule and -I we add the
new rule to the top of the chain. So i wold like to insert it in middle of the chain. Is it possible? Does anyone have a patch for the same?

Varun

#1 lore raw
Quoted 3 lines · varun

That is with -A we append the new rule and -I we add the
new rule to the top of the chain. So i wold like to insert it in middle of the chain. Is it possible? Does anyone have a patch for the same?

man ipchains

[...]
SYNOPSIS
[...]
ipchains -[RI] chain rulenum rule-specification [options]
[...]
-I, --insert
Insert one or more rules in the selected chain as the given rule number. So, if the rule number is 1, the rule or rules are inserted at the head of the chain.

Seems it's been there from the beginning :)

iptables -I INPUT 4 ...

Will insert rule at 4th position.

Signature · 2 lines
http://sid.rstack.org/
PGP KeyID: 157E98EE FingerPrint: FA62226DA9E72FA8AECAA240008B480E157E98EE
Quoted 2 lines
Quoted 2 lines

Hi! I'm your friendly neighbourhood signature virus. Copy me to your signature file and help me spread!

#2 lore raw
In reply to varun
Quoted 5 lines

I would loke to know if any of you have a patch for
inserting rule anywhere in the middle of the chain.
That is with -A we append the new rule and -I we add the
new rule to the top of the chain. So i wold like to insert it in middle of the chain. Is it possible?

Look at the manpage / iptables --help output. Notice that the options -I, -R, and -D take a 'rulenum' argument (optional for -I). Also note that '-L --line-numbers' gives you such rulenums, if you don't want to count the rules by yourself.

Patrick