Hi ,

Please find the patches for the testing of network NS.
The patches are created from the path LTP/testcases/kernel/containers .

Signed-off-by: Veerendra C <[EMAIL PROTECTED]>

This patch consists of the files..

containers/Makefile
containers/netns/Makefile
containers/netns/initialize.sh


Regards
Veerendra C

Index: containers/Makefile
===================================================================
--- containers.orig/Makefile
+++ containers/Makefile
@@ -18,7 +18,7 @@
 ##                                                                            ##
 ################################################################################
 
-SUBDIRS = libclone utsname sysvipc pidns
+SUBDIRS = libclone utsname sysvipc pidns netns
 
 all:
 	@set -e; $(MAKE) check_for_unshare; \
Index: containers/netns/Makefile
===================================================================
--- /dev/null
+++ containers/netns/Makefile
@@ -0,0 +1,50 @@
+################################################################################
+##                                                                            ##
+## Copyright (c) International Business Machines  Corp., 2007                 ##
+##                                                                            ##
+## 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA    ##
+##                                                                            ##
+################################################################################
+
+CFLAGS += -Wall -g
+CPPFLAGS += -I../../../../include -I../libclone
+LDLIBS += -L../../../../lib -L../libclone ../libclone/libnetns.a -lltp
+
+SRCS    = $(wildcard *.c)
+TARGETS = $(patsubst %.c,%,$(SRCS))
+NOLTP_TARGETS = $(patsubst %.c,%_noltp,$(NOLTPSRCS))
+SCRIPTS = initialize.sh parentns.sh childns.sh                  \
+parent.sh child.sh                                              \
+parent_view.sh parent_share.sh  child_propogate.sh              \
+parent_1.sh parent_2.sh child_1.sh child_2.sh                   \
+delchild.sh rename_net.sh                                       \
+paripv6.sh childipv6.sh                                         \
+par_ftp.sh ch_ftp.sh                                            \
+runnetnstest.sh							\
+
+%_noltp : %.c
+	$(CC) -g -DNO_LTP -o $@ $< ../libclone/libnetns.a
+
+all: $(TARGETS)
+	@chmod +x $(SCRIPTS)
+
+install:
+	@set -e; for i in $(TARGETS) runnetnstest.sh check_netns_enabled; do ln -f $$i ../../../bin/$$i ; chmod +x runnetnstest.sh ; done
+
+
+noltp:  $(NOLTP_TARGETS)
+
+clean:
+	rm -f $(TARGETS) *.o $(NOLTP_TARGETS)
Index: containers/netns/initialize.sh
===================================================================
--- /dev/null
+++ containers/netns/initialize.sh
@@ -0,0 +1,78 @@
+#!/bin/bash
+# This scripts contains the IP addr, PortNum of sshd
+# to be used and cleanup functions.
+set -x
+TCID=${TCID:-initialize}
+TST_TOTAL=1
+TST_COUNT=1
+export TCID
+export TST_COUNT
+export TST_TOTAL
+
+IP1='192.168.0.181'
+IP2='192.168.0.182'
+IP3='192.168.0.183'
+IP4='192.168.0.184'
+mask=/24
+PORT=7890
+PORT2=9876
+DEBUG=1
+
+# set the LTPROOT directory
+cd `dirname $0`
+LTPROOT=${PWD}
+echo $LTPROOT | grep netns > /dev/null 2>&1
+
+mkfifo /tmp/FIFO1 /tmp/FIFO2 /tmp/FIFO3 /tmp/FIFO4 /tmp/FIFO5 2> /dev/null
+if [ $? -eq 0 ]; then
+    cd ../../../../
+    LTPROOT=${PWD}
+    cd -
+fi
+
+FS_BIND=${LTPROOT}/testcases/kernel/fs/fs_bind/bin/smount
+if [ -f $FS_BIND ] ; then
+    smount=$FS_BIND
+fi
+
+IPver=`ip -V | awk  -F"-" ' {  print $2 } '` ;
+if [[ ${IPver} < "ss080417" ]] ; then
+    tst_resm "ip version should be atleast ss080417"
+    exit -1
+fi
+
+cleanup()
+{
+   if [ $# == 2 ]; then
+        pid=$1
+        netdev=$2
+    fi
+
+    tst_resm TINFO "doing cleanup operation "
+    # Delete the veth pair:
+    (ip link delete $netdev) 2> /dev/null
+    # Disable ip forwarding:
+    echo 0 > /proc/sys/net/ipv4/ip_forward
+    sleep 1
+    ( kill -9 $pid ) 2> /dev/null
+    rm -f /tmp/FIFO1 /tmp/FIFO2 /tmp/FIFO3 /tmp/FIFO4 /tmp/FIFO5 2> /dev/null || true
+}
+   
+debug()
+{
+    if [[ $DEBUG == 1 ]]
+    then
+        echo $1;
+    fi
+}
+
+create_veth()
+{
+        ip link show > /tmp/net1
+        ip link add type veth
+        sleep 2
+        ip link show > /tmp/net2
+        dev=(`diff /tmp/net1 /tmp/net2 | awk -F": "  ' /^> [0-9]*:/ { print $2  }  '` )
+        dev0=${dev[0]}
+        dev1=${dev[1]}
+}
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to