source: test/netns-env.sh @ e78e408

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivelibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since e78e408 was ed18a6e, checked in by Richard Sanger <rsangerarj@…>, 7 years ago

Fix executable flags on scripts

  • Property mode set to 100755
File size: 1.2 KB
Line 
1#!/bin/bash
2
3# This script sets up the netns env and then runs
4# the given argument which does the actual tests
5
6NS="libtrace_testing"
7EXEC="ip netns exec $NS"
8
9if [ "$(id -u)" != "0" ]; then
10   echo "WARNING: this test most likely needs to be run as ROOT!" 1>&2
11fi
12
13if [ "$#" -ne 1 ]; then
14    echo "Expects one argument, the test to run in the network namespace"
15    echo "    e.g. $0 ./do-live-tests.sh"
16    exit 1
17fi
18
19
20
21# Setup a netns this is isolated from kernel interference
22# such as trying to respond to ping ARPs etc
23# Turns out the kernel will still try to setup IPv6 link
24# addresses so disable IPv6 on them also
25ip netns add $NS
26$EXEC ip link add veth0 type veth peer name veth1
27
28$EXEC sysctl -w net.ipv6.conf.veth0.autoconf=0
29$EXEC sysctl -w net.ipv6.conf.veth1.autoconf=0
30$EXEC sysctl -w net.ipv6.conf.veth0.accept_ra=0
31$EXEC sysctl -w net.ipv6.conf.veth1.accept_ra=0
32$EXEC sysctl -w net.ipv6.conf.veth0.disable_ipv6=1
33$EXEC sysctl -w net.ipv6.conf.veth1.disable_ipv6=1
34
35$EXEC ip link set veth0 up
36$EXEC ip link set veth1 up
37
38# We now have the interfaces veth0 and veth1 connected
39# together as if by a cable.
40
41
42GOT_NETNS=1 $EXEC $1
43
44
45#cleanup - deleting veth0 impilies veth1 also since these are
46# linked together
47$EXEC ip link delete veth0
48ip netns delete $NS
Note: See TracBrowser for help on using the repository browser.