Skip to contentSkip to conversation

fork()-ing & exec()-ing iptables

DISCUSSION Peteris Krumins 1 participant 1 message Sep 15, 2003 netfilter

lore
Share & tools
lore
#0 lore raw

Hello,

I have a threaded application which would lock a mutex, fork, then exec iptables then unlock a mutex, so no two iptable programs ran at the same time.

After a period of time the same process would happen again but w/ the rule reversed (if it was -D then now it's -A and vice versa).

I have noticed a problem while deleting the rules - the rule is added but if there are loads of work (adding rules and removing rules), then iptables program would fail to remove the rule with misleading error:
iptables: Bad rule (does a matching rule exist in that chain?)

I verified twice - the rule is there and the command line which should remove the rule is correct.

What could cause such behaviour?

And it's iptables 1.2.8 & same happens w/ 1.2.7a, linux 2.4.20 and 2.4.21-pre6

P.Krumins