All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Aring <aar@pengutronix.de>
To: linux-wpan@vger.kernel.org
Cc: Alexander Aring <aar@pengutronix.de>
Subject: [PATCH wpan-misc 1/5] website: update testing scripts for netns
Date: Sun,  7 Aug 2016 17:33:20 +0200	[thread overview]
Message-ID: <20160807153324.9642-1-aar@pengutronix.de> (raw)

Reviewed-by: Stefan Schmidt<stefan@osg.samsung.com>
Signed-off-by: Alexander Aring <aar@pengutronix.de>
---
 website/index.txt | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/website/index.txt b/website/index.txt
index 65c6b9c..1438c6e 100644
--- a/website/index.txt
+++ b/website/index.txt
@@ -90,8 +90,13 @@ Setup a 6LowPAN test network
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 Let's assume you want to setup a 6lowpan test network of six nodes.
+Each of them will be created in their own net namespace to avoid
+local IPv6 optimizations. Each netns is named according to the wpan
+interface which available in the net namespace.
 
 ---------------------------------------------------------------------
+#!/bin/sh
+
 # we need some Private Area Network ID
 panid="0xbeef"
 # number of nodes
@@ -102,25 +107,26 @@ numnodes=6
 modprobe fakelb numlbs=$numnodes
 
 # initialize all the nodes
-for i in $(seq 0 $numnodes);
+for i in $(seq 0 `expr $numnodes - 1`);
 do
-	iwpan dev wpan${i} set pan_id 0xbeef
-	ip link wpan${i} name lowpan${i} type lowpan
-	ip link set wpan${i} up
-	ip link set lowpan${i} up
+	ip netns delete wpan${i}
+	ip netns add wpan${i}
+	PHYNUM=`iwpan dev | grep -B 1 wpan${i} | sed -ne '1 s/phy#\([0-9]\)/\1/p'`
+	iwpan phy${PHYNUM} set netns name wpan${i}
+
+	ip netns exec wpan${i} iwpan dev wpan${i} set pan_id $panid
+	ip netns exec wpan${i} ip link add link wpan${i} name lowpan${i} type lowpan
+	ip netns exec wpan${i} ip link set wpan${i} up
+	ip netns exec wpan${i} ip link set lowpan${i} up
 done
 ---------------------------------------------------------------------
 
 Now let us send some data over our network:
 
 ---------------------------------------------------------------------
-wireshark -kSl -i lowpan0 &
-# get the IPv6 address of lowpan1
-lowpan1addr="$(ip addr show lowpan1 | grep inet6 \
-	| sed 's,.*inet6 \([^/]*\).*,\1,')"
-# tell ping6 to ping the IPv6 address of lowpan1 and send it via
-# lowpan0
-ping6 ${lowpan1addr}%lowpan0
+ip netns exec wpan0 wireshark -kSl -i lowpan0 &
+# ping all nodes
+ip netns exec wpan0 ping6 ff02::1%lowpan0
 ---------------------------------------------------------------------
 
 Now watch wireshark and all the nice ICMP packets there.
-- 
2.9.2


             reply	other threads:[~2016-08-07 15:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-07 15:33 Alexander Aring [this message]
2016-08-07 15:33 ` [PATCH wpan-misc 2/5] website: remove note about missing short address functionality Alexander Aring
2016-08-10 12:08   ` Stefan Schmidt
2016-08-07 15:33 ` [PATCH wpan-misc 3/5] website: fix typo Alexander Aring
2016-08-10 12:08   ` Stefan Schmidt
2016-08-07 15:33 ` [PATCH wpan-misc 4/5] website: add boards with transceiver section Alexander Aring
2016-08-10 12:10   ` Stefan Schmidt
2016-08-07 15:33 ` [PATCH wpan-misc 5/5] website: add SOB for sending patches Alexander Aring
2016-08-10 12:10   ` Stefan Schmidt
2016-08-10 12:08 ` [PATCH wpan-misc 1/5] website: update testing scripts for netns Stefan Schmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160807153324.9642-1-aar@pengutronix.de \
    --to=aar@pengutronix.de \
    --cc=linux-wpan@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.