Hi! > + tst_resm TINFO "Pinging 127.0.0.1" > + ping -c 2 127.0.0.1 > tst_iptables.out 2>&1
Why -c 2 ? > + if [ $? -ne 0 ]; then > + grep "100% packet loss" tst_iptables.out > tst_iptables.err > 2>&1 Eh, if ping failed, non-zero is returned, no need to grep the ping output as well. > + if [ $? -ne 0 ]; then > + tst_resm TFAIL \ > + "iptables did not block packets from > loopback" > + cat tst_iptables.err > + return > + else > + tst_resm TINFO "Ping 127.0.0.1 not successful." > + fi > + else > + tst_resm TFAIL "iptables did not block icmp from 127.0.0.1" > + cat tst_iptables.out > + return > + fi > + > + tst_resm TINFO "Deleting icmp DROP from lo rule." > + iptables -D OUTPUT 1 > tst_iptables.out 2>&1 > + if [ $? -ne 0 ]; then > + tst_resm TFAIL "iptables did not remove the rule." Again TBROK rather than TFAIL > + cat tst_iptables.out > + return > + fi > + tst_resm TINFO "Pinging 127.0.0.1 again" > + ping -c 2 127.0.0.1 > tst_iptables.out 2>&1 > + if [ $? -ne 0 ]; then > + tst_resm TFAIL "iptables blocking loopback. This is > expected" \ > + "behaviour on certain distributions where" \ > + "enabling firewall drops all packets by > default." > + cat tst_iptables.out > + return > + fi We should save and reset the iptables before the testcase and restore it after it. Otherwise we will not get consistent results. Also the test for working ping should be at the start of the testcase and we should skip it with TCONF if we cannot reach localhost. before testcase: iptables-save > saved_iptables iptables -F after testcase: iptables-restore < saved_iptables > + tst_resm TINFO "Ping succsess" > + tst_resm TPASS "iptables can DROP packets from particular network > card." > +} > + > init > TST_CLEANUP=cleanup > > @@ -460,5 +511,6 @@ test04 > test05 > test06 > test07 > +test08 > > tst_exit > -- > 1.6.0.2 . > > > ------------------------------------------------------------------------------ > _______________________________________________ > Ltp-list mailing list > Ltp-list@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/ltp-list -- Cyril Hrubis chru...@suse.cz ------------------------------------------------------------------------------ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list