Add new testcase for testing 'iptables -c' Signed-off-by: Cui Bixuan <cuibix...@huawei.com> --- testcases/network/iptables/iptables_tests.sh | 33 +++++++++++++++++++++++++- 1 files changed, 32 insertions(+), 1 deletions(-)
diff --git a/testcases/network/iptables/iptables_tests.sh b/testcases/network/iptables/iptables_tests.sh index 5da5c94..8a34712 100755 --- a/testcases/network/iptables/iptables_tests.sh +++ b/testcases/network/iptables/iptables_tests.sh @@ -22,7 +22,7 @@ # <hubertnospa...@symbio.com.tw> export TCID="iptables" -export TST_TOTAL=6 +export TST_TOTAL=7 . test.sh @@ -337,6 +337,36 @@ test06() tst_resm TPASS "iptables can log packets with limited rate." } +test07() +{ + tst_resm TINFO "iptables -c test." + + iptables -A INPUT -s 127.0.0.1 -j DROP -c 10 500 \ + > tst_iptables.out 2>&1 + if [ $? -ne 0 ]; then + tst_resm TFAIL "iptables command failed to append new rule." + cat tst_iptables.out + return + fi + + iptables -L -v |grep " *10 *500" > tst_iptables.out 2>&1 + if [ $? -ne 0 ]; then + tst_resm TFAIL "iptables -c test failed." + cat tst_iptables.out + return + fi + + tst_resm TINFO "Deleting rule." + iptables -D INPUT 1 > tst_iptables.out 2>&1 + if [ $? -ne 0 ]; then + tst_resm TBROK "iptables did not remove the rule." + cat tst_iptables.out + return + fi + + tst_resm TPASS "iptables -c test succeed." +} + setup TST_CLEANUP=cleanup @@ -346,5 +376,6 @@ test03 test04 test05 test06 +test07 tst_exit -- 1.6.0.2 ------------------------------------------------------------------------------ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list