[ntp:bk-ntp-dev-send] BitKeeper patch

Harlan Stenn stenn at mail.eecis.udel.edu
Sun Nov 6 22:37:37 PST 2005


This BitKeeper patch contains the following changesets:
mayer at pogo.udel.edu|ChangeSet|20051106221515|21190

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# ID:	stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
# User:	stenn
# Host:	deacon.udel.edu
# Root:	/deacon/backroom/ntp-dev

#
#--- 1.53/ntpdate/ntpdate.c	2005-11-01 23:40:06 -05:00
#+++ 1.54/ntpdate/ntpdate.c	2005-11-06 17:14:04 -05:00
#@@ -87,6 +87,7 @@
# #define TARGET_RESOLUTION 1  /* Try for 1-millisecond accuracy
# 				on Windows NT timers. */
# #pragma comment(lib, "winmm")
#+isc_boolean_t ntp_port_inuse(int af, u_short port);
# #endif /* SYS_WINNT */
# 
# /*
#@@ -131,7 +132,7 @@
# struct pollfd fdmask[MAX_AF];
# #else
# fd_set fdmask;
#-int maxfd;
#+SOCKET maxfd;
# #endif
# int polltest = 0;
# 
#@@ -1439,10 +1440,10 @@
# 	isc_sockaddr_t saddr;
# 
# 	if(addr->ss_family == AF_INET) {
#-		isc_sockaddr_fromin( &laddr, &((struct sockaddr_in*)&addr)->sin_addr, 0);
#+		isc_sockaddr_fromin( &laddr, &((struct sockaddr_in*)addr)->sin_addr, 0);
# 	}
# 	else {
#-		isc_sockaddr_fromin6(&laddr, &((struct sockaddr_in6*)&addr)->sin6_addr, 0);
#+		isc_sockaddr_fromin6(&laddr, &((struct sockaddr_in6*)addr)->sin6_addr, 0);
# 	}
# 
# 
#@@ -1724,6 +1725,7 @@
# 	 * Init hints addrinfo structure
# 	 */
# 	memset(&hints, 0, sizeof(hints));
#+	hints.ai_family = ai_fam_templ;
# 	hints.ai_flags = AI_PASSIVE;
# 	hints.ai_socktype = SOCK_DGRAM;
# 
#@@ -1733,6 +1735,13 @@
# 	       /*NOTREACHED*/
# 	}
# 
#+#ifdef SYS_WINNT
#+	if (ntp_port_inuse(AF_INET, NTP_PORT) ){
#+		netsyslog(LOG_ERR, "the NTP socket is in use, exiting: %m");
#+		exit(1);
#+	}
#+#endif
#+
# 	/* Remember the address of the addrinfo structure chain */
# 	ressave = res;
# 
#@@ -1741,7 +1750,8 @@
# 	 */
# 	for(nbsock = 0; (nbsock < MAX_AF) && res ; res = res->ai_next) {
# 	/* create a datagram (UDP) socket */
#-	   if ((fd[nbsock] = socket(res->ai_family, res->ai_socktype, res->ai_protocol)) < 0) {
#+	   fd[nbsock] = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
#+	   if (fd[nbsock] == SOCKET_ERROR) {
# #ifndef SYS_WINNT
# 		if (errno == EPROTONOSUPPORT || errno == EAFNOSUPPORT ||
# 		    errno == EPFNOSUPPORT)
#@@ -1797,7 +1807,7 @@
# 	    fdmask[nbsock].events = POLLIN;
# #else
# 	    FD_SET(fd[nbsock], &fdmask);
#-	    if ((SOCKET) maxfd < fd[nbsock]+1) {
#+	    if (maxfd < fd[nbsock]+1) {
# 		maxfd = fd[nbsock]+1;
# 	    }
# #endif
#@@ -1903,7 +1913,7 @@
# 	struct timeval tvzero;
# 	int fromlen;
# 	l_fp ts;
#-	int i;
#+	SOCKET i;
# #ifdef HAVE_POLL_H
# 	struct pollfd fds[MAX_AF];
# #else
#@@ -2283,5 +2293,36 @@
# 	}
# 
# 	return(namelist);
#+}
#+#endif
#+
#+#ifdef SYS_WINNT
#+isc_boolean_t ntp_port_inuse(int af, u_short port)
#+{
#+	/*
#+	 * Check if NTP socket is already in use on this system
#+	 * This is only for Windows Systems, as they tend not to fail on the real bind() below
#+	 */
#+	
#+	SOCKET checksocket;
#+	struct sockaddr_in checkservice;
#+	checksocket = socket(af, SOCK_DGRAM, 0);
#+	if (checksocket == INVALID_SOCKET) {
#+		return (ISC_TRUE);
#+	}
#+
#+	checkservice.sin_family = (short) AF_INET;
#+	checkservice.sin_addr.s_addr = INADDR_LOOPBACK;
#+	checkservice.sin_port = htons(port);
#+
#+	if (bind(checksocket, (struct sockaddr *)&checkservice,
#+		sizeof(checkservice)) == SOCKET_ERROR) {
#+		if ( WSAGetLastError() == WSAEADDRINUSE ){
#+			closesocket(checksocket);
#+			return (ISC_TRUE);
#+		}
#+	}
#+	closesocket(checksocket);
#+	return (ISC_FALSE);
# }
# #endif
#

# Diff checksum=412fa192


# Patch vers:	1.3
# Patch type:	REGULAR

== ChangeSet ==
stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
mayer at pogo.udel.edu|ChangeSet|20051104044006|21182
D 1.1432 05/11/06 17:15:15-05:00 mayer at pogo.udel.edu +1 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Fixes from Heiko and Martin for ntpdate on Windows
K 21190
P ChangeSet
------------------------------------------------

0a0
> stenn at whimsy.udel.edu|ntpdate/ntpdate.c|19990526004819|01635|3aed0663 mayer at pogo.udel.edu|ntpdate/ntpdate.c|20051106221404|26286

== ntpdate/ntpdate.c ==
stenn at whimsy.udel.edu|ntpdate/ntpdate.c|19990526004819|01635|3aed0663
mayer at pogo.udel.edu|ntpdate/ntpdate.c|20051102044006|06922
D 1.54 05/11/06 17:14:04-05:00 mayer at pogo.udel.edu +47 -6
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c Fixes from Heiko and Martin for ntpdate on Windows
K 26286
O -rw-rw-r--
P ntpdate/ntpdate.c
------------------------------------------------

I89 1
isc_boolean_t ntp_port_inuse(int af, u_short port);
D134 1
I134 1
SOCKET maxfd;
D1442 1
I1442 1
		isc_sockaddr_fromin( &laddr, &((struct sockaddr_in*)addr)->sin_addr, 0);
D1445 1
I1445 1
		isc_sockaddr_fromin6(&laddr, &((struct sockaddr_in6*)addr)->sin6_addr, 0);
I1726 1
	hints.ai_family = ai_fam_templ;
I1735 7
#ifdef SYS_WINNT
	if (ntp_port_inuse(AF_INET, NTP_PORT) ){
		netsyslog(LOG_ERR, "the NTP socket is in use, exiting: %m");
		exit(1);
	}
#endif
\
D1744 1
I1744 2
	   fd[nbsock] = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
	   if (fd[nbsock] == SOCKET_ERROR) {
D1800 1
I1800 1
	    if (maxfd < fd[nbsock]+1) {
D1906 1
I1906 1
	SOCKET i;
I2285 31
}
#endif
\
#ifdef SYS_WINNT
isc_boolean_t ntp_port_inuse(int af, u_short port)
{
	/*
	 * Check if NTP socket is already in use on this system
	 * This is only for Windows Systems, as they tend not to fail on the real bind() below
	 */
	
	SOCKET checksocket;
	struct sockaddr_in checkservice;
	checksocket = socket(af, SOCK_DGRAM, 0);
	if (checksocket == INVALID_SOCKET) {
		return (ISC_TRUE);
	}
\
	checkservice.sin_family = (short) AF_INET;
	checkservice.sin_addr.s_addr = INADDR_LOOPBACK;
	checkservice.sin_port = htons(port);
\
	if (bind(checksocket, (struct sockaddr *)&checkservice,
		sizeof(checkservice)) == SOCKET_ERROR) {
		if ( WSAGetLastError() == WSAEADDRINUSE ){
			closesocket(checksocket);
			return (ISC_TRUE);
		}
	}
	closesocket(checksocket);
	return (ISC_FALSE);

# Patch checksum=0fe0eaa5


More information about the bk-ntp-dev-send mailing list