|
From: | matt swindell |
Subject: | [lwip-users] DHCP not surviving multiple reconnections |
Date: | Tue, 16 Feb 2021 08:55:17 -0600 |
Hello, I am new to LWIP currently I am using LWIP 2.1.2 with no OS (NO_SYS = 1) in lwipopts.h. My question is about the connection/disconnection from the DHCP server. Using Wireshark I am able to see the initial DHCP request and properly receive an IP address, followed by ARP announcements. The device seems to survive an initial disconnect, sending a Request to validate it’s IP and an ACK from the DHCP server once reconnected. However, further disconnects and reconnections appear to confuse the device. I have a PHY interrupt callback which calls netif_set_link_down() and netif_set_link_up() when the PHY link status changes. Since the dhcp state was bound dhcp_reboot() is called from dhcp_network_changed(). This all seems to work fine until we hit the dhcp_timeout() and my dhcp tries are greater than or equal to REBOOT_TRIES, at which point it calls dhcp_discover() and I get stuck in a loop where the device sends a discovery message and is offered an IP address back but it gets ignored. By increasing REBOOT_TRIES I am able to get a few more reconnections without problem, but at some point it always seems to get stuck in that dhcp discovery loop. I am unsure if I have done something incorrectly or if I am confusing the DHCP state machine, but from everything I have read with regards to LWIP > 2.x.x calling netif_set_link_up/down() should be sufficient for maintaining DHCP once dhcp_start() has been called. Any help would be greatly appreciated. Thanks, Matt |
DHCP_Connect1.pcapng
Description: Binary data
[Prev in Thread] | Current Thread | [Next in Thread] |