This patch addresses the comments if any , on the below files.


child_1.sh - Creates the child NS1 and verifies the connection to child2 NS
child_2.sh - Creates the child NS2 and verifies the connection to child1 NS
parent_1.sh - Creates the parent NS1
parent_1.sh - Creates the parent NS2
two_children_ns.c - Basic file to create the 2 children NS



Signed off by Veerendra C <[EMAIL PROTECTED]>
ACKed by Serge Hallyn <[EMAIL PROTECTED]>

--- containers.old/netns/child_1.sh	2008-09-08 17:18:28.000000000 +0530
+++ containers/netns/child_1.sh	2008-09-10 01:06:42.000000000 +0530
@@ -56,5 +56,5 @@ source initialize.sh
         status=-1
     fi
     cleanup $sshpid1 $vnet1
-exit $status
     debug "INFO: ********End of Child-1 $0********"
+    exit $status
--- containers.old/netns/child_2.sh	2008-09-08 17:18:28.000000000 +0530
+++ containers/netns/child_2.sh	2008-09-10 01:06:42.000000000 +0530
@@ -51,5 +51,5 @@ status=0
     fi
 
     cleanup $sshpid2 $vnet2
-    exit $status
     debug "INFO: ********End of Child-2 $0********"
+    exit $status
--- containers.old/netns/parent_1.sh	2008-09-08 17:18:28.000000000 +0530
+++ containers/netns/parent_1.sh	2008-09-10 01:06:42.000000000 +0530
@@ -11,7 +11,7 @@ export TST_TOTAL
 
     source initialize.sh
     echo 1 > /proc/sys/net/ipv4/ip_forward
-    echo 1 > /proc/sys/net/ipv4/conf/eth0/proxy_arp
+    echo 1 > /proc/sys/net/ipv4/conf/$netdev/proxy_arp
     create_veth
     vnet0=$dev0
     vnet1=$dev1
Modified to get the status value using WEXITSTATUS after waitpid()
--- containers.old/netns/two_children_ns.c	2008-09-08 17:18:28.000000000 +0530
+++ containers/netns/two_children_ns.c	2008-09-10 21:49:19.000000000 +0530
@@ -28,32 +28,21 @@
 *                      31/07/2008
 *******************************************************************************/
 
-#include <sys/utsname.h>
-#include <sched.h>
 #include <stdio.h>
-#include "../libclone/libclone.h"
-#include "test.h"
-
 #include <stdlib.h>
-#include <sched.h>
-#include <sys/syscall.h>
+#include <libgen.h>
 #include <unistd.h>
 #include <signal.h>
 #include <string.h>
+#include <sched.h>
 #include <errno.h>
-#include <libgen.h>
 #include <fcntl.h>
+#include <sys/utsname.h>
+#include <sys/syscall.h>
 #include <sys/types.h>
 #include <sys/wait.h>
-
-#ifdef NO_LTP
-#define TFAIL "FAILURE: "
-#define TPASS "PASS: "
-#define TINFO "INFO: "
-#define TWARN "WARN: "
-#define tst_resm(x, format, arg...) printf("%s:" format, x, ## arg)
-#define tst_exit() exit(1)
-#endif
+#include <test.h>
+#include "../libclone/libclone.h"
 
 char *TCID = "netns_2children";
 int TST_TOTAL=1;
@@ -110,6 +99,7 @@ int main()
             ret = unshare(flags);
             if (ret < 0) {
                 perror("Unshare");
+	        tst_resm(TFAIL, "Error:Unshare syscall failed for network namespace\n");
                 return ret;
             }
         return crtchild(child[i]);
@@ -119,7 +109,7 @@ int main()
 
             ret = system(par[i]);
             status = WEXITSTATUS(ret);
-            if (status != 0) {
+            if (ret == -1 || status != 0) {
                 tst_resm(TFAIL, "Error while running the scripts\n");
                 exit(status);
             }
@@ -129,8 +119,8 @@ int main()
     /* Parent waiting for two children to quit */
     for(i=0;i<2;i++) {
         ret = waitpid(pid[i], &status,__WALL);
-
-        if (status != 0 || ret < 0){
+        status = WEXITSTATUS(status);
+        if (status != 0 || ret == -1){
             tst_resm(TFAIL,"waitpid() returns %d, errno %d\n", ret, status);
             fflush(stdout);
             exit(status);
-------------------------------------------------------------------------
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to