[patch 1/9] Network NS - basic.patch

View: New views
9 Messages — Rating Filter:   Alert me  

[patch 1/9] Network NS - basic.patch

by Veerendra-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Regards
Veerendra C

Signed-off-by: Veerendra C <vechandr@...>

This patch has 4 files..

check_netns_enabled.c - checks for the network ns is enabled
initialize.sh - Initializes the common functions and variables
Makefile  - Makefile
runnetnstest.sh - Creates a batch file to run the tests.

Index: containers/netns/Makefile
===================================================================
--- /dev/null
+++ containers/netns/Makefile
@@ -0,0 +1,49 @@
+################################################################################
+##                                                                            ##
+## 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
+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 container_ftp.pl                           \
+runnetnstest.sh \
+
+SRCS    = $(wildcard *.c)
+TARGETS = $(patsubst %.c,%,$(SRCS))
+NOLTP_TARGETS = $(patsubst %.c,%_noltp,$(NOLTPSRCS))
+
+%_noltp : %.c
+ $(CC) -g -DNO_LTP -o $@ $< ../libclone/libnetns.a
+
+all: $(TARGETS)
+ @chmod +x $(SCRIPTS)
+
+install:
+ for i in $(TARGETS) $(SCRIPTS) 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/check_netns_enabled.c
===================================================================
--- /dev/null
+++ containers/netns/check_netns_enabled.c
@@ -0,0 +1,44 @@
+/*
+* 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
+*
+* Author: Veerendra C <vechandr@...>
+*
+* Net namespaces were introduced around 2.6.25.  Kernels before that,
+* assume they are not enabled.  Kernels after that, check for -EINVAL
+* when trying to use CLONE_NEWNET and CLONE_NETNS.
+***************************************************************************/
+#include <stdio.h>
+#include <sched.h>
+#include "../libclone/libclone.h"
+#include "test.h"
+
+int main()
+{
+    int ret;
+    long flags = 0;
+
+    flags |= CLONE_NEWNS;
+    flags |= CLONE_NEWNET;
+
+
+ //if (!kernel_version_newenough())
+ if (tst_kvercmp(2,6,24) < 0)
+ return 1;
+
+        ret = unshare(flags);
+ if ( ret < 0 )
+ return 3;
+ return 0;
+}
Index: containers/netns/initialize.sh
===================================================================
--- /dev/null
+++ containers/netns/initialize.sh
@@ -0,0 +1,77 @@
+
+# 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=0
+
+    # set the LTPROOT directory
+    cd `dirname $0`
+    env | grep -q LTPROOT
+    if [ $? -eq 0 ]; then
+        FS_BIND=${LTPROOT}/testcases/kernel/fs/fs_bind/bin/smount
+        if [ -f $FS_BIND ] ; then
+            smount=$FS_BIND
+        fi
+    else
+        tst_resm TFAIL "Please set the LTP root env variable, and retry again"
+        exit -1
+    fi
+    mkfifo /tmp/FIFO1 /tmp/FIFO2 /tmp/FIFO3 /tmp/FIFO4 /tmp/FIFO5 /tmp/FIFO6 2> /dev/null
+
+
+    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
+
+    debug "INFO: 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 /tmp/FIFO6 > /dev/null
+    rm -f /tmp/net1 /tmp/net2 > /dev/null
+}
+
+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]}
+}
Index: containers/netns/runnetnstest.sh
===================================================================
--- /dev/null
+++ containers/netns/runnetnstest.sh
@@ -0,0 +1,90 @@
+##                                                                            ##
+# 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    ##
+#                                                                            ##
+###############################################################################
+
+#!/bin/bash
+
+rc=0
+exit_code=0
+crtchild
+rc=$?
+if [ $rc -ne 0 ]; then
+    exit_code=$rc
+    errmesg="crtchild: return code is $exit_code ; "
+    echo $errmesg
+else
+   echo "crtchild: PASS"
+fi
+echo
+
+two_children_ns
+rc=$?
+if [ $rc -ne 0 ]; then
+    exit_code=$rc
+    errmesg="$errmesg two_children_ns: return code is $exit_code ; "
+    echo $errmesg
+else
+   echo "two_children_ns: PASS"
+fi
+echo
+
+crtchild_delchild
+rc=$?
+if [ $rc -ne 0 ]; then
+    exit_code=$rc
+    errmesg="$errmesg crtchild_delchild: return code is $exit_code ; "
+    echo $errmesg
+else
+   echo "crtchild_delchild: PASS"
+fi
+echo
+
+
+par_chld_ipv6
+rc=$?
+if [ $rc -ne 0 ]; then
+    exit_code=$rc
+    errmesg="$errmesg par_chld_ipv6: return code is $exit_code ; "
+    echo $errmesg
+else
+   echo "par_chld_ipv6: PASS"
+fi
+echo
+
+sysfsview
+rc=$?
+if [ $rc -ne 0 ]; then
+    exit_code=$rc
+    errmesg="$errmesg sysfsview: return code is $exit_code ; "
+    echo $errmesg
+else
+   echo "sysfsview: PASS"
+fi
+echo
+
+par_chld_ftp
+rc=$?
+if [ $rc -ne 0 ]; then
+    exit_code=$rc
+    errmesg="$errmesg par_chld_ftp: FAIL $exit_code ; "
+    echo $errmesg
+else
+   echo "par_chld_ftp: PASS"
+fi
+echo
+exit $exit_code

-------------------------------------------------------------------------
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@...
https://lists.sourceforge.net/lists/listinfo/ltp-list

Re: [patch 1/9] Network NS - basic.patch

by Subrata Modak :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some Trivial comments.

1) License declaration missing for containers/netns/initialize.sh,
(Anyways i can include this on your behalf, once this is ACK-ed)

Regards--
Subrata

On Thu, 2008-08-21 at 18:32 +0530, Veerendra wrote:
> Regards
> Veerendra C
> -------------------------------------------------------------------------
> 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@... https://lists.sourceforge.net/lists/listinfo/ltp-list


-------------------------------------------------------------------------
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@...
https://lists.sourceforge.net/lists/listinfo/ltp-list

Re: [patch 1/9] Network NS - basic.patch

by Veerendra-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This patch has 4 files..

check_netns_enabled.c - checks for the network ns is enabled
initialize.sh - Initializes the common functions and variables
Makefile  - Makefile
runnetnstest.sh - Creates a batch file to run the tests.








Signed off by Veerendra C <vechandr@...>
ACKed by Serge Hallyn <serue@...>

Included the netns subdir in the Makefile
--- containers.old/Makefile 2008-09-10 21:33:32.000000000 +0530
+++ containers/Makefile 2008-09-10 21:43:10.000000000 +0530
@@ -18,7 +18,7 @@
 ##                                                                            ##
 ################################################################################
 
-SUBDIRS := libclone utsname sysvipc pidns
+SUBDIRS := libclone utsname sysvipc pidns netns
 
 all: check_for_unshare
  @set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i $@; done

Modified the script to get the dynamic eth device name.
Also to restore the values of ip_forward and arpproxy
values after executing the test.

--- containers.old/netns/initialize.sh 2008-09-08 17:18:28.000000000 +0530
+++ containers/netns/initialize.sh 2008-09-10 01:06:42.000000000 +0530
@@ -30,15 +30,29 @@ DEBUG=0
         tst_resm TFAIL "Please set the LTP root env variable, and retry again"
         exit -1
     fi
-    mkfifo /tmp/FIFO1 /tmp/FIFO2 /tmp/FIFO3 /tmp/FIFO4 /tmp/FIFO5 /tmp/FIFO6 2> /dev/null
-
 
     IPver=`ip -V | awk  -F"-" ' {  print $2 } '` ;
     if [[ ${IPver} < "ss080417" ]] ; then
-        tst_resm "ip version should be atleast ss080417"
+        tst_resm  TINFO "ip version should be atleast ss080417"
+        exit -1
+    fi
+    mkfifo /tmp/FIFO1 /tmp/FIFO2 /tmp/FIFO3 /tmp/FIFO4 /tmp/FIFO5 /tmp/FIFO6 2> /dev/null
+
+    netdev=`ip addr show | awk '/^[0-9]*:.*UP/ { a=$2 } /inet / { b=$2 ; \
+            if ( a !~ /lo/  && b ! NULL ) {  print a ; exit 0 } } ' `
+    netdev=`basename $netdev ":"`
+    if [ -z $netdev ] ; then
+        tst_resm  TINFO "Not able to determine the ethernet dev name"
         exit -1
     fi
 
+    # copying the values for restoring it later.
+    ipfwd=`cat /proc/sys/net/ipv4/ip_forward`
+    if [ -f /proc/sys/net/ipv4/conf/$netdev/proxy_arp ] ; then
+        arpproxy=`cat /proc/sys/net/ipv4/conf/$netdev/proxy_arp`
+    else
+ arpproxy=0
+    fi
 cleanup()
 {
    if [ $# == 2 ]; then
@@ -49,12 +63,17 @@ cleanup()
     debug "INFO: 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
+
+    #Restoring the orignial values .
+    echo $ipfwd > /proc/sys/net/ipv4/ip_forward > /dev/null
+    if [ -f /proc/sys/net/ipv4/conf/$netdev/proxy_arp ] ; then
+     echo $arpproxy > /proc/sys/net/ipv4/conf/$netdev/proxy_arp > /dev/null
+    fi
     ( kill -9 $pid ) 2> /dev/null
-    rm -f /tmp/FIFO1 /tmp/FIFO2 /tmp/FIFO3 /tmp/FIFO4 /tmp/FIFO5 /tmp/FIFO6 > /dev/null
-    rm -f /tmp/net1 /tmp/net2 > /dev/null
+    rm -f /tmp/FIFO1 /tmp/FIFO2 /tmp/FIFO3 /tmp/FIFO4 \
+  /tmp/FIFO5 /tmp/FIFO6 > /dev/null
+    rm -f /tmp/net1 /tmp/net2 > /dev/null || true
 }
 
 debug()
@@ -75,3 +94,6 @@ create_veth()
     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
Ltp-list@...
https://lists.sourceforge.net/lists/listinfo/ltp-list

Re: [patch 1/9] Network NS - basic.patch

by Serge E. Hallyn :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Quoting Veerendra (veeren@...):

> This patch has 4 files..
>
> check_netns_enabled.c - checks for the network ns is enabled  
> initialize.sh - Initializes the common functions and variables
> Makefile  - Makefile
> runnetnstest.sh - Creates a batch file to run the tests.
>
>
>
>
>
>
>

> Signed off by Veerendra C <vechandr@...>
> ACKed by Serge Hallyn <serue@...>

Oh, and

Acked-by: Serge Hallyn <serue@...>

>
> Included the netns subdir in the Makefile
> --- containers.old/Makefile 2008-09-10 21:33:32.000000000 +0530
> +++ containers/Makefile 2008-09-10 21:43:10.000000000 +0530
> @@ -18,7 +18,7 @@
>  ##                                                                            ##
>  ################################################################################
>
> -SUBDIRS := libclone utsname sysvipc pidns
> +SUBDIRS := libclone utsname sysvipc pidns netns
>
>  all: check_for_unshare
>   @set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i $@; done
>
> Modified the script to get the dynamic eth device name.
> Also to restore the values of ip_forward and arpproxy
> values after executing the test.
>
> --- containers.old/netns/initialize.sh 2008-09-08 17:18:28.000000000 +0530
> +++ containers/netns/initialize.sh 2008-09-10 01:06:42.000000000 +0530
> @@ -30,15 +30,29 @@ DEBUG=0
>          tst_resm TFAIL "Please set the LTP root env variable, and retry again"
>          exit -1
>      fi
> -    mkfifo /tmp/FIFO1 /tmp/FIFO2 /tmp/FIFO3 /tmp/FIFO4 /tmp/FIFO5 /tmp/FIFO6 2> /dev/null
> -
>
>      IPver=`ip -V | awk  -F"-" ' {  print $2 } '` ;
>      if [[ ${IPver} < "ss080417" ]] ; then
> -        tst_resm "ip version should be atleast ss080417"
> +        tst_resm  TINFO "ip version should be atleast ss080417"
> +        exit -1
> +    fi
> +    mkfifo /tmp/FIFO1 /tmp/FIFO2 /tmp/FIFO3 /tmp/FIFO4 /tmp/FIFO5 /tmp/FIFO6 2> /dev/null
> +
> +    netdev=`ip addr show | awk '/^[0-9]*:.*UP/ { a=$2 } /inet / { b=$2 ; \
> +            if ( a !~ /lo/  && b ! NULL ) {  print a ; exit 0 } } ' `
> +    netdev=`basename $netdev ":"`
> +    if [ -z $netdev ] ; then
> +        tst_resm  TINFO "Not able to determine the ethernet dev name"
>          exit -1
>      fi
>
> +    # copying the values for restoring it later.
> +    ipfwd=`cat /proc/sys/net/ipv4/ip_forward`
> +    if [ -f /proc/sys/net/ipv4/conf/$netdev/proxy_arp ] ; then
> +        arpproxy=`cat /proc/sys/net/ipv4/conf/$netdev/proxy_arp`
> +    else
> + arpproxy=0
> +    fi
>  cleanup()
>  {
>     if [ $# == 2 ]; then
> @@ -49,12 +63,17 @@ cleanup()
>      debug "INFO: 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
> +
> +    #Restoring the orignial values .
> +    echo $ipfwd > /proc/sys/net/ipv4/ip_forward > /dev/null
> +    if [ -f /proc/sys/net/ipv4/conf/$netdev/proxy_arp ] ; then
> +     echo $arpproxy > /proc/sys/net/ipv4/conf/$netdev/proxy_arp > /dev/null
> +    fi
>      ( kill -9 $pid ) 2> /dev/null
> -    rm -f /tmp/FIFO1 /tmp/FIFO2 /tmp/FIFO3 /tmp/FIFO4 /tmp/FIFO5 /tmp/FIFO6 > /dev/null
> -    rm -f /tmp/net1 /tmp/net2 > /dev/null
> +    rm -f /tmp/FIFO1 /tmp/FIFO2 /tmp/FIFO3 /tmp/FIFO4 \
> +  /tmp/FIFO5 /tmp/FIFO6 > /dev/null
> +    rm -f /tmp/net1 /tmp/net2 > /dev/null || true
>  }
>
>  debug()
> @@ -75,3 +94,6 @@ create_veth()
>      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
Ltp-list@...
https://lists.sourceforge.net/lists/listinfo/ltp-list

Re: [patch 1/9] Network NS - basic.patch

by Benjamin Thery :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Veerendra wrote:
> This patch has 4 files..
>
> check_netns_enabled.c - checks for the network ns is enabled
> initialize.sh - Initializes the common functions and variables
> Makefile  - Makefile
> runnetnstest.sh - Creates a batch file to run the tests.

It is me or the patch only contains 2 files: Makefile and initialize.sh?
runnetnstest.sh and check_netns_enabled.c are missing? or moved to
another patch?

OK, I think I understood. Veerendra, are these patches, patches to be
applied on top of the previous series you sent?


Benjamin

>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> 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@...
> https://lists.sourceforge.net/lists/listinfo/ltp-list


--
B e n j a m i n   T h e r y  - BULL/DT/Open Software R&D

    http://www.bull.com

-------------------------------------------------------------------------
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@...
https://lists.sourceforge.net/lists/listinfo/ltp-list

Re: [patch 1/9] Network NS - basic.patch

by Benjamin Thery :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Veerendra wrote:
> This patch has 4 files..
>
> check_netns_enabled.c - checks for the network ns is enabled
> initialize.sh - Initializes the common functions and variables
> Makefile  - Makefile
> runnetnstest.sh - Creates a batch file to run the tests.

Looks like you didn't fix these typos:

testcases/kernel/containers/netns/check_netns_enabled.c
     * There's  a typo in the comment:
       "trying to use CLONE_NEWNET and CLONE_NETNS."
           should be                       -----------
       "trying to use CLONE_NEWNET and CLONE_NEWNS."

     * You left some commented code in the test:
         //if (!kernel_version_newenough())

Otherwise, these changes looks good.

Acked-by: Benjamin Thery <benjamin.thery@...>

Benjamin

>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> 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@...
> https://lists.sourceforge.net/lists/listinfo/ltp-list


--
B e n j a m i n   T h e r y  - BULL/DT/Open Software R&D

    http://www.bull.com

-------------------------------------------------------------------------
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@...
https://lists.sourceforge.net/lists/listinfo/ltp-list

Re: [patch 1/9] Network NS - basic.patch

by Cai Qian-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

--- Veerendra <veeren@...> wrote:

> This patch has 4 files..
>
> check_netns_enabled.c - checks for the network ns is enabled
> initialize.sh - Initializes the common functions and variables
> Makefile  - Makefile
> runnetnstest.sh - Creates a batch file to run the tests.
>
>
>
>
>
>
>
> > Signed off by Veerendra C <vechandr@...>
> ACKed by Serge Hallyn <serue@...>
>
> Included the netns subdir in the Makefile
> --- containers.old/Makefile 2008-09-10 21:33:32.000000000 +0530
> +++ containers/Makefile 2008-09-10 21:43:10.000000000 +0530
> @@ -18,7 +18,7 @@
>  ##                                                                  
>          ##
>
>
################################################################################

>  
> -SUBDIRS := libclone utsname sysvipc pidns
> +SUBDIRS := libclone utsname sysvipc pidns netns
>  
>  all: check_for_unshare
>   @set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i $@; done
>
> Modified the script to get the dynamic eth device name.
> Also to restore the values of ip_forward and arpproxy
> values after executing the test.
>
> --- containers.old/netns/initialize.sh 2008-09-08 17:18:28.000000000
> +0530
> +++ containers/netns/initialize.sh 2008-09-10 01:06:42.000000000
> +0530
> @@ -30,15 +30,29 @@ DEBUG=0
>          tst_resm TFAIL "Please set the LTP root env variable, and
> retry again"
>          exit -1
>      fi
> -    mkfifo /tmp/FIFO1 /tmp/FIFO2 /tmp/FIFO3 /tmp/FIFO4 /tmp/FIFO5
> /tmp/FIFO6 2> /dev/null
> -
>  
>      IPver=`ip -V | awk  -F"-" ' {  print $2 } '` ;
>      if [[ ${IPver} < "ss080417" ]] ; then
> -        tst_resm "ip version should be atleast ss080417"
> +        tst_resm  TINFO "ip version should be atleast ss080417"
> +        exit -1
> +    fi
> +    mkfifo /tmp/FIFO1 /tmp/FIFO2 /tmp/FIFO3 /tmp/FIFO4 /tmp/FIFO5
> /tmp/FIFO6 2> /dev/null
> +
> +    netdev=`ip addr show | awk '/^[0-9]*:.*UP/ { a=$2 } /inet / {
> b=$2 ; \
> +            if ( a !~ /lo/  && b ! NULL ) {  print a ; exit 0 } } '
> `
> +    netdev=`basename $netdev ":"`
> +    if [ -z $netdev ] ; then
> +        tst_resm  TINFO "Not able to determine the ethernet dev
> name"
>          exit -1
>      fi
>  
> +    # copying the values for restoring it later.
> +    ipfwd=`cat /proc/sys/net/ipv4/ip_forward`
> +    if [ -f /proc/sys/net/ipv4/conf/$netdev/proxy_arp ] ; then
> +        arpproxy=`cat /proc/sys/net/ipv4/conf/$netdev/proxy_arp`
> +    else
> + arpproxy=0
> +    fi
>  cleanup()
>  {
>     if [ $# == 2 ]; then
> @@ -49,12 +63,17 @@ cleanup()
>      debug "INFO: 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
> +
> +    #Restoring the orignial values .
> +    echo $ipfwd > /proc/sys/net/ipv4/ip_forward > /dev/null

This will not restore anything for you.

> +    if [ -f /proc/sys/net/ipv4/conf/$netdev/proxy_arp ] ; then
> +     echo $arpproxy > /proc/sys/net/ipv4/conf/$netdev/proxy_arp >
> /dev/null

Same here.

> +    fi
>      ( kill -9 $pid ) 2> /dev/null
> -    rm -f /tmp/FIFO1 /tmp/FIFO2 /tmp/FIFO3 /tmp/FIFO4 /tmp/FIFO5
> /tmp/FIFO6 > /dev/null

There should not be anything from STDOUT.

> -    rm -f /tmp/net1 /tmp/net2 > /dev/null

Same here.

> +    rm -f /tmp/FIFO1 /tmp/FIFO2 /tmp/FIFO3 /tmp/FIFO4 \
> +  /tmp/FIFO5 /tmp/FIFO6 > /dev/null

Same here.

> +    rm -f /tmp/net1 /tmp/net2 > /dev/null || true

Same here.

Cai Qian

>  }
>  
>  debug()
> @@ -75,3 +94,6 @@ create_veth()
>      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
> Ltp-list@...
> https://lists.sourceforge.net/lists/listinfo/ltp-list
>


-------------------------------------------------------------------------
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@...
https://lists.sourceforge.net/lists/listinfo/ltp-list

Re: [patch 1/9] Network NS - basic.patch

by Benjamin Thery :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

CAI Qian wrote:

> Hi,
>
> --- Veerendra <veeren@...> wrote:
>
>> This patch has 4 files..
>>
>> check_netns_enabled.c - checks for the network ns is enabled
>> initialize.sh - Initializes the common functions and variables
>> Makefile  - Makefile
>> runnetnstest.sh - Creates a batch file to run the tests.
[...]

>> +    #Restoring the orignial values .
>> +    echo $ipfwd > /proc/sys/net/ipv4/ip_forward > /dev/null
>
> This will not restore anything for you.

You're right.
This small patch (attached) should fix the issues you raised.

Benjamin

>
>> +    if [ -f /proc/sys/net/ipv4/conf/$netdev/proxy_arp ] ; then
>> +     echo $arpproxy > /proc/sys/net/ipv4/conf/$netdev/proxy_arp >
>> /dev/null
>
> Same here.
>
>> +    fi
>>      ( kill -9 $pid ) 2> /dev/null
>> -    rm -f /tmp/FIFO1 /tmp/FIFO2 /tmp/FIFO3 /tmp/FIFO4 /tmp/FIFO5
>> /tmp/FIFO6 > /dev/null
>
> There should not be anything from STDOUT.
>
>> -    rm -f /tmp/net1 /tmp/net2 > /dev/null
>
> Same here.
>
>> +    rm -f /tmp/FIFO1 /tmp/FIFO2 /tmp/FIFO3 /tmp/FIFO4 \
>> +  /tmp/FIFO5 /tmp/FIFO6 > /dev/null
>
> Same here.
>
>> +    rm -f /tmp/net1 /tmp/net2 > /dev/null || true
>
> Same here.
>
> Cai Qian
>
[...]


--
B e n j a m i n   T h e r y  - BULL/DT/Open Software R&D

    http://www.bull.com

From: Benjamin Thery <benjamin.thery@...>
Subject: netns: fix restoration of original /proc values (ip_forward...)

This small patches make the restoration of
  /proc/sys/net/ipv4/ip_forward
  /proc/sys/net/ipv4/conf/$netdev/proxy_arp
works as expected in netns/initialize.sh.

Also removed some unneeded /dev/null redirections.

Signed-off-by: Benjamin Thery <benjamin.thery@...>
---
 testcases/kernel/containers/netns/initialize.sh |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Index: ltp/testcases/kernel/containers/netns/initialize.sh
===================================================================
--- ltp.orig/testcases/kernel/containers/netns/initialize.sh
+++ ltp/testcases/kernel/containers/netns/initialize.sh
@@ -89,14 +89,13 @@ cleanup()
     sleep 1
 
     #Restoring the orignial values .
-    echo $ipfwd > /proc/sys/net/ipv4/ip_forward > /dev/null
+    echo $ipfwd > /proc/sys/net/ipv4/ip_forward
     if [ -f /proc/sys/net/ipv4/conf/$netdev/proxy_arp ] ; then
-     echo $arpproxy > /proc/sys/net/ipv4/conf/$netdev/proxy_arp > /dev/null
+     echo $arpproxy > /proc/sys/net/ipv4/conf/$netdev/proxy_arp
     fi
     ( kill -9 $pid ) 2> /dev/null
-    rm -f /tmp/FIFO1 /tmp/FIFO2 /tmp/FIFO3 /tmp/FIFO4 \
-  /tmp/FIFO5 /tmp/FIFO6 > /dev/null
-    rm -f /tmp/net1 /tmp/net2 > /dev/null || true
+    rm -f /tmp/FIFO1 /tmp/FIFO2 /tmp/FIFO3 /tmp/FIFO4 /tmp/FIFO5 /tmp/FIFO6
+    rm -f /tmp/net1 /tmp/net2 || true
 }
 
 debug()

-------------------------------------------------------------------------
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@...
https://lists.sourceforge.net/lists/listinfo/ltp-list

Re: [patch 1/9] Network NS - basic.patch

by Subrata Modak :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 2008-10-07 at 16:00 +0200, Benjamin Thery wrote:

> From: Benjamin Thery <benjamin.thery@...>
> Subject: netns: fix restoration of original /proc values
> (ip_forward...)
>
> This small patches make the restoration of
>   /proc/sys/net/ipv4/ip_forward
>   /proc/sys/net/ipv4/conf/$netdev/proxy_arp
> works as expected in netns/initialize.sh.
>
> Also removed some unneeded /dev/null redirections.
>
> Signed-off-by: Benjamin Thery <benjamin.thery@...>

Thanks Benjamin for this. Merged.

Regards--
Subrata

> ---
>  testcases/kernel/containers/netns/initialize.sh |    9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
>
> Index: ltp/testcases/kernel/containers/netns/initialize.sh
> ===================================================================
> --- ltp.orig/testcases/kernel/containers/netns/initialize.sh
> +++ ltp/testcases/kernel/containers/netns/initialize.sh
> @@ -89,14 +89,13 @@ cleanup()
>      sleep 1
>
>      #Restoring the orignial values .
> -    echo $ipfwd > /proc/sys/net/ipv4/ip_forward > /dev/null
> +    echo $ipfwd > /proc/sys/net/ipv4/ip_forward
>      if [ -f /proc/sys/net/ipv4/conf/$netdev/proxy_arp ] ; then
> -       echo $arpproxy > /proc/sys/net/ipv4/conf/$netdev/proxy_arp
> > /dev/null
> +       echo $arpproxy > /proc/sys/net/ipv4/conf/$netdev/proxy_arp
>      fi
>      ( kill -9 $pid ) 2> /dev/null
> -    rm -f /tmp/FIFO1 /tmp/FIFO2 /tmp/FIFO3 /tmp/FIFO4 \
> -         /tmp/FIFO5 /tmp/FIFO6 > /dev/null
> -    rm -f /tmp/net1 /tmp/net2 > /dev/null || true
> +    rm
> -f /tmp/FIFO1 /tmp/FIFO2 /tmp/FIFO3 /tmp/FIFO4 /tmp/FIFO5 /tmp/FIFO6
> +    rm -f /tmp/net1 /tmp/net2 || true
>  }
>
>  debug()


-------------------------------------------------------------------------
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@...
https://lists.sourceforge.net/lists/listinfo/ltp-list
LightInTheBox - Buy quality products at wholesale price!