lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-devel] Compiling and debugging on linux


From: Søren Holm
Subject: Re: [lwip-devel] Compiling and debugging on linux
Date: Mon, 2 Jan 2023 13:20:17 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1

Thanks Renzo - I will try it out.

Den 02.01.2023 kl. 13.17 skrev Renzo Davoli:
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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]