Skip to content

Commit 3951422

Browse files
author
Mika Leppänen
committed
lwIP adds now PPP DNS servers to default interface
If PPP interface is the lwIP default interface, adds the PPP DNS servers to default DNS server storage. If PPP is not default interface, then adds DNS servers to interface specific storage.
1 parent e3f2477 commit 3951422

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

features/lwipstack/LWIPInterfacePPP.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,16 @@ void LWIP::Interface::ppp_state_change(bool up)
105105
}
106106

107107
unsigned char dns_index = 0;
108-
108+
// If default interface set default DNS addresses, otherwise interface specific
109+
struct netif *dns_netif = &netif;
110+
if (netif_check_default(&netif)) {
111+
dns_netif = NULL;
112+
}
109113
for (unsigned char index = 0; index < 2; index++) {
110114
ip_addr_t dns_server;
111115
const nsapi_addr_t *ipv4_dns_server = LWIP::Interface::ppp->get_dns_server(index);
112116
if (ipv4_dns_server && convert_mbed_addr_to_lwip(&dns_server, ipv4_dns_server)) {
113-
dns_setserver(dns_index++, &dns_server, &netif);
117+
dns_setserver(dns_index++, &dns_server, dns_netif);
114118
}
115119
}
116120
}

0 commit comments

Comments
 (0)