File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -352,7 +352,7 @@ bool NetworkInterface::enableIPv6(bool en) {
352352}
353353
354354bool NetworkInterface::dnsIP (uint8_t dns_no, IPAddress ip) {
355- if (_esp_netif == NULL || dns_no > 2 ) {
355+ if (_esp_netif == NULL || dns_no >= ESP_NETIF_DNS_MAX ) {
356356 return false ;
357357 }
358358 esp_netif_flags_t flags = esp_netif_get_flags (_esp_netif);
@@ -708,11 +708,11 @@ IPAddress NetworkInterface::gatewayIP() const {
708708}
709709
710710IPAddress NetworkInterface::dnsIP (uint8_t dns_no) const {
711- if (_esp_netif == NULL ) {
711+ if (_esp_netif == NULL || dns_no >= ESP_NETIF_DNS_MAX ) {
712712 return IPAddress ();
713713 }
714714 esp_netif_dns_info_t d;
715- if (esp_netif_get_dns_info (_esp_netif, dns_no ? ESP_NETIF_DNS_BACKUP : ESP_NETIF_DNS_MAIN , &d) != ESP_OK) {
715+ if (esp_netif_get_dns_info (_esp_netif, ( esp_netif_dns_type_t ) dns_no, &d) != ESP_OK) {
716716 return IPAddress ();
717717 }
718718 if (d.ip .type == ESP_IPADDR_TYPE_V6) {
You can’t perform that action at this time.
0 commit comments