The function can be called in cleanup, so if it somehow failed,
there could be an infinite recursion. Fix it by removing 'tst_brkm'
and returning appropriate exit code.

Signed-off-by: Alexey Kodanev <alexey.koda...@oracle.com>
---
 testcases/lib/test_net.sh |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/testcases/lib/test_net.sh b/testcases/lib/test_net.sh
index acaed84..75ccd76 100644
--- a/testcases/lib/test_net.sh
+++ b/testcases/lib/test_net.sh
@@ -220,13 +220,13 @@ tst_add_ipaddr()
 
        if [ $type = "lhost" ]; then
                tst_resm TINFO "set local addr $(tst_ipaddr)/$mask"
-               ip addr add $(tst_ipaddr)/$mask dev $iface || \
-                       tst_brkm TBROK "failed to add IP address"
-               return
+               ip addr add $(tst_ipaddr)/$mask dev $iface
+               return $?
        fi
 
        tst_resm TINFO "set remote addr $(tst_ipaddr rhost)/$mask"
-       tst_rhost_run -s -c "ip addr add $(tst_ipaddr rhost)/$mask dev $iface"
+       tst_rhost_run -c "ip addr add $(tst_ipaddr rhost)/$mask dev $iface"
+       return $?
 }
 
 # tst_restore_ipaddr [TYPE] [LINK]
@@ -237,13 +237,14 @@ tst_restore_ipaddr()
 {
        local type=${1:-"lhost"}
        local link_num=${2:-"0"}
+       local ret=0
 
        tst_init_iface $type $link_num
 
        local backup_tst_ipv6=$TST_IPV6
-
-       TST_IPV6= tst_add_ipaddr $type $link_num
-       TST_IPV6=6 tst_add_ipaddr $type $link_num
-
+       TST_IPV6= tst_add_ipaddr $type $link_num || ret=$?
+       TST_IPV6=6 tst_add_ipaddr $type $link_num || ret=$?
        TST_IPV6=$backup_tst_ipv6
+
+       return $ret
 }
-- 
1.7.1


------------------------------------------------------------------------------
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

Reply via email to