Dear Søren,
On Mon, Dec 26, 2022 at 12:31:54AM +0100, Søren Holm wrote:
I have been strugling understanding howto run and debug a simple lwip
echo-server on linux. Seaching google and the lwip repo does not give me a
ready to use example.
Am I missing something - or is it just difficult?
Can you provide me with some hints on where to look?
The file cli.c (here attached) is a UDP echo server.
Here below you'll find some notes on how I compile and run it.
I hope it can be useful.
Happy new year.
renzo
----
----> create a tap interface.
(root access required - change my_username with your username)
# ip tap add mode tap name tapx user my_username
# ip link set tapx up
# ip addr add 192.168.101.1/24 dev tapx
----> tell tapif to use tapx
$ export PRECONFIGURED_TAPIF=tapx
----> option A: use liblwip Debian package (lwip 2.1.3)
# apt-get install liblwip-dev
$ gcc -I/usr/include/lwip cli.c -llwip
$ ./a.out
in another terminal window type (nc is netcat):
$ nc -u 192.168.101.42 4242
.... everything you type will be echoed
-----> option B: install lwip from git (almost lwip 2.2.0)
clone lwip source:
$ git clone https://git.savannah.nongnu.org/git/lwip.git
install my patches 1 and 2 from this mail:
https://lists.nongnu.org/archive/html/lwip-devel/2023-01/msg00000.html
$ cd lwip
$ patch -p 1 < /tmp/1-libnoslip.patch
patching file contrib/ports/unix/lib/CMakeLists.txt
$ patch -p 1 < /tmp/2-linuxlib.patch
patching file contrib/ports/unix/linuxlib/CMakeLists.txt
patching file contrib/ports/unix/linuxlib/Uninstall.cmake
patching file contrib/ports/unix/linuxlib/include/posix/inet.h
patching file contrib/ports/unix/linuxlib/include/posix/sockets.h
patching file contrib/ports/unix/linuxlib/lwipopts.h
(optional, install my patch #3 if you want to test lwip+VDE, libvdeplug
required.
It is not required for this test
$ patch -p 1 < /tmp/3-vdeif.patch
)
$ mkdir build
$ cd build
$ cmake ../contrib/ports/unix/linuxlib
$ make
$ sudo make install
compile the code:
$ cd ../..
$ gcc -I/usr/local/include/lwip cli.c -llwip
$ ./a.out
in another terminal window type:
$ nc -u 192.168.101.42 4242
.... everything you type will be echoed
In case you want to uninstall liblwip:
$ cd lwip/build
$ sudo make uninstall
_______________________________________________
lwip-devel mailing list
lwip-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-devel