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

Harlan Stenn stenn at whimsy.udel.edu
Thu Oct 25 05:21:45 UTC 2007


#### ChangeSet ####
2007-10-25 01:14:55-04:00, stenn at whimsy.udel.edu 
  [Bug 752] Update the QoS tagging (code only - configuration to follow)

==== ChangeLog ====
2007-10-25 01:13:41-04:00, stenn at whimsy.udel.edu +1 -0
  [Bug 752] Update the QoS tagging (code only - configuration to follow)

--- 1.133/ChangeLog	2007-10-24 22:42:25 -04:00
+++ 1.134/ChangeLog	2007-10-25 01:13:41 -04:00
@@ -1,3 +1,4 @@
+* [Bug 752] Update the QoS tagging (code only - configuration to follow).
 * Orphan mode and other protocol cleanup from Dave Mills.
 * Documentation cleanup from Dave Mills.
 * [Bug 940] ntp-keygen uses -v.  Disallow it as a shortcut for --version.

==== configure.ac ====
2007-10-25 01:14:18-04:00, stenn at whimsy.udel.edu +18 -0
  [Bug 752] Update the QoS tagging (code only - configuration to follow)

--- 1.408/configure.ac	2007-10-15 04:43:03 -04:00
+++ 1.409/configure.ac	2007-10-25 01:14:18 -04:00
@@ -424,6 +424,24 @@ AC_CHECK_HEADERS(netinet/ip.h, [], [],
 #include <netinet/in_systm.h>
 #endif
 ])
+
+# Check for IPTOS_PREC
+AC_MSG_CHECKING(IPPROTO_IP IP_TOS IPTOS_LOWDELAY)
+AC_EGREP_CPP(yes,
+    [#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#if HAVE_NETINET_IP_H
+#include <netinet/in.h>
+#include <netinet/ip.h>
+#endif
+#if defined(IPPROTO_IP) && defined(IP_TOS) && defined(IPTOS_LOWDELAY)
+  yes
+#endif
+    ],
+    [AC_MSG_RESULT([yes]); AC_DEFINE(HAVE_IPTOS_SUPPORT, 1, [Do we have IPTOS support?])],
+    [AC_MSG_RESULT([no])])
+
 AC_CHECK_HEADERS(netinfo/ni.h, [AC_DEFINE(HAVE_NETINFO, 1, [NetInfo support?])])
 AC_CHECK_HEADERS(sun/audioio.h sys/audioio.h)
 dnl AC_CHECK_HEADERS(sys/chudefs.h)

==== include/ntp_io.h ====
2007-10-25 01:14:20-04:00, stenn at whimsy.udel.edu +6 -0
  [Bug 752] Update the QoS tagging (code only - configuration to follow)

--- 1.7/include/ntp_io.h	2007-10-07 12:26:20 -04:00
+++ 1.8/include/ntp_io.h	2007-10-25 01:14:20 -04:00
@@ -32,6 +32,12 @@
 
 #include <isc/boolean.h>
 #include <isc/netaddr.h>
+
+#if HAVE_NETINET_IN_H && HAVE_NETINET_IP_H
+#include <netinet/in.h>
+#include <netinet/ip.h>
+#endif
+
 /*
  * Define FNDELAY and FASYNC using O_NONBLOCK and O_ASYNC if we need
  * to (and can).  This is here initially for QNX, but may help for

==== ntpd/ntp_io.c ====
2007-10-25 01:14:20-04:00, stenn at whimsy.udel.edu +18 -14
  [Bug 752] Update the QoS tagging (code only - configuration to follow)

--- 1.263/ntpd/ntp_io.c	2007-10-07 12:26:20 -04:00
+++ 1.264/ntpd/ntp_io.c	2007-10-25 01:14:20 -04:00
@@ -169,6 +169,14 @@ volatile int disable_dynamic_updates;   
 static	struct refclockio *refio;
 #endif /* REFCLOCK */
 
+#if defined(HAVE_IPTOS_SUPPORT)
+/* set IP_TOS to minimize packet delay */
+# if defined(IPTOS_PREC_INTERNETCONTROL)
+const int tos = IPTOS_PREC_INTERNETCONTROL;
+# else
+const int tos = IPTOS_LOWDELAY;
+# endif
+#endif
 
 /*
  * Define what the possible "soft" errors can be.  These are non-fatal returns
@@ -2450,9 +2458,6 @@ open_socket(
 	SOCKET fd;
 	int on = 1, off = 0;	/* int is OK for REUSEADR per */
 				/* http://www.kohala.com/start/mcast.api.txt */
-#if defined(IPTOS_LOWDELAY) && defined(IPPROTO_IP) && defined(IP_TOS)
-	int tos;
-#endif /* IPTOS_LOWDELAY && IPPROTO_IP && IP_TOS */
 
 	if ((addr->ss_family == AF_INET6) && (isc_net_probeipv6() != ISC_R_SUCCESS))
 		return (INVALID_SOCKET);
@@ -2515,17 +2520,16 @@ open_socket(
 	 * IPv4 specific options go here
 	 */
 	if (addr->ss_family == AF_INET) {
-#if defined(IPTOS_LOWDELAY) && defined(IPPROTO_IP) && defined(IP_TOS)
-	/* set IP_TOS to minimize packet delay */
-		tos = IPTOS_LOWDELAY;
-		if (setsockopt(fd, IPPROTO_IP, IP_TOS, (char *) &tos, sizeof(tos)) < 0)
-		{
-			netsyslog(LOG_ERR, "setsockopt IPTOS_LOWDELAY on fails on address %s: %m",
-				stoa(addr));
-		}
-#endif /* IPTOS_LOWDELAY && IPPROTO_IP && IP_TOS */
-	if ((flags & INT_BROADCAST))
-		socket_broadcast_enable(interf, fd, addr);
+#if defined(HAVE_IPTOS_SUPPORT)
+		if (setsockopt(fd, IPPROTO_IP, IP_TOS, (char *) &tos,
+		    sizeof(tos)) < 0) {
+			netsyslog(LOG_ERR,
+			    "setsockopt IP_TOS (%02x) fails on address %s: %m",
+			    tos, stoa(addr));
+  		}
+#endif /* HAVE_IPTOS_SUPPORT */
+		if ((flags & INT_BROADCAST))
+			socket_broadcast_enable(interf, fd, addr);
 	}
 
 	/*


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