diff options
author | Liping Zhang <liping.zhang@spreadtrum.com> | 2016-07-23 15:11:39 +0800 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-07-23 13:13:56 +0200 |
commit | d89e5c0c84778a4effa40f69dbd3a68d0ec284fc (patch) | |
tree | 55e0e4de209806e5a9041606e1d82ce6ead21339 /extensions | |
parent | 9850680391f75da5d058b68283d52c1d281849a1 (diff) |
extensions: libxt_connlabel: add unit test
Add some unit tests for connlabel match extension:
# ./iptables-test.py extensions/libxt_connlabel.t
extensions/libxt_connlabel.t: OK
1 test files, 7 unit tests, 7 passed
Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/libxt_connlabel.t | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/extensions/libxt_connlabel.t b/extensions/libxt_connlabel.t new file mode 100644 index 00000000..aad1032b --- /dev/null +++ b/extensions/libxt_connlabel.t @@ -0,0 +1,18 @@ +:INPUT,FORWARD,OUTPUT +# Backup the connlabel.conf, then add some label maps for test +@[ -f /etc/xtables/connlabel.conf ] && mv /etc/xtables/connlabel.conf /tmp/connlabel.conf.bak +@mkdir -p /etc/xtables +@echo "40 bit40" > /etc/xtables/connlabel.conf +@echo "41 bit41" >> /etc/xtables/connlabel.conf +@echo "128 bit128" >> /etc/xtables/connlabel.conf +-m connlabel --label "bit40";=;OK +-m connlabel ! --label "bit40";=;OK +-m connlabel --label "bit41" --set;=;OK +-m connlabel ! --label "bit41" --set;=;OK +-m connlabel --label "bit128";;FAIL +@echo > /etc/xtables/connlabel.conf +-m connlabel --label "abc";;FAIL +@rm -f /etc/xtables/connlabel.conf +-m connlabel --label "abc";;FAIL +# Restore the original connlabel.conf +@[ -f /tmp/connlabel.conf.bak ] && mv /tmp/connlabel.conf.bak /etc/xtables/connlabel.conf |