Blame iptables/tests/shell/testcases/ipt-restore/0016-concurrent-restores_0
|
Packit Service |
2b945a |
#!/bin/bash
|
|
Packit Service |
2b945a |
|
|
Packit Service |
1f6e8b |
# test for iptables-restore --noflush skipping an explicitly requested chain
|
|
Packit Service |
1f6e8b |
# flush because the chain did not exist when cache was fetched. In order to
|
|
Packit Service |
1f6e8b |
# expect for that chain to appear when refreshing the transaction (due to a
|
|
Packit Service |
1f6e8b |
# concurrent ruleset change), the chain flush job has to be present in batch
|
|
Packit Service |
1f6e8b |
# job list (although disabled at first).
|
|
Packit Service |
1f6e8b |
# The input line requesting chain flush is ':FOO - [0:0]'. RS1 and RS2 contents
|
|
Packit Service |
1f6e8b |
# are crafted to cause EBUSY when deleting the BAR* chains if FOO is not
|
|
Packit Service |
1f6e8b |
# flushed in the same transaction.
|
|
Packit Service |
1f6e8b |
|
|
Packit Service |
2b945a |
set -e
|
|
Packit Service |
2b945a |
|
|
Packit Service |
2b945a |
RS="*filter
|
|
Packit Service |
2b945a |
:INPUT ACCEPT [12024:3123388]
|
|
Packit Service |
2b945a |
:FORWARD ACCEPT [0:0]
|
|
Packit Service |
2b945a |
:OUTPUT ACCEPT [12840:2144421]
|
|
Packit Service |
2b945a |
:FOO - [0:0]
|
|
Packit Service |
2b945a |
:BAR0 - [0:0]
|
|
Packit Service |
2b945a |
:BAR1 - [0:0]
|
|
Packit Service |
2b945a |
:BAR2 - [0:0]
|
|
Packit Service |
2b945a |
:BAR3 - [0:0]
|
|
Packit Service |
2b945a |
:BAR4 - [0:0]
|
|
Packit Service |
2b945a |
:BAR5 - [0:0]
|
|
Packit Service |
2b945a |
:BAR6 - [0:0]
|
|
Packit Service |
2b945a |
:BAR7 - [0:0]
|
|
Packit Service |
2b945a |
:BAR8 - [0:0]
|
|
Packit Service |
2b945a |
:BAR9 - [0:0]
|
|
Packit Service |
2b945a |
"
|
|
Packit Service |
2b945a |
|
|
Packit Service |
2b945a |
RS1="$RS
|
|
Packit Service |
2b945a |
-X BAR3
|
|
Packit Service |
2b945a |
-X BAR6
|
|
Packit Service |
2b945a |
-X BAR9
|
|
Packit Service |
2b945a |
-A FOO -s 9.9.0.1/32 -j BAR1
|
|
Packit Service |
2b945a |
-A FOO -s 9.9.0.2/32 -j BAR2
|
|
Packit Service |
2b945a |
-A FOO -s 9.9.0.4/32 -j BAR4
|
|
Packit Service |
2b945a |
-A FOO -s 9.9.0.5/32 -j BAR5
|
|
Packit Service |
2b945a |
-A FOO -s 9.9.0.7/32 -j BAR7
|
|
Packit Service |
2b945a |
-A FOO -s 9.9.0.8/32 -j BAR8
|
|
Packit Service |
2b945a |
COMMIT
|
|
Packit Service |
2b945a |
"
|
|
Packit Service |
2b945a |
|
|
Packit Service |
2b945a |
RS2="$RS
|
|
Packit Service |
2b945a |
-X BAR2
|
|
Packit Service |
2b945a |
-X BAR5
|
|
Packit Service |
2b945a |
-X BAR7
|
|
Packit Service |
2b945a |
-A FOO -s 9.9.0.1/32 -j BAR1
|
|
Packit Service |
2b945a |
-A FOO -s 9.9.0.3/32 -j BAR3
|
|
Packit Service |
2b945a |
-A FOO -s 9.9.0.4/32 -j BAR4
|
|
Packit Service |
2b945a |
-A FOO -s 9.9.0.6/32 -j BAR6
|
|
Packit Service |
2b945a |
-A FOO -s 9.9.0.8/32 -j BAR8
|
|
Packit Service |
2b945a |
-A FOO -s 9.9.0.9/32 -j BAR9
|
|
Packit Service |
2b945a |
COMMIT
|
|
Packit Service |
2b945a |
"
|
|
Packit Service |
2b945a |
|
|
Packit Service |
1f6e8b |
NORS="*filter
|
|
Packit Service |
1f6e8b |
COMMIT
|
|
Packit Service |
1f6e8b |
"
|
|
Packit Service |
1f6e8b |
|
|
Packit Service |
2b945a |
for n in $(seq 1 10); do
|
|
Packit Service |
1f6e8b |
$XT_MULTI iptables-restore <<< "$NORS"
|
|
Packit Service |
2b945a |
$XT_MULTI iptables-restore --noflush -w <<< "$RS1" &
|
|
Packit Service |
2b945a |
$XT_MULTI iptables-restore --noflush -w <<< "$RS2" &
|
|
Packit Service |
2b945a |
wait -n
|
|
Packit Service |
2b945a |
wait -n
|
|
Packit Service |
2b945a |
done
|