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

Harlan Stenn stenn at whimsy.udel.edu
Wed Mar 2 21:52:38 UTC 2005


This BitKeeper patch contains the following changesets:
stenn at whimsy.udel.edu|ChangeSet|20050302211807|47051

# 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:	whimsy.udel.edu
# Root:	/backroom/ntp-stable

#
#--- 1.47/ntpdate/ntpdate.c	2004-04-07 16:48:07 -04:00
#+++ 1.48/ntpdate/ntpdate.c	2005-03-02 16:17:50 -05:00
#@@ -1321,6 +1321,30 @@
# }
# 
# 
#+/*
#+ * is_unreachable - check to see if we have a route to given destination
#+ *		    (non-blocking).
#+ */
#+static int
#+is_reachable (struct sockaddr_storage *dst)
#+{
#+	SOCKET sockfd;
#+
#+	sockfd = socket(dst->ss_family, SOCK_DGRAM, 0);
#+	if (sockfd == -1) {
#+		return 0;
#+	}
#+
#+	if(connect(sockfd, (struct sockaddr *)dst, SOCKLEN(dst))) {
#+		closesocket(sockfd);
#+		return 0;
#+	}
#+	closesocket(sockfd);
#+	return 1;
#+}
#+
#+
#+
# /* XXX ELIMINATE: merge BIG slew into adj_systime in lib/systime.c */
# /*
#  * addserver - determine a server's address and allocate a new structure
#@@ -1333,7 +1357,7 @@
# {
# 	register struct server *server;
# 	/* Address infos structure to store result of getaddrinfo */
#-	struct addrinfo *addrResult;
#+	struct addrinfo *addrResult, *ptr;
# 	/* Address infos structure to store hints for getaddrinfo */
# 	struct addrinfo hints;
# 	/* Error variable for getaddrinfo */
#@@ -1364,22 +1388,28 @@
# 	}
# #endif
# 
#-	server = (struct server *)emalloc(sizeof(struct server));
#-	memset((char *)server, 0, sizeof(struct server));
#-
#-	/* For now we only get the first returned server of the addrinfo list */
#-	memset(&(server->srcadr), 0, sizeof(struct sockaddr_storage));
#-	memcpy(&(server->srcadr), addrResult->ai_addr, addrResult->ai_addrlen);
#-	server->event_time = ++sys_numservers;
#-	if (sys_servers == NULL)
#-		sys_servers = server;
#-	else {
#-		struct server *sp;
#-
#-		for (sp = sys_servers; sp->next_server != NULL;
#-		     sp = sp->next_server) ;
#-		sp->next_server = server;
#+	/* We must get all returned server in case the first one fails */
#+	for (ptr = addrResult; ptr != NULL; ptr = ptr->ai_next) {
#+		if (is_reachable ((struct sockaddr_storage *)ptr->ai_addr)) {
#+			server = (struct server *)emalloc(sizeof(struct server));
#+			memset((char *)server, 0, sizeof(struct server));
#+
#+			memset(&(server->srcadr), 0, sizeof(struct sockaddr_storage));
#+			memcpy(&(server->srcadr), ptr->ai_addr, ptr->ai_addrlen);
#+			server->event_time = ++sys_numservers;
#+			if (sys_servers == NULL)
#+				sys_servers = server;
#+			else {
#+				struct server *sp;
#+
#+				for (sp = sys_servers; sp->next_server != NULL;
#+				     sp = sp->next_server) ;
#+				sp->next_server = server;
#+			}
#+		}
# 	}
#+
#+	freeaddrinfo(addrResult);
# }
# 
# 
#

# Diff checksum=29c6f69a


# Patch vers:	1.3
# Patch type:	REGULAR

== ChangeSet ==
stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
stenn at whimsy.udel.edu|ChangeSet|20040506053949|46819
D 1.1191 05/03/02 16:18:07-05:00 stenn at whimsy.udel.edu +1 -0
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c [Bug 389] Fix from Remi Demis-Courmont, via Loic Minier (http://bugs.debian.org/293793
K 47051
P ChangeSet
------------------------------------------------

0a0
> stenn at whimsy.udel.edu|ntpdate/ntpdate.c|19990526004819|01635|3aed0663 stenn at whimsy.udel.edu|ntpdate/ntpdate.c|20050302211750|27096

== ntpdate/ntpdate.c ==
stenn at whimsy.udel.edu|ntpdate/ntpdate.c|19990526004819|01635|3aed0663
mayer at pogo.udel.edu|ntpdate/ntpdate.c|20040407204807|48772
D 1.48 05/03/02 16:17:50-05:00 stenn at whimsy.udel.edu +46 -16
B stenn at whimsy.udel.edu|ChangeSet|19990526004811|57482|8983e65c737bb465
C
c [Bug 389] Fix from Remi Demis-Courmont, via Loic Minier (http://bugs.debian.org/293793
K 27096
O -rw-rw-r--
P ntpdate/ntpdate.c
------------------------------------------------

I1323 24
/*
 * is_unreachable - check to see if we have a route to given destination
 *		    (non-blocking).
 */
static int
is_reachable (struct sockaddr_storage *dst)
{
	SOCKET sockfd;
\
	sockfd = socket(dst->ss_family, SOCK_DGRAM, 0);
	if (sockfd == -1) {
		return 0;
	}
\
	if(connect(sockfd, (struct sockaddr *)dst, SOCKLEN(dst))) {
		closesocket(sockfd);
		return 0;
	}
	closesocket(sockfd);
	return 1;
}
\
\
\
D1336 1
I1336 1
	struct addrinfo *addrResult, *ptr;
D1367 15
I1381 19
	/* We must get all returned server in case the first one fails */
	for (ptr = addrResult; ptr != NULL; ptr = ptr->ai_next) {
		if (is_reachable ((struct sockaddr_storage *)ptr->ai_addr)) {
			server = (struct server *)emalloc(sizeof(struct server));
			memset((char *)server, 0, sizeof(struct server));
\
			memset(&(server->srcadr), 0, sizeof(struct sockaddr_storage));
			memcpy(&(server->srcadr), ptr->ai_addr, ptr->ai_addrlen);
			server->event_time = ++sys_numservers;
			if (sys_servers == NULL)
				sys_servers = server;
			else {
				struct server *sp;
\
				for (sp = sys_servers; sp->next_server != NULL;
				     sp = sp->next_server) ;
				sp->next_server = server;
			}
		}
I1382 2
\
	freeaddrinfo(addrResult);

# Patch checksum=fbb5b993


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