Application callback for dhcp reboot with unchanged address

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Application callback for dhcp reboot with unchanged address

Niklas Gürtler
Hi,

i am using lwIP 2.1.2 on an embedded device with a WiFi connection in
NO_SYS mode using DHCP and the raw API. I need my application to
initiate a TCP connection immediately after a completed DHCP
negotiation, i.e. as soon as possible. This also needs to happen when
the link is disconnected and reconnected, after a DHCP reboot. I am
using the status callback (netif_set_status_callback) and check for a
successful DHCP address assignment like this:

void statusChange (struct netif* nif) {
     if (dhcp_supplied_address (nif) && netif_is_link_up(nif)) { //
Initiate TCP connection ...

When I restart my WiFi access point, the link is reconnected as desired,
and lwIP performs a DHCP reboot and receives the same address as before.
Unfortunately, in this case, the status callback is never called after a
dhcp reboot. I think this is because in netif_do_set_ipaddr, the
"NETIF_STATUS_CALLBACK" only happens when the address is actually different.

So, how do I know when the link is ready for TCP connections after a
WiFi re-association and DHCP reboot?

The WiFi driver calls netif_set_link_down / netif_set_link_up upon WiFi
(de)association. After bootup, I call netif_set_up and dhcp_start once.

Thanks & Greetings,
Niklas


_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Application callback for dhcp reboot with unchanged address

goldsimon@gmx.de


Niklas Gürtler" wrote:

> [..]
>When I restart my WiFi access point, the link is reconnected as
>desired,
>and lwIP performs a DHCP reboot and receives the same address as
>before.
>Unfortunately, in this case, the status callback is never called after
>a
>dhcp reboot. I think this is because in netif_do_set_ipaddr, the
>"NETIF_STATUS_CALLBACK" only happens when the address is actually
>different.
>
>So, how do I know when the link is ready for TCP connections after a
>WiFi re-association and DHCP reboot?

I think there might be missing something here. Would you mind filing a bug report to our bugtracker to prevent this getting lost?

Thanks,
Simon

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Application callback for dhcp reboot with unchanged address

Niklas Gürtler
On 11/28/18 10:02 AM, goldsimon wrote:

>
> Niklas Gürtler" wrote:
>> [..]
>> When I restart my WiFi access point, the link is reconnected as
>> desired,
>> and lwIP performs a DHCP reboot and receives the same address as
>> before.
>> Unfortunately, in this case, the status callback is never called after
>> a
>> dhcp reboot. I think this is because in netif_do_set_ipaddr, the
>> "NETIF_STATUS_CALLBACK" only happens when the address is actually
>> different.
>>
>> So, how do I know when the link is ready for TCP connections after a
>> WiFi re-association and DHCP reboot?
> I think there might be missing something here. Would you mind filing a bug report to our bugtracker to prevent this getting lost?
>
> Thanks,
> Simon
>
> _______________________________________________
> lwip-users mailing list
> [hidden email]
> https://lists.nongnu.org/mailman/listinfo/lwip-users
Gladly, filed it as bug #55121. Thanks!

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users