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

Harlan Stenn stenn at whimsy.udel.edu
Sun Aug 27 23:54:07 UTC 2006


#### ChangeSet ####
2006-08-27 23:44:15+00:00, stenn at ntp1.isc.org 
  [Bug 153] Avoid DNS lookups of known netmasks or refclocks

==== ntpd/ntp_config.c ====
2006-08-27 23:44:07+00:00, stenn at ntp1.isc.org +30 -4
  [Bug 153] Avoid DNS lookups of known netmasks or refclocks

--- 1.140/ntpd/ntp_config.c	2006-08-27 19:54:07 -04:00
+++ 1.141/ntpd/ntp_config.c	2006-08-27 19:54:07 -04:00
@@ -2206,6 +2206,19 @@ getnetnum(
 	struct addrinfo *ptr;
 	int retval;
 
+#if 0
+	printf("getnetnum: <%s> is a %s (%d)\n",
+		num,
+		(a_type == t_UNK)
+		? "t_UNK"
+		: (a_type == t_REF)
+		  ? "t_REF"
+		  : (a_type == t_MSK)
+		    ? "t_MSK"
+		    : "???",
+		a_type);
+#endif
+
 	/* Get host address. Looking for UDP datagram connection */
  	memset(&hints, 0, sizeof (hints));
  	if (addr->ss_family == AF_INET || addr->ss_family == AF_INET6)
@@ -2219,9 +2232,14 @@ getnetnum(
 		hints.ai_family = AF_INET;
 
 	hints.ai_socktype = SOCK_DGRAM;
+
+	if (a_type != t_UNK) {
+		hints.ai_flags = AI_NUMERICHOST;
+	}
+
 #ifdef DEBUG
-		if (debug > 3)
-			printf("getaddrinfo %s\n", num);
+	if (debug > 3)
+		printf("getnetnum: calling getaddrinfo(%s,...)\n", num);
 #endif
 	retval = getaddrinfo(num, "ntp", &hints, &ptr);
 	if (retval != 0 ||
@@ -2252,8 +2270,16 @@ getnetnum(
 	memcpy(addr, ptr->ai_addr, ptr->ai_addrlen);
 #ifdef DEBUG
 	if (debug > 1)
-		printf("getnetnum given %s, got %s \n",
-		   num, stoa(addr));
+		printf("getnetnum given %s, got %s (%s/%d)\n",
+		   num, stoa(addr),
+			(a_type == t_UNK)
+			? "t_UNK"
+			: (a_type == t_REF)
+			  ? "t_REF"
+			  : (a_type == t_MSK)
+			    ? "t_MSK"
+			    : "???",
+			a_type);
 #endif
         freeaddrinfo(ptr);
 	return 1;


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