lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] FW: Problem with renewing DHCP after link down/up with


From: simeon.trifonov
Subject: Re: [lwip-users] FW: Problem with renewing DHCP after link down/up with the new LWIP V2.0.2
Date: Fri, 6 Oct 2017 13:36:39 +0300

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:address@hidden On Behalf Of Noam Weissman
Sent: Friday, October 06, 2017 11:16 AM
To: 'Mailing list for lwIP users' <address@hidden>
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 <address@hidden> on behalf of address@hidden <address@hidden>
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:address@hidden] On Behalf Of Noam Weissman
Sent: Thursday, October 05, 2017 3:20 PM
To: address@hidden
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 <address@hidden> on behalf of address@hidden <address@hidden>
Sent: Thursday, October 5, 2017 2:50 PM
To: address@hidden
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: address@hidden [mailto:address@hidden]
Sent: Thursday, October 05, 2017 10:15 AM
To: 'address@hidden' <address@hidden>
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

 


reply via email to

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