Skip to content

Commit 3e876e5

Browse files
LN882H Fixclaude
andcommitted
[lightning-ln882h] Restore DNS servers after DHCP fallback on reconnect (libretiny-eu#375)
When the reconnect/roam fallback path fires (wifiApplyStaticIpCallback), LwIP's dhcp_recv() has already updated the DNS table via DHCP option 6 before we could stop DHCP. Restore info.dns1/dns2 after netif_set_addr() to ensure the user-configured DNS servers survive reconnects. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6686568 commit 3e876e5

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

cores/lightning-ln882h/arduino/libraries/WiFi/WiFiEvents.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ static void wifiApplyStaticIpCallback(void *arg) {
3737
// is now stopped dhcp_supplied_address() returns false, so g_get_ip_cb is
3838
// NOT re-entered — no infinite recursion.
3939

40+
// Restore configured DNS servers — DHCP may have overwritten them via option 6
41+
// before we could stop it (reconnect/roam fallback path only).
42+
ip4_addr_t d1, d2;
43+
d1.addr = info.dns1;
44+
d2.addr = info.dns2;
45+
if (d1.addr)
46+
dns_setserver(0, &d1);
47+
if (d2.addr)
48+
dns_setserver(1, &d2);
49+
4050
// Emit GOT_IP with the correct static address
4151
wifiEventIpReceived(nif);
4252
}

0 commit comments

Comments
 (0)