[LARTC] Simultaneous iptables calls

Daniel Webb lists at danielwebb.us
Sun Apr 9 06:12:35 CEST 2006


Run this as one process:

#!/bin/sh
while [ 1 = 1 ]; do
    iptables -t mangle -F chain1
    iptables -t mangle -X chain1
    iptables -t mangle -N chain1 || exit 1
done

Run this as another process:

#!/bin/sh
while [ 1 = 1 ]; do
    iptables -t mangle -F chain2
    iptables -t mangle -X chain2
    iptables -t mangle -N chain2 || exit 1
done

and you get:

iptables: No chain/target/match by that name
iptables: No chain/target/match by that name
iptables: Unknown error 4294967295
iptables: Unknown error 4294967295
iptables: Chain already exists
iptables: Unknown error 4294967295
iptables: Unknown error 4294967295
iptables: Unknown error 4294967295
iptables v1.3.5: can't initialize iptables table `mangle': Bad file descriptor
Perhaps iptables or your kernel needs to be upgraded.

<... etc>

I'm don't understand the things going on under the surface, so maybe there is
a reason it's impossible to have some kind of locking to prevent this, like
for example, with chmod:

#!/bin/sh
while [ 1 = 1 ]; do
    chmod 777 mod_me
done

#!/bin/sh
while [ 1 = 1 ]; do
    chmod 666 mod_me
done

(no errors)



More information about the LARTC mailing list