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

Commit cda5fd2

Browse files
committed
Merge pull request #321 from mortezag/fixStaticDNS
Fix the condition for setting static DNS
2 parents 35aab5f + 8ee8cef commit cda5fd2

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
@@ -794,7 +794,7 @@ HRESULT LWIP_SOCKETS_Driver::UpdateAdapterConfiguration( UINT32 interfaceIndex,
794794
}
795795

796796
BOOL fEnableDhcp = (0 != (config->flags & SOCK_NETWORKCONFIGURATION_FLAGS_DHCP));
797-
//BOOL fDynamicDns = (0 != (config->flags & SOCK_NETWORKCONFIGURATION_FLAGS_DYNAMIC_DNS));
797+
BOOL fDynamicDns = (0 != (config->flags & SOCK_NETWORKCONFIGURATION_FLAGS_DYNAMIC_DNS));
798798
BOOL fDhcpStarted;
799799

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

806806
fDhcpStarted = (0 != (pNetIf->flags & NETIF_FLAG_DHCP));
807807

808-
// TODO Disable a separate option for dynamic DNS for now.
809808
#if LWIP_DNS
810809
// when using DHCP do not use the static settings
811810
if(0 != (updateFlags & SOCK_NETWORKCONFIGURATION_UPDATE_DNS))
812811
{
813-
//// if dynamic dns is on, then we will set the corresonding NetIF flag
814-
//// resetting dhcp if necessary.
815-
//if(fDynamicDns || (config->dnsServer1 == 0 && config->dnsServer2 == 0))
816-
//{
817-
// if(0 == (pNetIf->flagsExt & NETIF_FLAG_EXT_DYNAMIC_DNS))
818-
// {
819-
// pNetIf->flagsExt |= NETIF_FLAG_EXT_DYNAMIC_DNS;
820-
821-
// // if dhcp is active, we need to reset in order to get the dynamic
822-
// // dns
823-
// if(fEnableDhcp && fDhcpStarted)
824-
// {
825-
// dhcp_stop(pNetIf);
826-
// dhcp_start(pNetIf);
827-
// }
828-
// }
829-
//}
830-
//else
831-
//{
812+
if(!fDynamicDns && (config->dnsServer1 != 0 || config->dnsServer2 != 0))
813+
{
832814
// user defined DNS addresses
833815
if(config->dnsServer1 != 0)
834816
{
@@ -842,9 +824,7 @@ HRESULT LWIP_SOCKETS_Driver::UpdateAdapterConfiguration( UINT32 interfaceIndex,
842824

843825
dns_setserver(idx, (struct ip_addr *)&config->dnsServer2);
844826
}
845-
846-
// pNetIf->flagsExt &= ~NETIF_FLAG_EXT_DYNAMIC_DNS;
847-
//}
827+
}
848828
}
849829
#endif
850830

0 commit comments

Comments
 (0)