This patch changes the way information is exchanged between parent and child.
This is required because of the following reason:
Earlier the child was in the same pid namespace as parent and this info was
passed from the child to the parent through a fifo. But now the child is in
a separate pid namespace and hence this pid will not make any sence to the
parent.

Signed-off-by: Sudhir Kumar <sku...@linux.vnet.ibm.com>

Index: ltp-full-20081130/testcases/kernel/containers/libclone/libnetns.c
===================================================================
--- ltp-full-20081130.orig/testcases/kernel/containers/libclone/libnetns.c
+++ ltp-full-20081130/testcases/kernel/containers/libclone/libnetns.c
@@ -109,7 +109,9 @@ int create_net_namespace(char *p1, char 
                 exit(1);
         }
 
-    sprintf(par, "%s/testcases/kernel/containers/netns/parentns.sh %s" , 
ltproot, p1);
+       /* We need to pass the child pid to the parentns.sh script */
+    sprintf(par, "%s/testcases/kernel/containers/netns/parentns.sh %s %u",
+                                                       ltproot, p1, pid);
 
         ret = system(par);
         status = WEXITSTATUS(ret);
Index: ltp-full-20081130/testcases/kernel/containers/netns/parentns.sh
===================================================================
--- ltp-full-20081130.orig/testcases/kernel/containers/netns/parentns.sh
+++ ltp-full-20081130/testcases/kernel/containers/netns/parentns.sh
@@ -43,7 +43,7 @@ export TST_TOTAL
 status=0
 
     # Checks if any script is passed as argument.
-    if [ $# == 1 ]; then
+    if [ $# == 2 ]; then
         scrpt=$1
         debug "INFO: Script to be executed in parent NS is $scrpt"
     fi
@@ -69,7 +69,8 @@ status=0
     echo 1 > /proc/sys/net/ipv4/conf/$vnet0/proxy_arp
 
     # Waits for the Child-NS to get created and reads the PID
-    pid=`cat /tmp/FIFO1`
+    tmp=`cat /tmp/FIFO1`;
+    pid=$2;
     debug "INFO: the pid of child is $pid"
     ip link set $vnet1 netns $pid
 
Index: ltp-full-20081130/testcases/kernel/containers/netns/childns.sh
===================================================================
--- ltp-full-20081130.orig/testcases/kernel/containers/netns/childns.sh
+++ ltp-full-20081130/testcases/kernel/containers/netns/childns.sh
@@ -47,7 +47,7 @@ status=0
     fi
     
     # Passing the PID of child 
-    echo $$ > /tmp/FIFO1
+    echo "child ready" > /tmp/FIFO1;
     
     # waiting for the device name from parent
     vnet1=`cat /tmp/FIFO2`;



------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to