From: Alexey Kodanev <alexey.kodanev@oracle.com>
To: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH v2 3/3] iptables_tests.sh: Cleanup
Date: Tue, 27 Jan 2015 19:30:20 +0300 [thread overview]
Message-ID: <54C7BD1C.8020104@oracle.com> (raw)
In-Reply-To: <1422350191.1619.77.camel@G08JYZSD130126.localdomain>
On 01/27/2015 12:16 PM, Zeng Linggang wrote:
> Hi!
> On Mon, 2015-01-26 at 21:37 +0300, Alexey Kodanev wrote:
>> Hi!
>> On 01/21/2015 08:28 AM, Zeng Linggang wrote:
>>> * Use 'test.sh'.
>>> * Use 'tst_*' which defined in 'test.sh'.
>>> * Delete some useless comment.
>>> * Delete 'RC' and 'TFAILCNT'.
>>> * Some cleanup.
>>>
>>> Signed-off-by: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
>>> + modprobe ip_tables > tst_iptables.out 2>&1
>>> + if [ $? -ne 0 ]; then
>>> + iptables -L > tst_iptables.out 2>&1
>>> + if [ $? -ne 0 ]; then
>>> + tst_brkm TBROK "no iptables support in kenrel."
>>> fi
>>> fi
>> May be I missed something, but why we need to send output to the file,
>> then, in case of errors, rewrite it with "iptables -L" command?
>>
> The output file is really not necessary here. Maybe it just make our
> screen clearer. I think we need more discussion.
>
>>> + lsmod | grep "ip_tables" > tst_iptables.out 2>&1
>>> + if [ $? -eq 0 ]; then
>>> + iptables -F -t filter > tst_iptables.out 2>&1
>>> + iptables -F -t nat > tst_iptables.out 2>&1
>>> + iptables -F -t mangle > tst_iptables.out 2>&1
>>> + rmmod -v ipt_limit ipt_multiport ipt_LOG ipt_REJECT \
>>> + iptable_mangle iptable_nat ip_conntrack \
>>> + iptable_filter ip_tables > tst_iptables.out 2>&1
>>> fi
>>> - rm -fr $LTPTMP/tst_iptables.*
>>> - return $RC
>>> + tst_rmdir
>> And here, writing output to the file, then removing tmp dir.
>>
> ...
>
>>> + iptables -A INPUT -s 127.0.0.1 -p icmp -j DROP > tst_iptables.out 2>&1
>>> + if [ $? -ne 0 ]; then
>>> + tst_resm TFAIL "iptables command failed to append new rule."
>>> + return
>>> fi
>> At least, we could print 'tst_iptables.out' if the command failed.
>>
> OK. I will do that.
>
>>> + ping -c 2 127.0.0.1 > tst_iptables.out 2>&1
>>> + if [ $? -ne 0 ]; then
>>> + grep "100% packet loss" tst_iptables.out > tst_iptables.err 2>&1
>> The same with tst_iptables.err file.
>>
> OK.
>
>>> + iptables -F > tst_iptables.out 2>&1
>>> + if [ $? -ne 0 ]; then
>>> + tst_resm TFAIL "iptables did not flush all rules."
>>> + return
>>> else
>>> - tst_resm TINFO "$TCID: iptables logging succsess"
>>> - tst_resm TPASS "$TCID: iptables can log packets to multiple ports."
>>> + tst_resm TINFO "iptables logging succsess"
>>> + tst_resm TPASS "iptables can log packets to multiple ports."
>>> fi
>> You don't need "else .. fi" block because you return in the first one.
>>
> I think "else ... fi" is necessary when "$? -eq 0".
> I should remove the 'return' here.
What I mean here is that you could write TINFO/TPASS messages without
"else":
if [ $? -ne 0 ]; then
tst_resm TFAIL "error"
return
fi
tst_resm TPASS "success"
...
Thanks,
Alexey
------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next prev parent reply other threads:[~2015-01-27 16:28 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-26 10:58 [LTP] [PATCH 1/3] rlogin: Cleanup Zeng Linggang
2014-12-26 10:58 ` [LTP] [PATCH 2/3] telnet: Cleanup Zeng Linggang
2014-12-26 10:58 ` [LTP] [PATCH 3/3] iptables_tests.sh: Cleanup Zeng Linggang
2015-01-15 15:13 ` [LTP] [PATCH 1/3] rlogin: Cleanup Alexey Kodanev
2015-01-16 7:38 ` Zeng Linggang
2015-01-21 5:28 ` [LTP] [PATCH v2 " Zeng Linggang
2015-01-21 5:28 ` [LTP] [PATCH v2 2/3] telnet: Cleanup Zeng Linggang
2015-01-23 11:01 ` Alexey Kodanev
2015-01-27 7:41 ` Zeng Linggang
2015-01-27 16:19 ` Alexey Kodanev
2015-01-28 1:17 ` Zeng Linggang
2015-01-21 5:28 ` [LTP] [PATCH v2 3/3] iptables_tests.sh: Cleanup Zeng Linggang
2015-01-26 18:37 ` Alexey Kodanev
2015-01-27 9:16 ` Zeng Linggang
2015-01-27 16:30 ` Alexey Kodanev [this message]
2015-01-28 1:19 ` Zeng Linggang
2015-01-29 10:19 ` [LTP] [PATCH v3 1/3] rlogin: Cleanup Zeng Linggang
2015-01-29 10:19 ` [LTP] [PATCH v3 2/3] telnet: Cleanup Zeng Linggang
2015-01-29 10:19 ` [LTP] [PATCH v3 3/3] iptables_tests.sh: Cleanup Zeng Linggang
2015-02-06 12:56 ` [LTP] [PATCH v3 1/3] rlogin: Cleanup Alexey Kodanev
2015-01-23 11:02 ` [LTP] [PATCH v2 " Alexey Kodanev
2015-01-27 7:29 ` Zeng Linggang
-- strict thread matches above, loose matches on Subject: below --
2015-01-19 2:17 Zeng Linggang
2015-01-19 2:17 ` [LTP] [PATCH v2 3/3] iptables_tests.sh: Cleanup Zeng Linggang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54C7BD1C.8020104@oracle.com \
--to=alexey.kodanev@oracle.com \
--cc=ltp-list@lists.sourceforge.net \
--cc=zenglg.jy@cn.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox