Pekka,

We have seen Windows to unexpectedly drop DNS related keys (used by 
sresolv module) from the registry, while settings are still available 
via IP Helper API. This leads to empty DNS server list in the sresolv 
and non-functional application as a result.

The patch below tries to get DNS list via IP Helper API first and uses 
registry only when IP Helper way fails.

{
hunk ./libsofia-sip-ua/sresolv/sres.c 68
+#include <iphlpapi.h>
hunk ./libsofia-sip-ua/sresolv/sres.c 1894
+/**
+ * Uses IP Helper IP to get DNS servers list.
+ */
+static int sres_parse_win32_ip(sres_config_t *c)
+{
+  DWORD dw;
+  int ret = -1;
+  su_home_t *home = c->c_home;
+  ULONG size = sizeof(FIXED_INFO);
+
+  do {
+    FIXED_INFO *info = (FIXED_INFO *)su_alloc(home, size);
+    dw = GetNetworkParams(info, &size);
+    if (dw == ERROR_SUCCESS) {
+      IP_ADDR_STRING* addr = &info->DnsServerList;
+      for (; addr; addr = addr->Next) {
+       SU_DEBUG_3(("Adding nameserver: %s\n", addr->IpAddress.String));
+       sres_parse_nameserver(c, addr->IpAddress.String);
+      }
+      ret = 0;
+    }
+    su_free(home, info);
+  } while (dw == ERROR_BUFFER_OVERFLOW);
+
+  return ret;
+}
+
+
hunk ./libsofia-sip-ua/sresolv/sres.c 2104
-    if (sres_parse_win32_reg(c) == 0)
+    if (sres_parse_win32_ip(c) == 0 || sres_parse_win32_reg(c) == 0)
hunk ./win32/libsofia-sip-ua/libsofia_sip_ua.dsp 56
-# ADD LINK32 kernel32.lib user32.lib ws2_32.lib advapi32.lib /nologo 
/dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib ws2_32.lib iphlpapi.lib 
advapi32.lib /nologo /dll /machine:I386
hunk ./win32/libsofia-sip-ua/libsofia_sip_ua.dsp 83
-# ADD LINK32 kernel32.lib user32.lib ws2_32.lib advapi32.lib /nologo 
/dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib ws2_32.lib iphlpapi.lib 
advapi32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
}


win32/config.h.in contains following lines:
/* Define as 1 you have WIN32 <iphlpapi.h> */
// XXX: vehmanek-win32-fix:
#undef HAVE_IPHLPAPI_H

Seems that you already had some build problems with IP Helper (for now 
I've added respective #include under HAVE_WINSOCK2_H)?

Best regards,
Roman Filonenko

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to