[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] Application callback for dhcp reboot with unchanged address
From: |
Niklas Gürtler |
Subject: |
[lwip-users] Application callback for dhcp reboot with unchanged address |
Date: |
Wed, 28 Nov 2018 09:49:37 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 |
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] Application callback for dhcp reboot with unchanged address,
Niklas Gürtler <=