lwip-users
[Top][All Lists]
Advanced

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

RE: [lwip-users] How to securely switch between DHCP and static IP assig


From: Benjamin Schelte
Subject: RE: [lwip-users] How to securely switch between DHCP and static IP assignment?
Date: Fri, 23 Jul 2010 08:50:56 +0200

First of all here is some information about my environment.

Realtime-OS (Free-RTOS), running on AVR32

lwip-version: 1.3.2

 

Actually I am not calling those functions from the tcpip_thread environment. So in case I have to, how can I manage to make the thread to do so?

Currently they are called asynchronously (by user input) out of the display task, where the event is coming from.

I did not find a way calling the desired functions in a thread-safe manner. Does it mean I have to implement a kind of custom events to make the stack doing so?

In case I have to, how can I achieve this?

 

 

And of course you are right with your second objection.

It is quite reasonable that the packets are forwarded to the DHCP handler, if I try to restart the interface…

The only thing I cannot really understand is why the exception is happening. Therefore my in depth knowledge about the lwip-stack is too low atm.

 

…It was quite late and nearly 30°C in my office, so little mistakes might happen J

 

Anyway I tried it again this morning and it looks like it is reproducible by approximately 10% of the times calling the mentioned function.

 

Benjamin

 

 

First of all, it always helps to know which version you are using (so I know which files I have to search in).
Then, since you are using an OS, are you calling the below functions from tcpip_thread or from another thread (or interrupt context)? You may only call them from tcpip_thread since they are accessing raw api functions!

Benjamin Schelte wrote:

[..]

So the problem occurs after calling the function iEthCtrl_UseDHCP().

After doing so it sometimes happens to stop executing on an assert in dhcp_create_request().

Assert:

LWIP_ASSERT("dhcp_create_request: dhcp->p_out == NULL", dhcp->p_out == NULL);

 

Callstack:

dhcp_create_request

dhcp_select

dhcp_handle_offer

dhcp_recv

udp_input

ip_input

ethernet_input

tcpip_thread

 

 

So my questions are the following.

Why is a DHCP-request forwarded to the DHCP-handler, although dhcp_stop() has been called before?


Ehrm, above you said it happened after calling xxx_UseDHCP(), which calls dhcp_start(), so I guess it's correct that the DHCP handler is called, isn't it?
As to the assert, from looking at the code (of lwIP version 1.3.2), I can't tell what's going wrong, the assert shouldn't happen with the callstack you provided... Aside from that, your code seems to look OK, but I didn't have the time to actually check it.

Simon


reply via email to

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