lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] [LONG][Newbie] Questions about lwip


From: Gendag
Subject: [lwip-users] [LONG][Newbie] Questions about lwip
Date: Tue, 7 Sep 2004 12:02:27 +0200
User-agent: Mutt/1.5.6+20040818i

Hi all, 
I'm trying to do a simple program, under linux, to understand the use
of the stack. I have downloaded the version 1.0 of the stack and the
contrib dir from CVS. I have seen the "unixsim" and "minimal" project
and I have tried to make some simple programs (they compile in a right
way, I use a modified Makefile taken from "minimal"), but i have some
doubts:

1. I have tried to run the http server example made in "Design and
Implementation of the lwIP TCP/IP Stack" guide, using the api, but I get
a "segemntation fault" after I start it. So I have put some printf to
understand where the seg fault is generated, running the program, the
outpuy is:

main: before netconn_new
netconn_new: before netconn_new_with_proto_and_callback
netconn_new_with_proto_and_callback: before memp_malloc
memp_malloc: before sym_sem_wait(mutex)
Segmentation fault

So the problem is in sys_sem_wait(mutex), because mutex is not
initilized(it's initilized in memp_init()), because in the example no *_init 
function 
are present. So I add the following *_init functions to the main():

mem_init();
memp_init();
pbuf_init();
netif_init();
ip_init();
udp_init();
tcp_init();

the first segemntation fault disappears but another one appears: the
"static sys_mbox_t mbox" defined in the tcpip.c module is not
initialized, so I add the tcp_init() to the main():

mem_init();
memp_init();
pbuf_init();
netif_init();
tcpip_init();
ip_init();
udp_init();
tcp_init();

but now I get a seg fault when I start the program without any of my
debug messages appear, so it appens ina *_init function. In conclusion,
I think I don't understand very well how to initialize and use the
stack, at the begining I thought that using API was not necessary
initialize the modules, but now I'm not so sure.

2. In "minimal" and "unixsim" programs It's used the tap device to
communicate with the outside. What I would like to know is if it's always
necessary to use a tap, or other interfaces, to permit the program to
comunicate with the other programs. It's not possible, for example, use
the real loopback interface of my PC, as I do when I test program writte
with unix socket api? It's always necessary to initialize ad use a
"virtual" lwip interface?

3. Another question on tap interface: the tap interface acts as a
gateway for a sort of virtual network builds by the program that use
lwip? Is taht rigth? I ask so, because when I tary to ping simhost, 
I see (with tcpdump) traffic on tap0 only when I ping 192.168.0.2
although the ip address of tap0 is 192.168.0.1.


That's all (for now :-))
I apologize for my english if it's not very well, but english isn't my
first language.

thanks

Gendag




reply via email to

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