Need to force the isc headers to not include the isc/ipv6.h code.
bk: 3f31b6584omMweWn4QlMhiYYsZpqdA
init_io(void)
{
#ifdef SYS_WINNT
- WORD wVersionRequested;
- WSADATA wsaData;
init_transmitbuff();
#endif /* SYS_WINNT */
#endif
#ifdef SYS_WINNT
- wVersionRequested = MAKEWORD(2,0);
- if (WSAStartup(wVersionRequested, &wsaData))
+ if (!Win32InitSockets())
{
netsyslog(LOG_ERR, "No useable winsock.dll: %m");
exit(1);
#include "ntp_select.h"
#include "ntp_io.h"
#include "ntp_stdlib.h"
+/* Don't include ISC's version of IPv6 variables and structures */
+#define ISC_IPV6_H 1
#include "isc/net.h"
#include "isc/result.h"
#endif /* SYS_WINNT || SYS_VXWORKS */
#ifdef SYS_WINNT
-WORD wVersionRequested;
-WSADATA wsaData;
DWORD NumberOfBytesWritten;
HANDLE TimerThreadHandle = NULL; /* 1998/06/03 - Used in ntplib/machines.c */
taskPrioritySet(taskIdSelf(), 100 );
#endif
+#ifdef SYS_WINNT
+ if (!Win32InitSockets())
+ {
+ fprintf(stderr, "No useable winsock.dll:");
+ exit(1);
+ }
+#endif /* SYS_WINNT */
+
+ /* Check to see if we have IPv6. Otherwise force the -4 flag */
if (isc_net_probeipv6() != ISC_R_SUCCESS) {
ai_fam_default = AF_INET;
}
}
pktdatasize = INITDATASIZE;
-#ifdef SYS_WINNT
- wVersionRequested = MAKEWORD(1,1);
- if (WSAStartup(wVersionRequested, &wsaData)) {
- fprintf(stderr, "No useable winsock.dll");
- exit(1);
- }
-#endif /* SYS_WINNT */
-
if (numcmds == 0) {
(void) openhost(chosts[0]);
getcmds();
#include "ntp_io.h"
#include "ntp_select.h"
#include "ntp_stdlib.h"
+/* Don't include ISC's version of IPv6 variables and structures */
+#define ISC_IPV6_H 1
#include "isc/net.h"
#include "isc/result.h"
struct servent *server_entry = NULL; /* server entry for ntp */
#ifdef SYS_WINNT
-WORD wVersionRequested;
-WSADATA wsaData;
DWORD NumberOfBytesWritten;
HANDLE TimerThreadHandle = NULL; /* 1998/06/03 - Used in ntplib/machines.c */
delay_time.l_ui = 0;
delay_time.l_uf = DEFDELAY;
+#ifdef SYS_WINNT
+ if (!Win32InitSockets())
+ {
+ fprintf(stderr, "No useable winsock.dll:");
+ exit(1);
+ }
+#endif /* SYS_WINNT */
+
+ /* Check to see if we have IPv6. Otherwise force the -4 flag */
if (isc_net_probeipv6() != ISC_R_SUCCESS) {
ai_fam_default = AF_INET;
}
(void) signal_no_reset(SIGINT, abortcmd);
#endif /* SYS_WINNT */
-#ifdef SYS_WINNT
- wVersionRequested = MAKEWORD(1,1);
- if (WSAStartup(wVersionRequested, &wsaData)) {
- fprintf(stderr, "No useable winsock.dll");
- exit(1);
- }
-#endif /* SYS_WINNT */
-
if (numcmds == 0) {
(void) openhost(chosts[0]);
getcmds();
#define inet_aton isc_net_aton
#endif
+/* Socket Initialization Code */
+
+BOOL
+Win32InitSockets();
+
ISC_LANG_ENDDECLS
#endif /* ISC_NET_H */
initialize();
return (ipv6_result);
}
+/*
+ * Initialize socket services
+ */
+BOOL Win32InitSockets() {
+ WORD wVersionRequested;
+ WSADATA wsaData;
+ int err;
+
+ /* Need Winsock 2.0 or better */
+ wVersionRequested = MAKEWORD(2, 0);
+
+ err = WSAStartup(wVersionRequested, &wsaData);
+ if ( err != 0 ) {
+ /* Tell the user that we could not find a usable Winsock DLL */
+ return(FALSE);
+ }
+ return(TRUE);
+}