public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] network: uniform network parameters
@ 2014-07-28 13:10 Alexey Kodanev
  2014-07-28 13:10 ` [LTP] [PATCH 2/2] network/stress/broken_ip: move common code to library Alexey Kodanev
  0 siblings, 1 reply; 3+ messages in thread
From: Alexey Kodanev @ 2014-07-28 13:10 UTC (permalink / raw)
  To: ltp-list; +Cc: vasily.isaenko

Move networktests.sh and networkstress.sh parameters to network.sh.
Both network scripts have the same settings (e.g. RHOST), and
some of the stress test parameters can be used by other net-tests,
such as LHOST_INTERFACE and RHOST_INTERFACE variables.
Also, add network features group to networkstress.sh.

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 runtest/network_stress.features |    9 +++++
 runtest/network_stress.tcp      |    2 -
 runtest/network_stress.udp      |    4 --
 send_patch.sh                   |    4 ++
 testcases/lib/test_net.sh       |   11 +++++++
 testscripts/network.sh          |   63 +++++++++++++++++++++++++++++++++++++++
 testscripts/networkstress.sh    |   35 ++++------------------
 testscripts/networktests.sh     |   10 +-----
 8 files changed, 94 insertions(+), 44 deletions(-)
 create mode 100644 runtest/network_stress.features
 create mode 100755 send_patch.sh
 create mode 100755 testscripts/network.sh

diff --git a/runtest/network_stress.features b/runtest/network_stress.features
new file mode 100644
index 0000000..14fa2d9
--- /dev/null
+++ b/runtest/network_stress.features
@@ -0,0 +1,9 @@
+#
+# Stress tests for various network features
+#
+
+tcp_fastopen tcp_fastopen_run.sh
+
+vxlan01 vxlan01.sh
+vxlan02 vxlan02.sh
+vxlan03 vxlan03.sh
diff --git a/runtest/network_stress.tcp b/runtest/network_stress.tcp
index 9795d2a..7206b3a 100644
--- a/runtest/network_stress.tcp
+++ b/runtest/network_stress.tcp
@@ -331,5 +331,3 @@ tcp6-multi-diffnic11 tcp6-multi-diffnic11
 tcp6-multi-diffnic12 tcp6-multi-diffnic12
 tcp6-multi-diffnic13 tcp6-multi-diffnic13
 tcp6-multi-diffnic14 tcp6-multi-diffnic14
-
-tcp_fastopen tcp_fastopen_run.sh
diff --git a/runtest/network_stress.udp b/runtest/network_stress.udp
index 2f62c14..bfe9d85 100644
--- a/runtest/network_stress.udp
+++ b/runtest/network_stress.udp
@@ -65,7 +65,3 @@ udp6-multi-diffnic04 udp6-multi-diffnic04
 udp6-multi-diffnic05 udp6-multi-diffnic05
 udp6-multi-diffnic06 udp6-multi-diffnic06
 udp6-multi-diffnic07 udp6-multi-diffnic07
-
-vxlan01 vxlan01.sh
-vxlan02 vxlan02.sh
-vxlan03 vxlan03.sh
diff --git a/send_patch.sh b/send_patch.sh
new file mode 100755
index 0000000..d2fae29
--- /dev/null
+++ b/send_patch.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+echo "Send patch..."
+git send-email --identity=ltp --annotate --smtp-debug --cover-letter --signoff ./../patchs/*
+echo "Done"
\ No newline at end of file
diff --git a/testcases/lib/test_net.sh b/testcases/lib/test_net.sh
index 51b3e38..81cfbb7 100644
--- a/testcases/lib/test_net.sh
+++ b/testcases/lib/test_net.sh
@@ -75,3 +75,14 @@ tst_rhost_run()
 
 	return $ret
 }
+
+tst_lhost_hwaddr()
+{
+	echo $(ip link show $LHOST_INTERFACE | awk 'NR==2 { print $2 }')
+}
+
+tst_rhost_hwaddr()
+{
+	echo $(tst_rhost_run -s -c "ip link show $RHOST_INTERFACE | \
+		awk 'NR==2 { print $2 }'")
+}
diff --git a/testscripts/network.sh b/testscripts/network.sh
new file mode 100755
index 0000000..79c43ad
--- /dev/null
+++ b/testscripts/network.sh
@@ -0,0 +1,63 @@
+#!/bin/sh
+
+# Network Test Parameters
+#
+# ---***** THESE MUST BE SET FOR CORRECT OPERATION *****---
+
+export RHOST=
+export PASSWD=
+
+# ---***************************************************---
+# More information about network parameters can be found
+# in the following document: testcases/network/stress/README
+
+LTP_RSH=
+
+# Set names for test interfaces
+LHOST_INTERFACE=
+RHOST_INTERFACE=
+
+# Set first three octets of the network address
+IPV4_NETWORK=
+# Set local host last octet
+LHOST_IPV4_HOST=
+# Set remote host last octet
+RHOST_IPV4_HOST=
+# Set the reverse of IPV4_NETWORK
+IPV4_NETWORK_REVERSE=
+# Set first three octets of the network address
+IPV6_NETWORK=
+# Set local host last octet
+LHOST_IPV6_HOST=
+# Set remote host last octet
+RHOST_IPV6_HOST=
+
+export HTTP_DOWNLOAD_DIR=
+export FTP_DOWNLOAD_DIR=
+export FTP_UPLOAD_DIR=
+export FTP_UPLOAD_URLDIR=
+
+# Set default parameters
+export LTP_RSH=${LTP_RSH:-"rsh -n"}
+export LHOST_INTERFACE=${LHOST_INTERFACE:-"eth0"}
+export RHOST_INTERFACE=${RHOST_INTERFACE:-"eth0"}
+export IPV4_NETWORK=${IPV4_NETWORK:-"10.0.0"}
+export IPV6_NETWORK=${IPV6_NETWORK:-"fd00:1:1:1"}
+export LHOST_IPV4_HOST=${LHOST_IPV4_HOST:-"2"}
+export RHOST_IPV4_HOST=${RHOST_IPV4_HOST:-"1"}
+export LHOST_IPV6_HOST=${LHOST_IPV6_HOST:-":2"}
+export RHOST_IPV6_HOST=${RHOST_IPV6_HOST:-":1"}
+export IPV4_NETWORK_REVERSE=${IPV4_NETWORK_REVERSE:-"0.0.10"}
+
+TST_TOTAL=1
+TCID="network_settings"
+
+. test_net.sh
+
+export LHOST_HWADDRS=$(tst_lhost_hwaddr)
+export RHOST_HWADDRS=$(tst_rhost_hwaddr)
+
+export TMPDIR=/tmp/netpan-$$
+mkdir -p $TMPDIR
+CMDFILE=${TMPDIR}/network.tests
+VERBOSE="no"
diff --git a/testscripts/networkstress.sh b/testscripts/networkstress.sh
index b40af72..47f365d 100755
--- a/testscripts/networkstress.sh
+++ b/testscripts/networkstress.sh
@@ -12,32 +12,10 @@ if [ $? -eq 0 ]; then
  export LTPROOT=${PWD}
 fi
 
-export TMPDIR=/tmp/netst-$$
-mkdir $TMPDIR
-VERBOSE="no"
-INTERFACE="eth0"
-
-#===========================================================================
-# Network parameters
-export RHOST=
-export RHOST_HWADDRS=
-export HTTP_DOWNLOAD_DIR=
-export FTP_DOWNLOAD_DIR=
-export FTP_UPLOAD_DIR=
-export FTP_UPLOAD_URLDIR=
-
-# Set firt three octets of the network address, by default 10.0.0
-export IPV4_NETWORK=
-# Set local host last octet, by default 2
-export LHOST_IPV4_HOST=
-# Set remote host last octet, by default 1
-export RHOST_IPV4_HOST=
-# Set the reverse of IPV4_NETWORK, by default 0.0.10
-export IPV4_NETWORK_REVERSE=
+. $LTPROOT/testscripts/network.sh $0
 
 #===========================================================================
 # Default Test Settings
-# export LTP_RSH=rsh
 # export NS_DURATION=3600	# 1 hour
 # export NS_TIMES=10000
 # export CONNECTION_TOTAL=4000
@@ -67,6 +45,7 @@ usage () {
     echo " -R|r: Stress test for routing table"
     echo " -B|b: Stress Broken IP packets"
     echo " -M|m: Multicast stress tests"
+    echo " -F|f: Stress test for network features"
     echo " -S|s: Run selected tests"
     echo " -W|w: Run whole network stress tests"
     echo " -D|d: Test duration (default ${NS_DURATION} sec)"
@@ -77,7 +56,7 @@ usage () {
     exit 1
 }
 
-while getopts AaEeTtIiUuRrMmSsWwBbVvN:n:D:d: OPTION
+while getopts AaEeTtIiUuRrMmFfSsWwBbVvN:n:D:d: OPTION
 do
     case $OPTION in
 	A|a) TEST_CASE="network_stress.appl";;
@@ -88,6 +67,7 @@ do
 	U|u) TEST_CASE="network_stress.udp";;
 	R|r) TEST_CASE="network_stress.route";;
 	M|m) TEST_CASE="network_stress.multicast";;
+	F|f) TEST_CASE="network_stress.features";;
 	S|s) TEST_CASE="network_stress.selected";;
 	W|w) TEST_CASE="network_stress.whole";;
 	V|v) VERBOSE="yes";;
@@ -102,8 +82,6 @@ if [ -z ${TEST_CASE} ]; then
 	usage
 fi
 
-export LHOST_HWADDRS=`ifconfig | grep ${INTERFACE} | grep HWaddr |awk '{print $5}'`
-
 if [ -z ${RHOST} ]; then
 	## Just a silly check
 	echo "Error: pay attention to configure"
@@ -119,9 +97,8 @@ export PATH="${PATH}:${LTPROOT}/testcases/bin"
 
 if [ ${VERBOSE} = "yes" ]; then
 	echo "Network parameters:"
-	echo " - ${INTERFACE} local interface (MAC address: ${LHOST_HWADDRS})"
-	echo " - Remote IP address: ${RHOST}"
-	echo " - Remote MAC address: ${RHOST_HWADDRS}"
+	echo " - ${LHOST_INTERFACE} local interface (MAC address: ${LHOST_HWADDRS})"
+	echo " - ${RHOST_INTERFACE} remote interface (MAC address: ${RHOST_HWADDRS})"
 
 	cat $TMPDIR/network_stress.tests
 	${LTPROOT}/ver_linux
diff --git a/testscripts/networktests.sh b/testscripts/networktests.sh
index b136749..507b7e3 100755
--- a/testscripts/networktests.sh
+++ b/testscripts/networktests.sh
@@ -1,11 +1,6 @@
 #!/bin/sh
 # This will run all the network tests, with the status logged in /tmp/netpan.log
 
-# ---***** THESE MUST BE SET FOR CORRECT OPERATION *****---
-export RHOST=
-export PASSWD=
-# ---***************************************************---
-
 cd `dirname $0`
 export LTPROOT=${PWD}
 echo $LTPROOT | grep testscripts > /dev/null 2>&1
@@ -14,10 +9,7 @@ if [ $? -eq 0 ]; then
  export LTPROOT=${PWD}
 fi
 
-export TMPDIR=/tmp/netpan-$$
-mkdir -p $TMPDIR
-CMDFILE=${TMPDIR}/network.tests
-VERBOSE="no"
+. $LTPROOT/testscripts/network.sh $0
 
 # For bitwise operation to determine which testsets run
 CMD_IPV6=1		# 0x0001
-- 
1.7.1


------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [LTP] [PATCH 2/2] network/stress/broken_ip: move common code to library
  2014-07-28 13:10 [LTP] [PATCH 1/2] network: uniform network parameters Alexey Kodanev
@ 2014-07-28 13:10 ` Alexey Kodanev
  2014-09-09 12:17   ` chrubis
  0 siblings, 1 reply; 3+ messages in thread
From: Alexey Kodanev @ 2014-07-28 13:10 UTC (permalink / raw)
  To: ltp-list; +Cc: vasily.isaenko

Move common code to test_net.sh (tst_lhost_hwaddr(), tst_rhost_hwaddr()),
broken_ipv4_lib.sh and broken_ipv6_lib.sh.

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 testcases/lib/test_net.sh                          |   50 ++++++
 .../network/stress/broken_ip/broken_ip4-checksum   |  155 +++----------------
 .../network/stress/broken_ip/broken_ip4-dstaddr    |  156 +++----------------
 .../network/stress/broken_ip/broken_ip4-fragment   |  156 +++----------------
 testcases/network/stress/broken_ip/broken_ip4-ihl  |  156 +++----------------
 .../network/stress/broken_ip/broken_ip4-protcol    |  155 +++----------------
 .../network/stress/broken_ip/broken_ip4-totlen     |  155 +++----------------
 .../network/stress/broken_ip/broken_ip4-version    |  155 +++----------------
 .../network/stress/broken_ip/broken_ip4_lib.sh     |   38 +++++
 .../network/stress/broken_ip/broken_ip6-dstaddr    |  157 +++----------------
 .../network/stress/broken_ip/broken_ip6-nexthdr    |  155 +++----------------
 testcases/network/stress/broken_ip/broken_ip6-plen |  156 +++----------------
 .../network/stress/broken_ip/broken_ip6-version    |  155 +++----------------
 .../network/stress/broken_ip/broken_ip6_lib.sh     |   37 +++++
 14 files changed, 384 insertions(+), 1452 deletions(-)
 create mode 100644 testcases/network/stress/broken_ip/broken_ip4_lib.sh
 create mode 100644 testcases/network/stress/broken_ip/broken_ip6_lib.sh

diff --git a/testcases/lib/test_net.sh b/testcases/lib/test_net.sh
index 81cfbb7..259127c 100644
--- a/testcases/lib/test_net.sh
+++ b/testcases/lib/test_net.sh
@@ -86,3 +86,53 @@ tst_rhost_hwaddr()
 	echo $(tst_rhost_run -s -c "ip link show $RHOST_INTERFACE | \
 		awk 'NR==2 { print $2 }'")
 }
+
+tst_set_ipv4_addr()
+{
+	# Initialize test interfaces
+	# The number of the test link where tests run
+	LINK_NUM=${LINK_NUM:-0}
+
+	initialize_if lhost ${LINK_NUM}
+	initialize_if rhost ${LINK_NUM}
+
+	# Netmask of the IPv4 network
+	network_mask=24
+
+	tst_resm TINFO "set remote ipv4 addr '$IPV4_NETWORK $RHOST_IPV4_HOST'"
+	# Set IPv4 addresses to the interfaces
+	set_ipv4addr rhost $LINK_NUM $IPV4_NETWORK $RHOST_IPV4_HOST
+	if [ $? -ne 0 ]; then
+		tst_brkm TBROK "Failed to add any IP address at the remote host"
+	fi
+
+	tst_resm TINFO "set local ipv4 addr '$IPV4_NETWORK $LHOST_IPV4_HOST'"
+	set_ipv4addr lhost $LINK_NUM $IPV4_NETWORK $LHOST_IPV4_HOST
+	if [ $? -ne 0 ]; then
+		tst_brkm TBROK "Failed to add any IP address at the local host"
+	fi
+}
+
+tst_set_ipv6_addr()
+{
+	# Initialize test interfaces
+	# The number of the test link where tests run
+	LINK_NUM=${LINK_NUM:-0}
+
+	initialize_if lhost ${LINK_NUM}
+	initialize_if rhost ${LINK_NUM}
+
+	# Netmask of the IPv6 network
+	network_mask=64
+
+	add_ipv6addr rhost $LINK_NUM $IPV6_NETWORK $RHOST_IPV6_HOST
+	if [ $? -ne 0 ]; then
+		tst_brkm TBROK "Failed to add any IP address at the remote host"
+	fi
+
+	# Set IPv6 addresses to the interfaces
+	add_ipv6addr lhost $LINK_NUM $IPV6_NETWORK $LHOST_IPV6_HOST
+	if [ $? -ne 0 ]; then
+		tst_brkm TBROK "Failed to add any IP address at the local host"
+	fi
+}
diff --git a/testcases/network/stress/broken_ip/broken_ip4-checksum b/testcases/network/stress/broken_ip/broken_ip4-checksum
index f492e77..a7cf643 100644
--- a/testcases/network/stress/broken_ip/broken_ip4-checksum
+++ b/testcases/network/stress/broken_ip/broken_ip4-checksum
@@ -1,28 +1,21 @@
 #!/bin/sh
 
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2006                 ##
-##                                                                            ##
-## This program is free software;  you can redistribute it and#or modify      ##
-## it under the terms of the GNU General Public License as published by       ##
-## the Free Software Foundation; either version 2 of the License, or          ##
-## (at your option) any later version.                                        ##
-##                                                                            ##
-## This program is distributed in the hope that it will be useful, but        ##
-## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
-## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
-## for more details.                                                          ##
-##                                                                            ##
-## You should have received a copy of the GNU General Public License          ##
-## along with this program;  if not, write to the Free Software               ##
-## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
-##                                                                            ##
-##                                                                            ##
-################################################################################
+# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) International Business Machines  Corp., 2006
 #
-# File:
-#   broken_ip4-checksum
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #
 # Description:
 #   Verify that the kernel is not crashed with receiving a large number of
@@ -43,123 +36,21 @@
 $trace_logic
 
 # The test case ID, the test case count and the total number of test case
-TCID=${TCID:-broken_ip4-checksum01}
+TCID=broken_ip4-checksum01
 TST_TOTAL=1
 TST_COUNT=1
 export TCID
 export TST_COUNT
 export TST_TOTAL
 
-# Test description
-tst_resm TINFO "Verify that the kernel is not crashed with receiving a large number of IPv4 packets that have wrong value in the checksum field"
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600}      # 1 hour
-
-# The number of the test link where tests run
-LINK_NUM=${LINK_NUM:-0}
-
-
-#-----------------------------------------------------------------------
-#
-# Function: do_cleanup
-#
-# Description:
-#   Recover the system configuration
-#
-#-----------------------------------------------------------------------
-do_cleanup()
-{
-    # Clean up each interface
-    initialize_if lhost ${LINK_NUM}
-    initialize_if rhost ${LINK_NUM}
-}
-
-
-#-----------------------------------------------------------------------
-#
-# Setup
-#
-
-# Output the informaion
-tst_resm TINFO "- Test duration is $NS_DURATION [sec]"
-
-# Get the MAC address of the interface at the local host
-field=`expr $LINK_NUM + 1`
-lhost_hwaddr=`echo $LHOST_HWADDRS | cut -d ' ' -f $field`
-if [ x${lhost_hwaddr} = x ]; then
-    tst_resm TBROK "Failed to get the MAC address name at the local host"
-    exit $TST_TOTAL
-fi
+. broken_ip4_lib.sh
 
-# Get the name of the interface at the remote host
-rhost_ifname=`get_ifname rhost $LINK_NUM`
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to get the interface name at the remote host"
-    exit $TST_TOTAL
-fi
+tst_resm TINFO "Verify that the kernel is not crashed with receiving \
+a large number of IPv4 packets that have wrong value in the checksum field"
 
-# Initialize the system configuration
-do_cleanup
-
-# Call do_cleanup function before exit
-trap do_cleanup 0
-
-# Network portion of the IPv4 address
-network_part=${IPV4_NETWORK:-"10.0.0"}
-
-# Netmask of the IPv4 network
-network_mask=24
-
-# Host portion of the IPv4 address
-lhost_host_part=${LHOST_IPV4_HOST:-"2"}     # local host
-rhost_host_part=${RHOST_IPV4_HOST:-"1"}     # remote host
-
-# Set IPv4 addresses to the interfaces
-set_ipv4addr lhost $LINK_NUM $network_part $lhost_host_part
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to add any IP address at the local host"
-    exit 1
-fi
-
-set_ipv4addr rhost $LINK_NUM $network_part $rhost_host_part
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to add any IP address at the remote host"
-    exit 1
-fi
-
-# IPv4 address of the local/remote host
-lhost_addr="${network_part}.${lhost_host_part}"
-rhost_addr="${network_part}.${rhost_host_part}"
-
-# Make sure the connectvity
-ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/check_icmpv4_connectivity $rhost_ifname $lhost_addr' ; echo $?'`
-if [ $ret -ne 0 ]; then
-    tst_resm TBROK "There is no IPv4 connectivity."
-    exit 1
-fi
-
-
-#-----------------------------------------------------------------------
-#
-# Main
-#
-#
-
-# Run a client
-$LTP_RSH $RHOST "${LTPROOT}/testcases/bin/ns-icmpv4_sender -I $rhost_ifname -S $rhost_addr -M $lhost_hwaddr -D $lhost_addr -s 56 -t $NS_DURATION -c"
-
-#-----------------------------------------------------------------------
-#
-# Clean up
-#
+$LTP_RSH $RHOST ns-icmpv4_sender -I $RHOST_INTERFACE -S $rhost_addr \
+-M $LHOST_HWADDRS -D $lhost_addr -s 56 -t $NS_DURATION -c
 
 tst_resm TPASS "Test is finished successfully."
-exit 0
+
+tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip4-dstaddr b/testcases/network/stress/broken_ip/broken_ip4-dstaddr
index 7e137bf..7826642 100644
--- a/testcases/network/stress/broken_ip/broken_ip4-dstaddr
+++ b/testcases/network/stress/broken_ip/broken_ip4-dstaddr
@@ -1,28 +1,21 @@
 #!/bin/sh
 
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2006                 ##
-##                                                                            ##
-## This program is free software;  you can redistribute it and#or modify      ##
-## it under the terms of the GNU General Public License as published by       ##
-## the Free Software Foundation; either version 2 of the License, or          ##
-## (at your option) any later version.                                        ##
-##                                                                            ##
-## This program is distributed in the hope that it will be useful, but        ##
-## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
-## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
-## for more details.                                                          ##
-##                                                                            ##
-## You should have received a copy of the GNU General Public License          ##
-## along with this program;  if not, write to the Free Software               ##
-## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
-##                                                                            ##
-##                                                                            ##
-################################################################################
+# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) International Business Machines  Corp., 2006
 #
-# File:
-#   broken_ip4-dstaddr
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #
 # Description:
 #   Verify that the kernel is not crashed with receiving a large number of
@@ -44,123 +37,22 @@
 $trace_logic
 
 # The test case ID, the test case count and the total number of test case
-TCID=${TCID:-broken_ip4-dstaddr01}
+TCID=broken_ip4-dstaddr01
 TST_TOTAL=1
 TST_COUNT=1
 export TCID
 export TST_COUNT
 export TST_TOTAL
 
-# Test description
-tst_resm TINFO "Verify that the kernel is not crashed with receiving a large number of IPv4 packets whose destination address is wrong (destination MAC address is correct)"
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600}      # 1 hour
-
-# The number of the test link where tests run
-LINK_NUM=${LINK_NUM:-0}
-
-
-#-----------------------------------------------------------------------
-#
-# Function: do_cleanup
-#
-# Description:
-#   Recover the system configuration
-#
-#-----------------------------------------------------------------------
-do_cleanup()
-{
-    # Clean up each interface
-    initialize_if lhost ${LINK_NUM}
-    initialize_if rhost ${LINK_NUM}
-}
-
-
-#-----------------------------------------------------------------------
-#
-# Setup
-#
-
-# Output the informaion
-tst_resm TINFO "- Test duration is $NS_DURATION [sec]"
-
-# Get the MAC address of the interface at the local host
-field=`expr $LINK_NUM + 1`
-lhost_hwaddr=`echo $LHOST_HWADDRS | cut -d ' ' -f $field`
-if [ x${lhost_hwaddr} = x ]; then
-    tst_resm TBROK "Failed to get the MAC address name at the local host"
-    exit $TST_TOTAL
-fi
+. broken_ip4_lib.sh
 
-# Get the name of the interface at the remote host
-rhost_ifname=`get_ifname rhost $LINK_NUM`
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to get the interface name at the remote host"
-    exit $TST_TOTAL
-fi
+tst_resm TINFO "Verify that the kernel is not crashed with receiving \
+a large number of IPv4 packets whose destination address is wrong \
+(destination MAC address is correct)"
 
-# Initialize the system configuration
-do_cleanup
-
-# Call do_cleanup function before exit
-trap do_cleanup 0
-
-# Network portion of the IPv4 address
-network_part=${IPV4_NETWORK:-"10.0.0"}
-
-# Netmask of the IPv4 network
-network_mask=24
-
-# Host portion of the IPv4 address
-lhost_host_part=${LHOST_IPV4_HOST:-"2"}     # local host
-rhost_host_part=${RHOST_IPV4_HOST:-"1"}     # remote host
-
-# Set IPv4 addresses to the interfaces
-set_ipv4addr lhost $LINK_NUM $network_part $lhost_host_part
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to add any IP address at the local host"
-    exit 1
-fi
-
-set_ipv4addr rhost $LINK_NUM $network_part $rhost_host_part
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to add any IP address at the remote host"
-    exit 1
-fi
-
-# IPv4 address of the local/remote host
-lhost_addr="${network_part}.${lhost_host_part}"
-rhost_addr="${network_part}.${rhost_host_part}"
-
-# Make sure the connectvity
-ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/check_icmpv4_connectivity $rhost_ifname $lhost_addr' ; echo $?'`
-if [ $ret -ne 0 ]; then
-    tst_resm TBROK "There is no IPv4 connectivity."
-    exit 1
-fi
-
-
-#-----------------------------------------------------------------------
-#
-# Main
-#
-#
-
-# Run a client
-$LTP_RSH $RHOST "${LTPROOT}/testcases/bin/ns-icmpv4_sender -I $rhost_ifname -S $rhost_addr -M $lhost_hwaddr -D $lhost_addr -s 56 -t $NS_DURATION -i"
-
-#-----------------------------------------------------------------------
-#
-# Clean up
-#
+$LTP_RSH $RHOST ns-icmpv4_sender -I $RHOST_INTERFACE -S $rhost_addr \
+-M $LHOST_HWADDRS -D $lhost_addr -s 56 -t $NS_DURATION -i
 
 tst_resm TPASS "Test is finished successfully."
-exit 0
+
+tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip4-fragment b/testcases/network/stress/broken_ip/broken_ip4-fragment
index 0f94c97..ad35d3e 100644
--- a/testcases/network/stress/broken_ip/broken_ip4-fragment
+++ b/testcases/network/stress/broken_ip/broken_ip4-fragment
@@ -1,28 +1,21 @@
 #!/bin/sh
 
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2006                 ##
-##                                                                            ##
-## This program is free software;  you can redistribute it and#or modify      ##
-## it under the terms of the GNU General Public License as published by       ##
-## the Free Software Foundation; either version 2 of the License, or          ##
-## (at your option) any later version.                                        ##
-##                                                                            ##
-## This program is distributed in the hope that it will be useful, but        ##
-## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
-## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
-## for more details.                                                          ##
-##                                                                            ##
-## You should have received a copy of the GNU General Public License          ##
-## along with this program;  if not, write to the Free Software               ##
-## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
-##                                                                            ##
-##                                                                            ##
-################################################################################
+# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) International Business Machines  Corp., 2006
 #
-# File:
-#   broken_ip4-fragment
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #
 # Description:
 #   Verify that the kernel is not crashed with receiving a large number of
@@ -43,123 +36,22 @@
 $trace_logic
 
 # The test case ID, the test case count and the total number of test case
-TCID=${TCID:-broken_ip4-fragment01}
+TCID=broken_ip4-fragment01
 TST_TOTAL=1
 TST_COUNT=1
 export TCID
 export TST_COUNT
 export TST_TOTAL
 
-# Test description
-tst_resm TINFO "Verify that the kernel is not crashed with receiving a large number of IPv4 packets that have wrong fragment information"
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600}      # 1 hour
-
-# The number of the test link where tests run
-LINK_NUM=${LINK_NUM:-0}
-
-
-#-----------------------------------------------------------------------
-#
-# Function: do_cleanup
-#
-# Description:
-#   Recover the system configuration
-#
-#-----------------------------------------------------------------------
-do_cleanup()
-{
-    # Clean up each interface
-    initialize_if lhost ${LINK_NUM}
-    initialize_if rhost ${LINK_NUM}
-}
-
-
-#-----------------------------------------------------------------------
-#
-# Setup
-#
-
-# Output the informaion
-tst_resm TINFO "- Test duration is $NS_DURATION [sec]"
-
-# Get the MAC address of the interface at the local host
-field=`expr $LINK_NUM + 1`
-lhost_hwaddr=`echo $LHOST_HWADDRS | cut -d ' ' -f $field`
-if [ x${lhost_hwaddr} = x ]; then
-    tst_resm TBROK "Failed to get the MAC address name at the local host"
-    exit $TST_TOTAL
-fi
+. broken_ip4_lib.sh
 
-# Get the name of the interface at the remote host
-rhost_ifname=`get_ifname rhost $LINK_NUM`
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to get the interface name at the remote host"
-    exit $TST_TOTAL
-fi
-
-# Initialize the system configuration
-do_cleanup
-
-# Call do_cleanup function before exit
-trap do_cleanup 0
-
-# Network portion of the IPv4 address
-network_part=${IPV4_NETWORK:-"10.0.0"}
-
-# Netmask of the IPv4 network
-network_mask=24
-
-# Host portion of the IPv4 address
-lhost_host_part=${LHOST_IPV4_HOST:-"2"}     # local host
-rhost_host_part=${RHOST_IPV4_HOST:-"1"}     # remote host
-
-# Set IPv4 addresses to the interfaces
-set_ipv4addr lhost $LINK_NUM $network_part $lhost_host_part
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to add any IP address at the local host"
-    exit 1
-fi
-
-set_ipv4addr rhost $LINK_NUM $network_part $rhost_host_part
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to add any IP address at the remote host"
-    exit 1
-fi
-
-# IPv4 address of the local/remote host
-lhost_addr="${network_part}.${lhost_host_part}"
-rhost_addr="${network_part}.${rhost_host_part}"
-
-# Make sure the connectvity
-ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/check_icmpv4_connectivity $rhost_ifname $lhost_addr' ; echo $?'`
-if [ $ret -ne 0 ]; then
-    tst_resm TBROK "There is no IPv4 connectivity."
-    exit 1
-fi
-
-
-#-----------------------------------------------------------------------
-#
-# Main
-#
-#
-
-# Run a client
-$LTP_RSH $RHOST "${LTPROOT}/testcases/bin/ns-icmpv4_sender -I $rhost_ifname -S $rhost_addr -M $lhost_hwaddr -D $lhost_addr -s 56 -t $NS_DURATION -f"
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed with receiving \
+a large number of IPv4 packets that have wrong fragment information"
 
-#-----------------------------------------------------------------------
-#
-# Clean up
-#
+$LTP_RSH $RHOST ns-icmpv4_sender -I $RHOST_INTERFACE -S $rhost_addr \
+-M $LHOST_HWADDRS -D $lhost_addr -s 56 -t $NS_DURATION -f
 
 tst_resm TPASS "Test is finished successfully."
-exit 0
+
+tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip4-ihl b/testcases/network/stress/broken_ip/broken_ip4-ihl
index 1e1e491..82faf49 100644
--- a/testcases/network/stress/broken_ip/broken_ip4-ihl
+++ b/testcases/network/stress/broken_ip/broken_ip4-ihl
@@ -1,28 +1,21 @@
 #!/bin/sh
 
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2006                 ##
-##                                                                            ##
-## This program is free software;  you can redistribute it and#or modify      ##
-## it under the terms of the GNU General Public License as published by       ##
-## the Free Software Foundation; either version 2 of the License, or          ##
-## (at your option) any later version.                                        ##
-##                                                                            ##
-## This program is distributed in the hope that it will be useful, but        ##
-## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
-## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
-## for more details.                                                          ##
-##                                                                            ##
-## You should have received a copy of the GNU General Public License          ##
-## along with this program;  if not, write to the Free Software               ##
-## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
-##                                                                            ##
-##                                                                            ##
-################################################################################
+# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) International Business Machines  Corp., 2006
 #
-# File:
-#   broken_ip4-ihl
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #
 # Description:
 #   Verify that the kernel is not crashed with receiving a large number of
@@ -43,123 +36,22 @@
 $trace_logic
 
 # The test case ID, the test case count and the total number of test case
-TCID=${TCID:-broken_ip4-ihl01}
+TCID=broken_ip4-ihl01
 TST_TOTAL=1
 TST_COUNT=1
 export TCID
 export TST_COUNT
 export TST_TOTAL
 
-# Test description
-tst_resm TINFO "Verify that the kernel is not crashed with receiving a large number of IPv4 packets that have wrong value in the header length field."
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600}      # 1 hour
-
-# The number of the test link where tests run
-LINK_NUM=${LINK_NUM:-0}
-
-
-#-----------------------------------------------------------------------
-#
-# Function: do_cleanup
-#
-# Description:
-#   Recover the system configuration
-#
-#-----------------------------------------------------------------------
-do_cleanup()
-{
-    # Clean up each interface
-    initialize_if lhost ${LINK_NUM}
-    initialize_if rhost ${LINK_NUM}
-}
-
-
-#-----------------------------------------------------------------------
-#
-# Setup
-#
-
-# Output the informaion
-tst_resm TINFO "- Test duration is $NS_DURATION [sec]"
-
-# Get the MAC address of the interface at the local host
-field=`expr $LINK_NUM + 1`
-lhost_hwaddr=`echo $LHOST_HWADDRS | cut -d ' ' -f $field`
-if [ x${lhost_hwaddr} = x ]; then
-    tst_resm TBROK "Failed to get the MAC address name at the local host"
-    exit $TST_TOTAL
-fi
+. broken_ip4_lib.sh
 
-# Get the name of the interface at the remote host
-rhost_ifname=`get_ifname rhost $LINK_NUM`
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to get the interface name at the remote host"
-    exit $TST_TOTAL
-fi
+tst_resm TINFO "Verify that the kernel is not crashed with receiving \
+a large number of IPv4 packets that have wrong value in the header \
+length field."
 
-# Initialize the system configuration
-do_cleanup
-
-# Call do_cleanup function before exit
-trap do_cleanup 0
-
-# Network portion of the IPv4 address
-network_part=${IPV4_NETWORK:-"10.0.0"}
-
-# Netmask of the IPv4 network
-network_mask=24
-
-# Host portion of the IPv4 address
-lhost_host_part=${LHOST_IPV4_HOST:-"2"}     # local host
-rhost_host_part=${RHOST_IPV4_HOST:-"1"}     # remote host
-
-# Set IPv4 addresses to the interfaces
-set_ipv4addr lhost $LINK_NUM $network_part $lhost_host_part
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to add any IP address at the local host"
-    exit 1
-fi
-
-set_ipv4addr rhost $LINK_NUM $network_part $rhost_host_part
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to add any IP address at the remote host"
-    exit 1
-fi
-
-# IPv4 address of the local/remote host
-lhost_addr="${network_part}.${lhost_host_part}"
-rhost_addr="${network_part}.${rhost_host_part}"
-
-# Make sure the connectvity
-ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/check_icmpv4_connectivity $rhost_ifname $lhost_addr' ; echo $?'`
-if [ $ret -ne 0 ]; then
-    tst_resm TBROK "There is no IPv4 connectivity."
-    exit 1
-fi
-
-
-#-----------------------------------------------------------------------
-#
-# Main
-#
-#
-
-# Run a client
-$LTP_RSH $RHOST "${LTPROOT}/testcases/bin/ns-icmpv4_sender -I $rhost_ifname -S $rhost_addr -M $lhost_hwaddr -D $lhost_addr -s 56 -t $NS_DURATION -l"
-
-#-----------------------------------------------------------------------
-#
-# Clean up
-#
+$LTP_RSH $RHOST ns-icmpv4_sender -I $RHOST_INTERFACE -S $rhost_addr \
+-M $LHOST_HWADDRS -D $lhost_addr -s 56 -t $NS_DURATION -l
 
 tst_resm TPASS "Test is finished successfully."
-exit 0
+
+tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip4-protcol b/testcases/network/stress/broken_ip/broken_ip4-protcol
index 4b86f66..3275228 100644
--- a/testcases/network/stress/broken_ip/broken_ip4-protcol
+++ b/testcases/network/stress/broken_ip/broken_ip4-protcol
@@ -1,28 +1,21 @@
 #!/bin/sh
 
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2006                 ##
-##                                                                            ##
-## This program is free software;  you can redistribute it and#or modify      ##
-## it under the terms of the GNU General Public License as published by       ##
-## the Free Software Foundation; either version 2 of the License, or          ##
-## (at your option) any later version.                                        ##
-##                                                                            ##
-## This program is distributed in the hope that it will be useful, but        ##
-## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
-## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
-## for more details.                                                          ##
-##                                                                            ##
-## You should have received a copy of the GNU General Public License          ##
-## along with this program;  if not, write to the Free Software               ##
-## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
-##                                                                            ##
-##                                                                            ##
-################################################################################
+# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) International Business Machines  Corp., 2006
 #
-# File:
-#   broken_ip4-protocol
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #
 # Description:
 #   Verify that the kernel is not crashed with receiving a large number of
@@ -43,123 +36,21 @@
 $trace_logic
 
 # The test case ID, the test case count and the total number of test case
-TCID=${TCID:-broken_ip4-protocol01}
+TCID=broken_ip4-protocol01
 TST_TOTAL=1
 TST_COUNT=1
 export TCID
 export TST_COUNT
 export TST_TOTAL
 
-# Test description
-tst_resm TINFO "Verify that the kernel is not crashed with receiving a large number of IPv4 packets that have wrong value in the protocol field"
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600}      # 1 hour
-
-# The number of the test link where tests run
-LINK_NUM=${LINK_NUM:-0}
-
-
-#-----------------------------------------------------------------------
-#
-# Function: do_cleanup
-#
-# Description:
-#   Recover the system configuration
-#
-#-----------------------------------------------------------------------
-do_cleanup()
-{
-    # Clean up each interface
-    initialize_if lhost ${LINK_NUM}
-    initialize_if rhost ${LINK_NUM}
-}
-
-
-#-----------------------------------------------------------------------
-#
-# Setup
-#
-
-# Output the informaion
-tst_resm TINFO "- Test duration is $NS_DURATION [sec]"
-
-# Get the MAC address of the interface at the local host
-field=`expr $LINK_NUM + 1`
-lhost_hwaddr=`echo $LHOST_HWADDRS | cut -d ' ' -f $field`
-if [ x${lhost_hwaddr} = x ]; then
-    tst_resm TBROK "Failed to get the MAC address name at the local host"
-    exit $TST_TOTAL
-fi
+. broken_ip4_lib.sh
 
-# Get the name of the interface at the remote host
-rhost_ifname=`get_ifname rhost $LINK_NUM`
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to get the interface name at the remote host"
-    exit $TST_TOTAL
-fi
+tst_resm TINFO "Verify that the kernel is not crashed with receiving \
+a large number of IPv4 packets that have wrong value in the protocol field"
 
-# Initialize the system configuration
-do_cleanup
-
-# Call do_cleanup function before exit
-trap do_cleanup 0
-
-# Network portion of the IPv4 address
-network_part=${IPV4_NETWORK:-"10.0.0"}
-
-# Netmask of the IPv4 network
-network_mask=24
-
-# Host portion of the IPv4 address
-lhost_host_part=${LHOST_IPV4_HOST:-"2"}     # local host
-rhost_host_part=${RHOST_IPV4_HOST:-"1"}     # remote host
-
-# Set IPv4 addresses to the interfaces
-set_ipv4addr lhost $LINK_NUM $network_part $lhost_host_part
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to add any IP address at the local host"
-    exit 1
-fi
-
-set_ipv4addr rhost $LINK_NUM $network_part $rhost_host_part
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to add any IP address at the remote host"
-    exit 1
-fi
-
-# IPv4 address of the local/remote host
-lhost_addr="${network_part}.${lhost_host_part}"
-rhost_addr="${network_part}.${rhost_host_part}"
-
-# Make sure the connectvity
-ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/check_icmpv4_connectivity $rhost_ifname $lhost_addr' ; echo $?'`
-if [ $ret -ne 0 ]; then
-    tst_resm TBROK "There is no IPv4 connectivity."
-    exit 1
-fi
-
-
-#-----------------------------------------------------------------------
-#
-# Main
-#
-#
-
-# Run a client
-$LTP_RSH $RHOST "${LTPROOT}/testcases/bin/ns-icmpv4_sender -I $rhost_ifname -S $rhost_addr -M $lhost_hwaddr -D $lhost_addr -s 56 -t $NS_DURATION -p"
-
-#-----------------------------------------------------------------------
-#
-# Clean up
-#
+$LTP_RSH $RHOST ns-icmpv4_sender -I $RHOST_INTERFACE -S $rhost_addr \
+-M $LHOST_HWADDRS -D $lhost_addr -s 56 -t $NS_DURATION -p
 
 tst_resm TPASS "Test is finished successfully."
-exit 0
+
+tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip4-totlen b/testcases/network/stress/broken_ip/broken_ip4-totlen
index 3ee18b8..0bfe509 100644
--- a/testcases/network/stress/broken_ip/broken_ip4-totlen
+++ b/testcases/network/stress/broken_ip/broken_ip4-totlen
@@ -1,28 +1,21 @@
 #!/bin/sh
 
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2006                 ##
-##                                                                            ##
-## This program is free software;  you can redistribute it and#or modify      ##
-## it under the terms of the GNU General Public License as published by       ##
-## the Free Software Foundation; either version 2 of the License, or          ##
-## (at your option) any later version.                                        ##
-##                                                                            ##
-## This program is distributed in the hope that it will be useful, but        ##
-## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
-## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
-## for more details.                                                          ##
-##                                                                            ##
-## You should have received a copy of the GNU General Public License          ##
-## along with this program;  if not, write to the Free Software               ##
-## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
-##                                                                            ##
-##                                                                            ##
-################################################################################
+# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) International Business Machines  Corp., 2006
 #
-# File:
-#   broken_ip4-totlen
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #
 # Description:
 #   Verify that the kernel is not crashed with receiving a large number of
@@ -43,123 +36,21 @@
 $trace_logic
 
 # The test case ID, the test case count and the total number of test case
-TCID=${TCID:-broken_ip4-totlen01}
+TCID=broken_ip4-totlen01
 TST_TOTAL=1
 TST_COUNT=1
 export TCID
 export TST_COUNT
 export TST_TOTAL
 
-# Test description
-tst_resm TINFO "Verify that the kernel is not crashed with receiving a large number of IPv4 packets that have wrong value in the total length field."
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600}      # 1 hour
-
-# The number of the test link where tests run
-LINK_NUM=${LINK_NUM:-0}
-
-
-#-----------------------------------------------------------------------
-#
-# Function: do_cleanup
-#
-# Description:
-#   Recover the system configuration
-#
-#-----------------------------------------------------------------------
-do_cleanup()
-{
-    # Clean up each interface
-    initialize_if lhost ${LINK_NUM}
-    initialize_if rhost ${LINK_NUM}
-}
-
-
-#-----------------------------------------------------------------------
-#
-# Setup
-#
-
-# Output the informaion
-tst_resm TINFO "- Test duration is $NS_DURATION [sec]"
-
-# Get the MAC address of the interface at the local host
-field=`expr $LINK_NUM + 1`
-lhost_hwaddr=`echo $LHOST_HWADDRS | cut -d ' ' -f $field`
-if [ x${lhost_hwaddr} = x ]; then
-    tst_resm TBROK "Failed to get the MAC address name at the local host"
-    exit $TST_TOTAL
-fi
+. broken_ip4_lib.sh
 
-# Get the name of the interface at the remote host
-rhost_ifname=`get_ifname rhost $LINK_NUM`
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to get the interface name at the remote host"
-    exit $TST_TOTAL
-fi
+tst_resm TINFO "Verify that the kernel is not crashed with receiving \
+a large number of IPv4 packets that have wrong value in the total length field."
 
-# Initialize the system configuration
-do_cleanup
-
-# Call do_cleanup function before exit
-trap do_cleanup 0
-
-# Network portion of the IPv4 address
-network_part=${IPV4_NETWORK:-"10.0.0"}
-
-# Netmask of the IPv4 network
-network_mask=24
-
-# Host portion of the IPv4 address
-lhost_host_part=${LHOST_IPV4_HOST:-"2"}     # local host
-rhost_host_part=${RHOST_IPV4_HOST:-"1"}     # remote host
-
-# Set IPv4 addresses to the interfaces
-set_ipv4addr lhost $LINK_NUM $network_part $lhost_host_part
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to add any IP address at the local host"
-    exit 1
-fi
-
-set_ipv4addr rhost $LINK_NUM $network_part $rhost_host_part
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to add any IP address at the remote host"
-    exit 1
-fi
-
-# IPv4 address of the local/remote host
-lhost_addr="${network_part}.${lhost_host_part}"
-rhost_addr="${network_part}.${rhost_host_part}"
-
-# Make sure the connectvity
-ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/check_icmpv4_connectivity $rhost_ifname $lhost_addr' ; echo $?'`
-if [ $ret -ne 0 ]; then
-    tst_resm TBROK "There is no IPv4 connectivity."
-    exit 1
-fi
-
-
-#-----------------------------------------------------------------------
-#
-# Main
-#
-#
-
-# Run a client
-$LTP_RSH $RHOST "${LTPROOT}/testcases/bin/ns-icmpv4_sender -I $rhost_ifname -S $rhost_addr -M $lhost_hwaddr -D $lhost_addr -s 56 -t $NS_DURATION -L"
-
-#-----------------------------------------------------------------------
-#
-# Clean up
-#
+$LTP_RSH $RHOST ns-icmpv4_sender -I $RHOST_INTERFACE -S $rhost_addr \
+-M $LHOST_HWADDRS -D $lhost_addr -s 56 -t $NS_DURATION -L
 
 tst_resm TPASS "Test is finished successfully."
-exit 0
+
+tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip4-version b/testcases/network/stress/broken_ip/broken_ip4-version
index 66f6b8a..8dfef2b 100644
--- a/testcases/network/stress/broken_ip/broken_ip4-version
+++ b/testcases/network/stress/broken_ip/broken_ip4-version
@@ -1,28 +1,21 @@
 #!/bin/sh
 
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2006                 ##
-##                                                                            ##
-## This program is free software;  you can redistribute it and#or modify      ##
-## it under the terms of the GNU General Public License as published by       ##
-## the Free Software Foundation; either version 2 of the License, or          ##
-## (at your option) any later version.                                        ##
-##                                                                            ##
-## This program is distributed in the hope that it will be useful, but        ##
-## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
-## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
-## for more details.                                                          ##
-##                                                                            ##
-## You should have received a copy of the GNU General Public License          ##
-## along with this program;  if not, write to the Free Software               ##
-## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
-##                                                                            ##
-##                                                                            ##
-################################################################################
+# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) International Business Machines  Corp., 2006
 #
-# File:
-#   broken_ip4-version
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #
 # Description:
 #   Verify that the kernel is not crashed with receiving a large number of
@@ -43,123 +36,21 @@
 $trace_logic
 
 # The test case ID, the test case count and the total number of test case
-TCID=${TCID:-broken_ip4-version01}
+TCID=broken_ip4-version01
 TST_TOTAL=1
 TST_COUNT=1
 export TCID
 export TST_COUNT
 export TST_TOTAL
 
-# Test description
-tst_resm TINFO "Verify that the kernel is not crashed with receiving a large number of IPv4 packets that have wrong value in version field."
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600}      # 1 hour
-
-# The number of the test link where tests run
-LINK_NUM=${LINK_NUM:-0}
-
-
-#-----------------------------------------------------------------------
-#
-# Function: do_cleanup
-#
-# Description:
-#   Recover the system configuration
-#
-#-----------------------------------------------------------------------
-do_cleanup()
-{
-    # Clean up each interface
-    initialize_if lhost ${LINK_NUM}
-    initialize_if rhost ${LINK_NUM}
-}
-
-
-#-----------------------------------------------------------------------
-#
-# Setup
-#
-
-# Output the informaion
-tst_resm TINFO "- Test duration is $NS_DURATION [sec]"
-
-# Get the MAC address of the interface at the local host
-field=`expr $LINK_NUM + 1`
-lhost_hwaddr=`echo $LHOST_HWADDRS | cut -d ' ' -f $field`
-if [ x${lhost_hwaddr} = x ]; then
-    tst_resm TBROK "Failed to get the MAC address name at the local host"
-    exit $TST_TOTAL
-fi
+. broken_ip4_lib.sh
 
-# Get the name of the interface at the remote host
-rhost_ifname=`get_ifname rhost $LINK_NUM`
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to get the interface name at the remote host"
-    exit $TST_TOTAL
-fi
+tst_resm TINFO "Verify that the kernel is not crashed with receiving \
+a large number of IPv4 packets that have wrong value in version field."
 
-# Initialize the system configuration
-do_cleanup
-
-# Call do_cleanup function before exit
-trap do_cleanup 0
-
-# Network portion of the IPv4 address
-network_part=${IPV4_NETWORK:-"10.0.0"}
-
-# Netmask of the IPv4 network
-network_mask=24
-
-# Host portion of the IPv4 address
-lhost_host_part=${LHOST_IPV4_HOST:-"2"}    # local host
-rhost_host_part=${RHOST_IPV4_HOST:-"1"}     # remote host
-
-# Set IPv4 addresses to the interfaces
-set_ipv4addr lhost $LINK_NUM $network_part $lhost_host_part
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to add any IP address at the local host"
-    exit 1
-fi
-
-set_ipv4addr rhost $LINK_NUM $network_part $rhost_host_part
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to add any IP address at the remote host"
-    exit 1
-fi
-
-# IPv4 address of the local/remote host
-lhost_addr="${network_part}.${lhost_host_part}"
-rhost_addr="${network_part}.${rhost_host_part}"
-
-# Make sure the connectvity
-ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/check_icmpv4_connectivity $rhost_ifname $lhost_addr' ; echo $?'`
-if [ $ret -ne 0 ]; then
-    tst_resm TBROK "There is no IPv4 connectivity."
-    exit 1
-fi
-
-
-#-----------------------------------------------------------------------
-#
-# Main
-#
-#
-
-# Run a client
-$LTP_RSH $RHOST "${LTPROOT}/testcases/bin/ns-icmpv4_sender -I $rhost_ifname -S $rhost_addr -M $lhost_hwaddr -D $lhost_addr -s 56 -t $NS_DURATION -v"
-
-#-----------------------------------------------------------------------
-#
-# Clean up
-#
+$LTP_RSH $RHOST ns-icmpv4_sender -I $RHOST_INTERFACE -S $rhost_addr \
+-M $LHOST_HWADDRS -D $lhost_addr -s 56 -t $NS_DURATION -v
 
 tst_resm TPASS "Test is finished successfully."
-exit 0
+
+tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip4_lib.sh b/testcases/network/stress/broken_ip/broken_ip4_lib.sh
new file mode 100644
index 0000000..aafabd4
--- /dev/null
+++ b/testcases/network/stress/broken_ip/broken_ip4_lib.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) International Business Machines  Corp., 2006
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+. test_net.sh
+
+# Output the informaion
+tst_resm TINFO "- Test duration is $NS_DURATION [sec]"
+
+tst_set_ipv4_addr
+
+# IPv4 address of the local/remote host
+lhost_addr=$IPV4_NETWORK.$LHOST_IPV4_HOST
+rhost_addr=$IPV4_NETWORK.$RHOST_IPV4_HOST
+
+ret=$($LTP_RSH $RHOST check_icmpv4_connectivity \
+	$RHOST_INTERFACE $lhost_addr; echo $?)
+
+if [ "$ret" -ne 0 ]; then
+	tst_brkm TBROK "There is no IPv4 connectivity."
+else
+	tst_resm TINFO "There is IPv4 connectivity."
+fi
diff --git a/testcases/network/stress/broken_ip/broken_ip6-dstaddr b/testcases/network/stress/broken_ip/broken_ip6-dstaddr
index 79fcc5f..c5c93ed 100644
--- a/testcases/network/stress/broken_ip/broken_ip6-dstaddr
+++ b/testcases/network/stress/broken_ip/broken_ip6-dstaddr
@@ -1,28 +1,21 @@
 #!/bin/sh
 
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2006                 ##
-##                                                                            ##
-## This program is free software;  you can redistribute it and#or modify      ##
-## it under the terms of the GNU General Public License as published by       ##
-## the Free Software Foundation; either version 2 of the License, or          ##
-## (at your option) any later version.                                        ##
-##                                                                            ##
-## This program is distributed in the hope that it will be useful, but        ##
-## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
-## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
-## for more details.                                                          ##
-##                                                                            ##
-## You should have received a copy of the GNU General Public License          ##
-## along with this program;  if not, write to the Free Software               ##
-## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
-##                                                                            ##
-##                                                                            ##
-################################################################################
+# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) International Business Machines  Corp., 2006
 #
-# File:
-#   broken_ip6-dstaddr
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #
 # Description:
 #   Verify that the kernel is not crashed with receiving a large number of
@@ -44,123 +37,23 @@
 $trace_logic
 
 # The test case ID, the test case count and the total number of test case
-TCID=${TCID:-broken_ip6-dstaddr01}
+TCID=broken_ip6-dstaddr01
 TST_TOTAL=1
 TST_COUNT=1
 export TCID
 export TST_COUNT
 export TST_TOTAL
 
-# Test description
-tst_resm TINFO "Verify that the kernel is not crashed with receiving a large number of IPv6 packets whose destination address is wrong (destination MAC address is correct)"
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600}      # 1 hour
-
-# The number of the test link where tests run
-LINK_NUM=${LINK_NUM:-0}
-
-
-#-----------------------------------------------------------------------
-#
-# Function: do_cleanup
-#
-# Description:
-#   Recover the system configuration
-#
-#-----------------------------------------------------------------------
-do_cleanup()
-{
-    # Clean up each interface
-    initialize_if lhost ${LINK_NUM}
-    initialize_if rhost ${LINK_NUM}
-}
-
-
-#-----------------------------------------------------------------------
-#
-# Setup
-#
-
-# Output the informaion
-tst_resm TINFO "- Test duration is $NS_DURATION [sec]"
-
-# Get the MAC address of the interface at the local host
-field=`expr $LINK_NUM + 1`
-lhost_hwaddr=`echo $LHOST_HWADDRS | cut -d ' ' -f $field`
-if [ x${lhost_hwaddr} = x ]; then
-    tst_resm TBROK "Failed to get the MAC address name at the local host"
-    exit $TST_TOTAL
-fi
+. broken_ip6_lib.sh
 
-# Get the name of the interface at the remote host
-rhost_ifname=`get_ifname rhost $LINK_NUM`
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to get the interface name at the remote host"
-    exit $TST_TOTAL
-fi
-
-# Initialize the system configuration
-do_cleanup
-
-# Call do_cleanup function before exit
-trap do_cleanup 0
-
-# Network portion of the IPv6 address
-network_part="fd00:1:1:1"
-
-# Netmask of the IPv6 network
-network_mask=64
-
-# Host portion of the IPv6 address
-lhost_host_part=":2"     # local host
-rhost_host_part=":1"     # remote host
-
-# Set IPv6 addresses to the interfaces
-add_ipv6addr lhost $LINK_NUM $network_part $lhost_host_part
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to add any IP address at the local host"
-    exit 1
-fi
-
-add_ipv6addr rhost $LINK_NUM $network_part $rhost_host_part
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to add any IP address at the remote host"
-    exit 1
-fi
-
-# IPv6 address of the local/remote host
-lhost_addr="${network_part}:${lhost_host_part}"
-rhost_addr="${network_part}:${rhost_host_part}"
-
-# Make sure the connectvity
-ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/check_icmpv6_connectivity $rhost_ifname $lhost_addr' ; echo $?'`
-if [ $ret -ne 0 ]; then
-    tst_resm TBROK "There is no IPv6 connectivity."
-    exit 1
-fi
-
-
-#-----------------------------------------------------------------------
-#
-# Main
-#
-#
-
-# Run a client
-$LTP_RSH $RHOST "${LTPROOT}/testcases/bin/ns-icmpv6_sender -I $rhost_ifname -S $rhost_addr -M $lhost_hwaddr -D $lhost_addr -s 56 -t $NS_DURATION -i"
+# Test description
+tst_resm TINFO "Verify that the kernel is not crashed with receiving \
+a large number of IPv6 packets whose destination address is wrong \
+(destination MAC address is correct)"
 
-#-----------------------------------------------------------------------
-#
-# Clean up
-#
+$LTP_RSH $RHOST ns-icmpv6_sender -I $RHOST_INTERFACE -S $rhost_addr \
+-M $LHOST_HWADDRS -D $lhost_addr -s 56 -t $NS_DURATION -i
 
 tst_resm TPASS "Test is finished successfully."
-exit 0
+
+tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip6-nexthdr b/testcases/network/stress/broken_ip/broken_ip6-nexthdr
index 81b158d..f6671fb 100644
--- a/testcases/network/stress/broken_ip/broken_ip6-nexthdr
+++ b/testcases/network/stress/broken_ip/broken_ip6-nexthdr
@@ -1,28 +1,21 @@
 #!/bin/sh
 
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2006                 ##
-##                                                                            ##
-## This program is free software;  you can redistribute it and#or modify      ##
-## it under the terms of the GNU General Public License as published by       ##
-## the Free Software Foundation; either version 2 of the License, or          ##
-## (at your option) any later version.                                        ##
-##                                                                            ##
-## This program is distributed in the hope that it will be useful, but        ##
-## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
-## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
-## for more details.                                                          ##
-##                                                                            ##
-## You should have received a copy of the GNU General Public License          ##
-## along with this program;  if not, write to the Free Software               ##
-## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
-##                                                                            ##
-##                                                                            ##
-################################################################################
+# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) International Business Machines  Corp., 2006
 #
-# File:
-#   broken_ip6-nexthdr
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #
 # Description:
 #   Verify that the kernel is not crashed with receiving a large number of
@@ -43,123 +36,21 @@
 $trace_logic
 
 # The test case ID, the test case count and the total number of test case
-TCID=${TCID:-broken_ip6-nexthdr01}
+TCID=broken_ip6-nexthdr01
 TST_TOTAL=1
 TST_COUNT=1
 export TCID
 export TST_COUNT
 export TST_TOTAL
 
-# Test description
-tst_resm TINFO "Verify that the kernel is not crashed with receiving a large number of IPv6 packets that have wrong value in the next header field."
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600}      # 1 hour
-
-# The number of the test link where tests run
-LINK_NUM=${LINK_NUM:-0}
-
-
-#-----------------------------------------------------------------------
-#
-# Function: do_cleanup
-#
-# Description:
-#   Recover the system configuration
-#
-#-----------------------------------------------------------------------
-do_cleanup()
-{
-    # Clean up each interface
-    initialize_if lhost ${LINK_NUM}
-    initialize_if rhost ${LINK_NUM}
-}
-
-
-#-----------------------------------------------------------------------
-#
-# Setup
-#
-
-# Output the informaion
-tst_resm TINFO "- Test duration is $NS_DURATION [sec]"
-
-# Get the MAC address of the interface at the local host
-field=`expr $LINK_NUM + 1`
-lhost_hwaddr=`echo $LHOST_HWADDRS | cut -d ' ' -f $field`
-if [ x${lhost_hwaddr} = x ]; then
-    tst_resm TBROK "Failed to get the MAC address name at the local host"
-    exit $TST_TOTAL
-fi
+. broken_ip6_lib.sh
 
-# Get the name of the interface at the remote host
-rhost_ifname=`get_ifname rhost $LINK_NUM`
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to get the interface name at the remote host"
-    exit $TST_TOTAL
-fi
+tst_resm TINFO "Verify that the kernel is not crashed with receiving \
+a large number of IPv6 packets that have wrong value in the next header field."
 
-# Initialize the system configuration
-do_cleanup
-
-# Call do_cleanup function before exit
-trap do_cleanup 0
-
-# Network portion of the IPv6 address
-network_part="fd00:1:1:1"
-
-# Netmask of the IPv6 network
-network_mask=64
-
-# Host portion of the IPv6 address
-lhost_host_part=":2"     # local host
-rhost_host_part=":1"     # remote host
-
-# Set IPv6 addresses to the interfaces
-add_ipv6addr lhost $LINK_NUM $network_part $lhost_host_part
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to add any IP address at the local host"
-    exit 1
-fi
-
-add_ipv6addr rhost $LINK_NUM $network_part $rhost_host_part
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to add any IP address at the remote host"
-    exit 1
-fi
-
-# IPv6 address of the local/remote host
-lhost_addr="${network_part}:${lhost_host_part}"
-rhost_addr="${network_part}:${rhost_host_part}"
-
-# Make sure the connectvity
-ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/check_icmpv6_connectivity $rhost_ifname $lhost_addr' ; echo $?'`
-if [ $ret -ne 0 ]; then
-    tst_resm TBROK "There is no IPv6 connectivity."
-    exit 1
-fi
-
-
-#-----------------------------------------------------------------------
-#
-# Main
-#
-#
-
-# Run a client
-$LTP_RSH $RHOST "${LTPROOT}/testcases/bin/ns-icmpv6_sender -I $rhost_ifname -S $rhost_addr -M $lhost_hwaddr -D $lhost_addr -s 56 -t $NS_DURATION -n"
-
-#-----------------------------------------------------------------------
-#
-# Clean up
-#
+$LTP_RSH $RHOST ns-icmpv6_sender -I $RHOST_INTERFACE -S $rhost_addr \
+-M $LHOST_HWADDRS -D $lhost_addr -s 56 -t $NS_DURATION -n
 
 tst_resm TPASS "Test is finished successfully."
-exit 0
+
+tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip6-plen b/testcases/network/stress/broken_ip/broken_ip6-plen
index b62e751..421c503 100644
--- a/testcases/network/stress/broken_ip/broken_ip6-plen
+++ b/testcases/network/stress/broken_ip/broken_ip6-plen
@@ -1,28 +1,21 @@
 #!/bin/sh
 
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2006                 ##
-##                                                                            ##
-## This program is free software;  you can redistribute it and#or modify      ##
-## it under the terms of the GNU General Public License as published by       ##
-## the Free Software Foundation; either version 2 of the License, or          ##
-## (at your option) any later version.                                        ##
-##                                                                            ##
-## This program is distributed in the hope that it will be useful, but        ##
-## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
-## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
-## for more details.                                                          ##
-##                                                                            ##
-## You should have received a copy of the GNU General Public License          ##
-## along with this program;  if not, write to the Free Software               ##
-## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
-##                                                                            ##
-##                                                                            ##
-################################################################################
+# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) International Business Machines  Corp., 2006
 #
-# File:
-#   broken_ip6-plen
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #
 # Description:
 #   Verify that the kernel is not crashed with receiving a large number of
@@ -43,123 +36,22 @@
 $trace_logic
 
 # The test case ID, the test case count and the total number of test case
-TCID=${TCID:-broken_ip6-plen01}
+TCID=broken_ip6-plen01
 TST_TOTAL=1
 TST_COUNT=1
 export TCID
 export TST_COUNT
 export TST_TOTAL
 
-# Test description
-tst_resm TINFO "Verify that the kernel is not crashed with receiving a large number of IPv6 packets that have wrong value in the payload length field."
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600}      # 1 hour
-
-# The number of the test link where tests run
-LINK_NUM=${LINK_NUM:-0}
-
-
-#-----------------------------------------------------------------------
-#
-# Function: do_cleanup
-#
-# Description:
-#   Recover the system configuration
-#
-#-----------------------------------------------------------------------
-do_cleanup()
-{
-    # Clean up each interface
-    initialize_if lhost ${LINK_NUM}
-    initialize_if rhost ${LINK_NUM}
-}
-
-
-#-----------------------------------------------------------------------
-#
-# Setup
-#
-
-# Output the informaion
-tst_resm TINFO "- Test duration is $NS_DURATION [sec]"
-
-# Get the MAC address of the interface at the local host
-field=`expr $LINK_NUM + 1`
-lhost_hwaddr=`echo $LHOST_HWADDRS | cut -d ' ' -f $field`
-if [ x${lhost_hwaddr} = x ]; then
-    tst_resm TBROK "Failed to get the MAC address name at the local host"
-    exit $TST_TOTAL
-fi
+. broken_ip6_lib.sh
 
-# Get the name of the interface at the remote host
-rhost_ifname=`get_ifname rhost $LINK_NUM`
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to get the interface name at the remote host"
-    exit $TST_TOTAL
-fi
+tst_resm TINFO "Verify that the kernel is not crashed with receiving \
+a large number of IPv6 packets that have wrong value in the payload \
+length field."
 
-# Initialize the system configuration
-do_cleanup
-
-# Call do_cleanup function before exit
-trap do_cleanup 0
-
-# Network portion of the IPv6 address
-network_part="fd00:1:1:1"
-
-# Netmask of the IPv6 network
-network_mask=64
-
-# Host portion of the IPv6 address
-lhost_host_part=":2"     # local host
-rhost_host_part=":1"     # remote host
-
-# Set IPv6 addresses to the interfaces
-add_ipv6addr lhost $LINK_NUM $network_part $lhost_host_part
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to add any IP address at the local host"
-    exit 1
-fi
-
-add_ipv6addr rhost $LINK_NUM $network_part $rhost_host_part
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to add any IP address at the remote host"
-    exit 1
-fi
-
-# IPv6 address of the local/remote host
-lhost_addr="${network_part}:${lhost_host_part}"
-rhost_addr="${network_part}:${rhost_host_part}"
-
-# Make sure the connectvity
-ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/check_icmpv6_connectivity $rhost_ifname $lhost_addr' ; echo $?'`
-if [ $ret -ne 0 ]; then
-    tst_resm TBROK "There is no IPv6 connectivity."
-    exit 1
-fi
-
-
-#-----------------------------------------------------------------------
-#
-# Main
-#
-#
-
-# Run a client
-$LTP_RSH $RHOST "${LTPROOT}/testcases/bin/ns-icmpv6_sender -I $rhost_ifname -S $rhost_addr -M $lhost_hwaddr -D $lhost_addr -s 56 -t $NS_DURATION -L"
-
-#-----------------------------------------------------------------------
-#
-# Clean up
-#
+$LTP_RSH $RHOST ns-icmpv6_sender -I $RHOST_INTERFACE -S $rhost_addr \
+-M $LHOST_HWADDRS -D $lhost_addr -s 56 -t $NS_DURATION -L
 
 tst_resm TPASS "Test is finished successfully."
-exit 0
+
+tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip6-version b/testcases/network/stress/broken_ip/broken_ip6-version
index 3ebfbfe..1b5e8ac 100644
--- a/testcases/network/stress/broken_ip/broken_ip6-version
+++ b/testcases/network/stress/broken_ip/broken_ip6-version
@@ -1,28 +1,21 @@
 #!/bin/sh
 
-################################################################################
-##                                                                            ##
-## Copyright (c) International Business Machines  Corp., 2006                 ##
-##                                                                            ##
-## This program is free software;  you can redistribute it and#or modify      ##
-## it under the terms of the GNU General Public License as published by       ##
-## the Free Software Foundation; either version 2 of the License, or          ##
-## (at your option) any later version.                                        ##
-##                                                                            ##
-## This program is distributed in the hope that it will be useful, but        ##
-## WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY ##
-## or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License   ##
-## for more details.                                                          ##
-##                                                                            ##
-## You should have received a copy of the GNU General Public License          ##
-## along with this program;  if not, write to the Free Software               ##
-## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    ##
-##                                                                            ##
-##                                                                            ##
-################################################################################
+# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) International Business Machines  Corp., 2006
 #
-# File:
-#   broken_ip6-version
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #
 # Description:
 #   Verify that the kernel is not crashed with receiving a large number of
@@ -43,123 +36,21 @@
 $trace_logic
 
 # The test case ID, the test case count and the total number of test case
-TCID=${TCID:-broken_ip6-version01}
+TCID=broken_ip6-version01
 TST_TOTAL=1
 TST_COUNT=1
 export TCID
 export TST_COUNT
 export TST_TOTAL
 
-# Test description
-tst_resm TINFO "Verify that the kernel is not crashed with receiving a large number of IPv6 packets that have wrong value in version field."
-
-# Make sure the value of LTPROOT
-LTPROOT=${LTPROOT:-`(cd ../../../.. ; pwd)`}
-export LTPROOT
-
-# Check the environmanet variable
-. check_envval || exit $TST_TOTAL
-
-# Dulation of the test [sec]
-NS_DURATION=${NS_DURATION:-3600}      # 1 hour
-
-# The number of the test link where tests run
-LINK_NUM=${LINK_NUM:-0}
-
-
-#-----------------------------------------------------------------------
-#
-# Function: do_cleanup
-#
-# Description:
-#   Recover the system configuration
-#
-#-----------------------------------------------------------------------
-do_cleanup()
-{
-    # Clean up each interface
-    initialize_if lhost ${LINK_NUM}
-    initialize_if rhost ${LINK_NUM}
-}
-
-
-#-----------------------------------------------------------------------
-#
-# Setup
-#
-
-# Output the informaion
-tst_resm TINFO "- Test duration is $NS_DURATION [sec]"
-
-# Get the MAC address of the interface at the local host
-field=`expr $LINK_NUM + 1`
-lhost_hwaddr=`echo $LHOST_HWADDRS | cut -d ' ' -f $field`
-if [ x${lhost_hwaddr} = x ]; then
-    tst_resm TBROK "Failed to get the MAC address name at the local host"
-    exit $TST_TOTAL
-fi
+. broken_ip6_lib.sh
 
-# Get the name of the interface at the remote host
-rhost_ifname=`get_ifname rhost $LINK_NUM`
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to get the interface name at the remote host"
-    exit $TST_TOTAL
-fi
+tst_resm TINFO "Verify that the kernel is not crashed with receiving \
+a large number of IPv6 packets that have wrong value in version field."
 
-# Initialize the system configuration
-do_cleanup
-
-# Call do_cleanup function before exit
-trap do_cleanup 0
-
-# Network portion of the IPv6 address
-network_part="fd00:1:1:1"
-
-# Netmask of the IPv6 network
-network_mask=64
-
-# Host portion of the IPv6 address
-lhost_host_part=":2"     # local host
-rhost_host_part=":1"     # remote host
-
-# Set IPv6 addresses to the interfaces
-add_ipv6addr lhost $LINK_NUM $network_part $lhost_host_part
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to add any IP address at the local host"
-    exit 1
-fi
-
-add_ipv6addr rhost $LINK_NUM $network_part $rhost_host_part
-if [ $? -ne 0 ]; then
-    tst_resm TBROK "Failed to add any IP address at the remote host"
-    exit 1
-fi
-
-# IPv6 address of the local/remote host
-lhost_addr="${network_part}:${lhost_host_part}"
-rhost_addr="${network_part}:${rhost_host_part}"
-
-# Make sure the connectvity
-ret=`$LTP_RSH $RHOST ${LTPROOT}/testcases/bin/check_icmpv6_connectivity $rhost_ifname $lhost_addr' ; echo $?'`
-if [ $ret -ne 0 ]; then
-    tst_resm TBROK "There is no IPv6 connectivity."
-    exit 1
-fi
-
-
-#-----------------------------------------------------------------------
-#
-# Main
-#
-#
-
-# Run a client
-$LTP_RSH $RHOST "${LTPROOT}/testcases/bin/ns-icmpv6_sender -I $rhost_ifname -S $rhost_addr -M $lhost_hwaddr -D $lhost_addr -s 56 -t $NS_DURATION -v"
-
-#-----------------------------------------------------------------------
-#
-# Clean up
-#
+$LTP_RSH $RHOST ns-icmpv6_sender -I $RHOST_INTERFACE -S $rhost_addr \
+-M $LHOST_HWADDRS -D $lhost_addr -s 56 -t $NS_DURATION -v
 
 tst_resm TPASS "Test is finished successfully."
-exit 0
+
+tst_exit
diff --git a/testcases/network/stress/broken_ip/broken_ip6_lib.sh b/testcases/network/stress/broken_ip/broken_ip6_lib.sh
new file mode 100644
index 0000000..5457c19
--- /dev/null
+++ b/testcases/network/stress/broken_ip/broken_ip6_lib.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+# Copyright (c) 2014 Oracle and/or its affiliates. All Rights Reserved.
+# Copyright (c) International Business Machines  Corp., 2006
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it would be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write the Free Software Foundation,
+# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+. test_net.sh
+
+# Output the informaion
+tst_resm TINFO "- Test duration is $NS_DURATION [sec]"
+
+tst_set_ipv6_addr
+
+# IPv6 address of the local/remote host
+lhost_addr="$IPV6_NETWORK:$LHOST_IPV6_HOST"
+rhost_addr="$IPV6_NETWORK:$RHOST_IPV6_HOST"
+
+# Make sure the connectvity
+ret=$($LTP_RSH $RHOST check_icmpv6_connectivity \
+	$RHOST_INTERFACE $lhost_addr; echo $?)
+
+if [ $ret -ne 0 ]; then
+    tst_brkm TBROK "There is no IPv6 connectivity."
+fi
-- 
1.7.1


------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH 2/2] network/stress/broken_ip: move common code to library
  2014-07-28 13:10 ` [LTP] [PATCH 2/2] network/stress/broken_ip: move common code to library Alexey Kodanev
@ 2014-09-09 12:17   ` chrubis
  0 siblings, 0 replies; 3+ messages in thread
From: chrubis @ 2014-09-09 12:17 UTC (permalink / raw)
  To: Alexey Kodanev; +Cc: vasily.isaenko, ltp-list

Hi!
> +tst_set_ipv4_addr()
> +{
> +	# Initialize test interfaces
> +	# The number of the test link where tests run
> +	LINK_NUM=${LINK_NUM:-0}
> +
> +	initialize_if lhost ${LINK_NUM}
> +	initialize_if rhost ${LINK_NUM}
> +
> +	# Netmask of the IPv4 network
> +	network_mask=24
> +
> +	tst_resm TINFO "set remote ipv4 addr '$IPV4_NETWORK $RHOST_IPV4_HOST'"
> +	# Set IPv4 addresses to the interfaces
> +	set_ipv4addr rhost $LINK_NUM $IPV4_NETWORK $RHOST_IPV4_HOST
> +	if [ $? -ne 0 ]; then
> +		tst_brkm TBROK "Failed to add any IP address at the remote host"
> +	fi
> +
> +	tst_resm TINFO "set local ipv4 addr '$IPV4_NETWORK $LHOST_IPV4_HOST'"
> +	set_ipv4addr lhost $LINK_NUM $IPV4_NETWORK $LHOST_IPV4_HOST
> +	if [ $? -ne 0 ]; then
> +		tst_brkm TBROK "Failed to add any IP address at the local host"
> +	fi
> +}

I would love to get the code from initialize_if and set_ipv4addr to be
cleaned and moved here to the test_net.sh but that would require
changing all the stress testcases first.

The changes looks good to me, acked.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce.
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-09 12:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-28 13:10 [LTP] [PATCH 1/2] network: uniform network parameters Alexey Kodanev
2014-07-28 13:10 ` [LTP] [PATCH 2/2] network/stress/broken_ip: move common code to library Alexey Kodanev
2014-09-09 12:17   ` chrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox