Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit893dba5

Browse files
committed
fix(network): Fix getting fallback DNS server
- Fix getting fallback DNS server using NetworkInterface::dnsIP() getter- Remove magic number from NetworkInterface::dnsIP() setter
1 parent333bfff commit893dba5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎libraries/Network/src/NetworkInterface.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ bool NetworkInterface::enableIPv6(bool en) {
352352
}
353353

354354
boolNetworkInterface::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
returnfalse;
357357
}
358358
esp_netif_flags_t flags =esp_netif_get_flags(_esp_netif);
@@ -708,11 +708,11 @@ IPAddress NetworkInterface::gatewayIP() const {
708708
}
709709

710710
IPAddressNetworkInterface::dnsIP(uint8_t dns_no)const {
711-
if (_esp_netif ==NULL) {
711+
if (_esp_netif ==NULL || dns_no >= ESP_NETIF_DNS_MAX) {
712712
returnIPAddress();
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
returnIPAddress();
717717
}
718718
if (d.ip.type == ESP_IPADDR_TYPE_V6) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp