Skip to content
This repository was archived by the owner on Jun 5, 2019. It is now read-only.

Commit 8ee8cef

Browse files
committed
Fix the condition for setting static DNS
1 parent 7e18234 commit 8ee8cef

File tree

1 file changed

+4
-24
lines changed

1 file changed

+4
-24
lines changed

DeviceCode/pal/lwip_1_4_1_os/SocketsDriver/lwIP__Sockets.cpp

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ HRESULT LWIP_SOCKETS_Driver::UpdateAdapterConfiguration( UINT32 interfaceIndex,
803803
}
804804

805805
BOOL fEnableDhcp = (0 != (config->flags & SOCK_NETWORKCONFIGURATION_FLAGS_DHCP));
806-
//BOOL fDynamicDns = (0 != (config->flags & SOCK_NETWORKCONFIGURATION_FLAGS_DYNAMIC_DNS));
806+
BOOL fDynamicDns = (0 != (config->flags & SOCK_NETWORKCONFIGURATION_FLAGS_DYNAMIC_DNS));
807807
BOOL fDhcpStarted;
808808

809809
struct netif *pNetIf = netif_find_interface(g_LWIP_SOCKETS_Driver.m_interfaces[interfaceIndex].m_interfaceNumber);
@@ -814,30 +814,12 @@ HRESULT LWIP_SOCKETS_Driver::UpdateAdapterConfiguration( UINT32 interfaceIndex,
814814

815815
fDhcpStarted = (0 != (pNetIf->flags & NETIF_FLAG_DHCP));
816816

817-
// TODO Disable a separate option for dynamic DNS for now.
818817
#if LWIP_DNS
819818
// when using DHCP do not use the static settings
820819
if(0 != (updateFlags & SOCK_NETWORKCONFIGURATION_UPDATE_DNS))
821820
{
822-
//// if dynamic dns is on, then we will set the corresonding NetIF flag
823-
//// resetting dhcp if necessary.
824-
//if(fDynamicDns || (config->dnsServer1 == 0 && config->dnsServer2 == 0))
825-
//{
826-
// if(0 == (pNetIf->flagsExt & NETIF_FLAG_EXT_DYNAMIC_DNS))
827-
// {
828-
// pNetIf->flagsExt |= NETIF_FLAG_EXT_DYNAMIC_DNS;
829-
830-
// // if dhcp is active, we need to reset in order to get the dynamic
831-
// // dns
832-
// if(fEnableDhcp && fDhcpStarted)
833-
// {
834-
// dhcp_stop(pNetIf);
835-
// dhcp_start(pNetIf);
836-
// }
837-
// }
838-
//}
839-
//else
840-
//{
821+
if(!fDynamicDns && (config->dnsServer1 != 0 || config->dnsServer2 != 0))
822+
{
841823
// user defined DNS addresses
842824
if(config->dnsServer1 != 0)
843825
{
@@ -851,9 +833,7 @@ HRESULT LWIP_SOCKETS_Driver::UpdateAdapterConfiguration( UINT32 interfaceIndex,
851833

852834
dns_setserver(idx, (struct ip_addr *)&config->dnsServer2);
853835
}
854-
855-
// pNetIf->flagsExt &= ~NETIF_FLAG_EXT_DYNAMIC_DNS;
856-
//}
836+
}
857837
}
858838
#endif
859839

0 commit comments

Comments
 (0)