Hi Noam,

 

I use OS, but actually this is not important, because I use the stack in a 
single thread. So I don’t expect problems from not thread safe functions. 

I also set the IP address and mask to 0 when I detect link down. But I expect 
somehow to have a function call when the IP address is assigned again via DHCP. 
This works during the first start of the device. But after diconnect/connect of 
the Ethernet cable, the callback is not called anymore, even if the address is 
assigned. I don’t like the polling solution. I’m working on an embedded device 
and I don’t need to waste time for such operations.

So the principle questions are:

*       Why dhcp_renew() doesn’t work as before (in V1.4.1)? Is this behavior 
expected or I’m doing something wrong?
*       Is it correct to make dhcp_stop() dhcp_start() during link down/up to 
have a correct DHCP behavior?
*       When the status change callback is called? When I’m looking the code is 
seems that happens only during net up and down. But after the device start-up 
this callback is called also when the address is assigned via DHCP.

And Noam, thank you for your advices and your will to help… Next week, I’m not 
in an official trip abroad so I will not be able to work on this project, but 
when I come back, I will continue with it.

 

Have a nice weekend too!

 

Simeon

 

From: lwip-users 
[mailto:lwip-users-bounces+simeon.trifonov=amk-drives...@nongnu.org] On Behalf 
Of Noam Weissman
Sent: Friday, October 06, 2017 11:16 AM
To: 'Mailing list for lwIP users' <lwip-users@nongnu.org>
Subject: Re: [lwip-users] FW: Problem with renewing DHCP after link down/up 
with the new LWIP V2.0.2

 

Hi Simeon,

 

Do you use an OS ?... if you do, you are not supposed to call dhcp_start etc... 
but rather netif_dhcp_start (or similar) 

I am not by PC so I writing from memory 😊

 

The difference are that the first must be called from within LwIP own task as 
it is not thread safe, while the second can 

be called from your own code and is thread safe.

 

What I am doing is running a task that sets address/mask etc to ZERO, poll's 
the address gotten from DHCP and if it get assigned

I have a new address.  I can send you my code on Sunday when I will return to 
work.

 

Have a nice weekend,

Noam.

 

  _____  

From: lwip-users <lwip-users-bounces+noam=silrd....@nongnu.org 
<mailto:lwip-users-bounces+noam=silrd....@nongnu.org> > on behalf of 
simeon.trifo...@amk-drives.bg <mailto:simeon.trifo...@amk-drives.bg>  
<simeon.trifo...@amk-drives.bg <mailto:simeon.trifo...@amk-drives.bg> >
Sent: Friday, October 6, 2017 9:49 AM
To: 'Mailing list for lwIP users'
Subject: Re: [lwip-users] FW: Problem with renewing DHCP after link down/up 
with the new LWIP V2.0.2 

 

Hi Noam,

 

I tried to find out something concerning my problem, but without success. 
However, I have a little progress. If I call the function dhcp_stop() on link 
down event (immediately after the call of netif_set_link_down(), then I call 
dhcp_start() in the same way on link up event, then the DHCP works fine. It 
works again after the reconnection. But there is still one problem. The 
callback function for state change is not called when the address is receive. 
This is a problem for me, because I want to inform the higher level software 
for the new address and I’m using for this purpose the callback for status 
change. So actually this is not the solution I want and any further ideas are 
welcome.

 

Simeon

 

From: lwip-users 
[mailto:lwip-users-bounces+simeon.trifonov=amk-drives...@nongnu.org] On Behalf 
Of Noam Weissman
Sent: Thursday, October 05, 2017 3:20 PM
To: lwip-users@nongnu.org <mailto:lwip-users@nongnu.org> 
Subject: Re: [lwip-users] FW: Problem with renewing DHCP after link down/up 
with the new LWIP V2.0.2

 

Hi Simeon,

 

I am out of my office till next week so I cannot send any code. I am working 
with LwIP 2.02

and my DHCP works fine. There were a few small changes in using it.

 

I suggest searching the forum as this was addressed several times and I am sure 
you can 

find what you need in older correspondence.

 

BR,

Noam.

 

  _____  

From: lwip-users < <mailto:lwip-users-bounces+noam=silrd....@nongnu.org> 
lwip-users-bounces+noam=silrd....@nongnu.org> on behalf of  
<mailto:simeon.trifo...@amk-drives.bg> simeon.trifo...@amk-drives.bg < 
<mailto:simeon.trifo...@amk-drives.bg> simeon.trifo...@amk-drives.bg>
Sent: Thursday, October 5, 2017 2:50 PM
To:  <mailto:lwip-users@nongnu.org> lwip-users@nongnu.org
Subject: [lwip-users] FW: Problem with renewing DHCP after link down/up with 
the new LWIP V2.0.2 

 

I’m still can’t come to a solution of my problem. But my information wasn’t 
very exact. To be more clear I made a log with Wireshark:

 



 

The first 4 lines show normal start-up process. The address is received and all 
works fine. When the cable is unplugged and plugged again, we see new DHCP 
request and acknowledge two times (line No. 17 to 23). In this case the state 
change callback is not called, that means IP address is now received. Then new 
discover-frame follows. 

I need an advice, please!

 

Simeon

 

From:  <mailto:simeon.trifo...@amk-drives.bg> simeon.trifo...@amk-drives.bg [ 
<mailto:simeon.trifo...@amk-drives.bg> mailto:simeon.trifo...@amk-drives.bg] 
Sent: Thursday, October 05, 2017 10:15 AM
To: 'lwip-users@nongnu.org' < <mailto:lwip-users@nongnu.org> 
lwip-users@nongnu.org>
Subject: Problem with renewing DHCP after link down/up with the new LWIP V2.0.2

 

Hi,

I’m facing to a problem with the renew of the DHCP after link down/up. With 
V1.4.1 all worked fine. Probably I’m missing something now. I call correct the 
functions netif_set_link_up() and netif_set_link_down() when the corresponding 
events occur. After power on DHCP works fine. But after disconnecting and 
connecting back the cable, I see that the discover-frame is sent from the stack 
and an offer-frame is returned from the DHCP server, but there is no reaction 
from the stack. Also the callback for status change is not called. I tried to 
call additionally netif_set_up() and dhcp_renew when link up event is 
generated, but there is no change. Can you give me a hint what I’m missing?

 

Simeon

 

_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to