Skip to content

Commit

Permalink
ESP8266: Fix static DNS configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
rojer committed Sep 14, 2021
1 parent 74670d6 commit ce1e294
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/esp8266/esp_wifi.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,10 +473,17 @@ bool mgos_wifi_dev_get_ip_info(int if_instance,
struct netif *sta_if = eagle_lwip_getif(STATION_IF);
if (sta_if != NULL) {
struct dhcp *dhcp = sta_if->dhcp;
if (dhcp != NULL) {
const struct mgos_config_wifi_sta *cfg = mgos_wifi_get_connected_sta_cfg();
if (cfg != NULL && !mgos_conf_str_empty(cfg->nameserver)) {
mgos_net_str_to_ip(cfg->nameserver, &ip_info->dns);
} else if (dhcp != NULL) {
ip_info->dns.sin_addr.s_addr =
ip4_addr_get_u32(&dhcp->offered_dns_addr);
}
if (dhcp != NULL) {
ip_info->ntp.sin_addr.s_addr =
ip4_addr_get_u32(&dhcp->offered_ntp_addr);
}
}
}
return true;
Expand Down

0 comments on commit ce1e294

Please sign in to comment.