-
Notifications
You must be signed in to change notification settings - Fork 34
/
README.legacy
237 lines (150 loc) · 5.85 KB
/
README.legacy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
The comments and instructions below are for legacy IP stack in Zephyr.
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.
Example:
$ make 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 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.
Example:
$ make 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