zephyr/net/ip/tools
Ravi kumar Veeramally 9577f86325 net: tools: Modify pcap functions on 15.4 monitor tool
Now monitor tool uses host pcap/pcap.h header file for
related structs. Removed unused functions. Modified
pcap_creation and pcap_write functions.

Change-Id: I918bef483e81cf3001841a9b86a100388025b28c
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-02-05 20:24:36 -05:00
..
Makefile net: tools: Move tools directory to net/ip 2016-02-05 20:15:39 -05:00
README net: tools: Helper scripts for running socat, tunslip6 and radvd 2016-02-05 20:24:30 -05:00
coap-client.c net: tools: Refactor resolving of the source IP address 2016-02-05 20:24:36 -05:00
dtls-client.c net: tools: Refactor resolving of the source IP address 2016-02-05 20:24:36 -05:00
dtls-server.c net: tools: Refactor resolving of the source IP address 2016-02-05 20:24:36 -05:00
echo-client.c net: tools: Refactor resolving of the source IP address 2016-02-05 20:24:36 -05:00
echo-server.c net: tools: Refactor resolving of the source IP address 2016-02-05 20:24:36 -05:00
loop-radvd.sh net: tools: Helper scripts for running socat, tunslip6 and radvd 2016-02-05 20:24:30 -05:00
loop-slip.sh net: tools: Helper scripts for running socat, tunslip6 and radvd 2016-02-05 20:24:30 -05:00
loop-socat.sh net: tools: Helper scripts for running socat, tunslip6 and radvd 2016-02-05 20:24:30 -05:00
monitor_15_4.c net: tools: Modify pcap functions on 15.4 monitor tool 2016-02-05 20:24:36 -05:00
radvd.conf net: tools: Add radvd instructions to README file 2016-02-05 20:15:40 -05:00
tunslip.c net: tools: Move tools directory to net/ip 2016-02-05 20:15:39 -05:00
tunslip6.c net: tools: Move tools directory to net/ip 2016-02-05 20:15:39 -05:00

README

tunslip6
========

tunslip6 can be used in host side to create a tun device that
is connected to a unix socket that qemu is providing. This
way it is possible to pass packets between host and target
system via slip protocol.

You need to connect tunslip6 to the second qemu serial line
through a UNIX socket (qemu option -serial unix:/tmp/slip-socket).

1) Start socat

$ socat PTY,link=/tmp/slip.dev UNIX-LISTEN:/tmp/slip.sock

2) Start qemu, use the listener demo app. Note that you need to
   set CONFIG_NETWORKING_UART=y in your configuration.

   You might need to set the platform and ARCH like this if simple_uart
   driver is not found in your default platform.

$ make PLATFORM_CONFIG=basic_cortex_m3 ARCH=arm \
     QEMU_EXTRA_FLAGS="-serial none -serial unix:/tmp/slip.sock" qemu

  or just simply

$ make qemu

3) Start tunslip6

$ sudo ./tunslip6 -s `readlink /tmp/slip.dev` 2001:db8::1/64

4) Send data to listener

$ nc -u -6 2001:db8::2 4242 <<EOF
foobar
EOF

There are also convenience scripts for running socat, radvd and
tunslip6 processes called loop-socat.sh, loop-radvd.sh and
loop-slip.sh. So to simplify things you need three terminals
for doing this:

Terminal 1:
$ ./loop-socat.sh

Terminal 2:
$ sudo ./loop-slip.sh

Terminal 3:
$ sudo ./loop-radvd.sh

After running these scripts you do not need to manual restart
them when qemu process stops.


radvd
=====
In order the IPv6 stateless address auto configuration (SLAAC)
to work, you need to run radvd or similar tool in host side.
There is an example radvd.conf file present in the tools directory.

$ sudo radvd -d 1 -C radvd.conf -m stderr


tunslip
=======

tunslip if for IPv4 networks and it can be used in host side
to create a tun device that is connected to a unix socket that
qemu is providing. This way it is possible to pass packets
between host and target system via slip protocol.

You need to connect tunslip to the second qemu serial line
through a UNIX socket (qemu option -serial unix:/tmp/slip-socket).

1) Start socat

$ socat PTY,link=/tmp/slip.dev UNIX-LISTEN:/tmp/slip.sock

2) Start qemu, use the listener demo app. Note that you need to
   set CONFIG_NETWORKING_UART=y in your configuration.

   You might need to set the platform and ARCH like this if simple_uart
   driver is not found in your default platform.

$ make PLATFORM_CONFIG=basic_cortex_m3 ARCH=arm \
     QEMU_EXTRA_FLAGS="-serial none -serial unix:/tmp/slip.sock" qemu

3) Start tunslip

$ sudo ./tunslip -s `readlink /tmp/slip.dev` 192.0.2.1 255.255.255.0

4) Send data to listener

$ nc -u 192.0.2.2 4242 <<EOF
foobar
EOF


echo-client
===========

echo-client is a tool that is run in Linux host side and
which sends pre-defined UDP data packets to echo-server
application that is running in qemu side. This client
process verifies that it is able to receive data correctly
from the echo-server and thus verify that the upper layer
networking components in Zephyr IP stack work properly.

You needs to setup the slip connection (see the steps 1 to 3)
in tunslip6 section of this document.

Example:

$ ./echo-client 2001:db8::2

In order to send multicast IPv6 packets, one needs to
give the network interface as a parameter.

$ ./echo-client -i tun0 ff84::2


echo-server
===========

echo-server is a tool that is run in Linux host side and
which waits UDP data sent by echo-client application that
is running in qemu side.

You needs to setup the slip connection (see the steps 1 to 3)
in tunslip6 section of this document. Make sure that the Linux
host firewall is not blocking the packets that the echo-client
running in qemu is sending via tun0 device.

Example:

$ sudo ./echo-server -i tun0


dtls-client
===========

dtls-client is a tool that is run in Linux host side and
which connects to dtls-server running in qemu.

You needs to setup the slip connection (see the steps 1 to 3)
in tunslip6 section of this document. You also need tinyDTLS
sources which can be found here http://sourceforge.net/projects/tinydtls/
Compile and install the tinyDTLS library in host.

Example:

$ make TINYDTLS=/home/user/tinydtls-0.8.2 dtls-client

$ ./dtls-client -b 2001:db8::1 2001:db8::2


dtls-server
===========

dtls-server is a tool that is run in Linux host side and
which waits DTLS data sent by dtls-client application that
is running in qemu side.

You needs to setup the slip connection (see the steps 1 to 3)
in tunslip6 section of this document.

Example:

$ make TINYDTLS=/home/user/tinydtls-0.8.2 dtls-server

$ ./dtls-server -i tun0

monitor_15_4
============

monitor_15_4 is a tool that is run in Linux host side and
which reads data from pipes which is written buy 15.4 test
application from qemu. This is T juntion tool which reads
and writes data from pipes and feed into pipes (this way
both qemus communicate each other) and same time data
written in PCAP format for wireshark monitoring.

Please also read samples/network/test_15_4/README for
how to configure and run two qemus.

Make and run this tool

$ make

Usage : monitor_15_4 <sample pcap file> [<pipe_1> <pipe_2>]

$ monitor_15_4 sample.pcap

or

$ monitor_15_4 sample.pcap /tmp/ip-15-4-1 /tmp/ip-15-4-2


coap-client
===========

coap-client is a tool that is run in Linux host side and
which connects to coap-server running in qemu.

You needs to setup the slip connection (see the steps 1 to 3)
in tunslip6 section of this document. You also need tinyDTLS
sources which can be found here http://sourceforge.net/projects/tinydtls/
Compile and install the tinyDTLS library in host.
You will also need libcoap package which can be found here
https://github.com/obgm/libcoap.git
Compile and install the libcoap library in host.

Example:

$ make TINYDTLS=/home/user/tinydtls-0.8.2 \
       LIBCOAP=/home/user/libcoap coap-client

If you want to use DTLS then run client like this
$ sudo ./coap-client -i tun0 2001:db8::2

For non-DTLS case, run client like this
$ sudo ./coap-client -n -i tun0 2001:db8::2


coap-observe-client
===================

You can test the coap-observe-client that is running in qemu
using the coap-server example server that is found in libcoap.
So get libcoap package which can be found here
https://github.com/obgm/libcoap.git
Compile and install the libcoap library in host.

You needs to setup the slip connection (see the steps 1 to 3)
in tunslip6 section of this document.

$ /home/user/libcoap/examples/coap-server -A 2001:db8::1 -p 5683

Then in the samples/network/coap_observe_client directory, say

$ make qemu