Skip to content

Commit cb2287d

Browse files
committed
tests/pkg/lwip: Add README.md
1 parent 4669ee6 commit cb2287d

File tree

1 file changed

+139
-0
lines changed

1 file changed

+139
-0
lines changed

tests/pkg/lwip/README.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# lwIP test application
2+
3+
This application provides an example of how to use lwIP and provides test for over-the-air
4+
interaction between two lwIP nodes.
5+
6+
## Testing on `native`
7+
8+
### IPv6
9+
10+
For IPv6 on `native` there is a test script. It requires for a TAP bridge to be set up between two
11+
interfaces. For that run
12+
13+
```console
14+
$ sudo dist/tools/tapsetup/tapsetup
15+
```
16+
17+
Then just run it with the usual test command.
18+
19+
```
20+
$ make flash test
21+
```
22+
23+
### IPv4
24+
25+
For IPv4 a DHCP server is needed. If not already done for the IPv6 tests, please set up a TAP bridge
26+
now. Then add an IPv4 address to it, e.g.,
27+
28+
```console
29+
$ sudo ip addr add 10.233.68.1/24 dev tapbr0
30+
```
31+
32+
Then configure a DHCP server (e.g. [`dhcpd`](https://wiki.archlinux.org/title/Dhcpd))
33+
34+
```
35+
# comment in if you need DNS and have a name server available
36+
# option domain-name-servers X.X.X.X X.X.X.Y;
37+
option subnet-mask 255.255.255.0;
38+
option routers 10.233.68.1;
39+
subnet 10.233.68.0 netmask 255.255.255.0 {
40+
range 10.233.68.166 10.233.68.206;
41+
}
42+
```
43+
44+
Then, you can use the `ip`, `udp`, and `tcp` commands to start servers and connect to them from
45+
clients.
46+
47+
We use `LWIP_IPV6=0` in the following, but dual-stack support, with both `LWIP_IPV4=1` and
48+
`LWIP_IPV6=1` is also possible.
49+
50+
## 6LoWPAN
51+
52+
If `<board>` is supported, just running the following should enable 6LoWPAN.
53+
54+
```console
55+
$ BOARD="<board>" make flash test
56+
```
57+
58+
## Running the tests
59+
60+
We use `native` ports below, but of course these can be interchanged with actual serial ports and
61+
`DEBUG_ADAPTER_ID`s to identify an actual board.
62+
63+
#### `ip`
64+
65+
##### Server
66+
67+
```console
68+
$ LWIP_IPV4=1 LWIP_IPV6=0 PORT=tap0 make -j flash term
69+
[...]
70+
> ifconfig
71+
ifconfig
72+
Iface ET0 HWaddr: da:27:1d:a8:64:24 Link: up State: up
73+
Link type: wired
74+
inet addr: 10.233.68.166 mask: 255.255.255.0 gw: 10.233.68.1
75+
> ip server start 254
76+
Success: started IP server on protocol 254
77+
> Received IP data from [10.233.68.167]:
78+
00000000 AB CD EF
79+
```
80+
81+
##### Client
82+
83+
```console
84+
$ LWIP_IPV4=1 LWIP_IPV6=0 PORT=tap1 make term
85+
[...]
86+
> ip send 10.233.68.166 254 abcdef
87+
ip send 10.233.68.166 254 abcdef
88+
Success: send 3 byte over IPv6 to 10.233.68.166 (next header: 254)
89+
```
90+
91+
#### `udp`
92+
93+
`make` commands are the same as for `ip`.
94+
95+
##### Server
96+
97+
```console
98+
> udp server start 1337
99+
udp server start 1337
100+
Success: started UDP server on port 1337
101+
Received UDP data from 10.233.68.167:49154
102+
00000000 12 34 56 78 90
103+
```
104+
105+
##### Client
106+
107+
```console
108+
> udp send 10.233.68.166:1337 123456789
109+
udp send 10.233.68.166:1337 123456789
110+
Success: send 5 byte over UDP to 10.233.68.166:1337
111+
```
112+
113+
#### `tcp`
114+
115+
`make` commands are the same as for `ip`.
116+
117+
##### Server
118+
119+
```console
120+
> tcp server start 1337
121+
tcp server start 1337
122+
Success: started TCP server on port 1337
123+
TCP client 10.233.68.167:49153 connected
124+
Received TCP data from 10.233.68.167:49153
125+
00000000 76 54 32 10
126+
TCP connection to 10.233.68.167:49153 reset
127+
```
128+
129+
##### Client
130+
131+
```console
132+
> tcp connect 10.233.68.166:1337
133+
tcp connect 10.233.68.166:1337
134+
> tcp send 7654321
135+
tcp send 7654321
136+
Success: send 4 byte over TCP to server
137+
> tcp disconnect
138+
tcp disconnect
139+
```

0 commit comments

Comments
 (0)