summaryrefslogtreecommitdiffstats
path: root/iptables/tests/shell/testcases/ipt-restore/0008-restore-counters_0
blob: 854768c96e0da1dbcf8fa0d90d1032d7cd19b16a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/bash

set -e

DUMP="*filter
:foo - [23:42]
[13:37] -A foo -j ACCEPT
COMMIT
"

EXPECT=":foo - [0:0]
[0:0] -A foo -j ACCEPT"

$XT_MULTI iptables-restore <<< "$DUMP"
diff -u -Z <(echo -e "$EXPECT") <($XT_MULTI iptables-save --counters | grep foo)

# iptables-*-restore ignores custom chain counters :(
EXPECT=":foo - [0:0]
[13:37] -A foo -j ACCEPT"

$XT_MULTI iptables-restore --counters <<< "$DUMP"
diff -u -Z <(echo -e "$EXPECT") <($XT_MULTI iptables-save --counters | grep foo)

# if present, counters must be in proper format
! $XT_MULTI iptables-restore <<EOF
*filter
:FORWARD ACCEPT bar
COMMIT
EOF