[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

rpms/ntp/F-7 ntp-4.2.4p0-bcast.patch, NONE, 1.1 ntp-4.2.4p0-ifupdate.patch, NONE, 1.1 ntp-4.2.4p0-multilisten.patch, NONE, 1.1 ntp-4.2.4p0-retcode.patch, NONE, 1.1 ntp.spec, 1.66, 1.67 ntpd.init, 1.24, 1.25 ntp-4.2.4-revert452.patch, 1.1, NONE



Author: mlichvar

Update of /cvs/pkgs/rpms/ntp/F-7
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv1944

Modified Files:
	ntp.spec ntpd.init 
Added Files:
	ntp-4.2.4p0-bcast.patch ntp-4.2.4p0-ifupdate.patch 
	ntp-4.2.4p0-multilisten.patch ntp-4.2.4p0-retcode.patch 
Removed Files:
	ntp-4.2.4-revert452.patch 
Log Message:
- fix interface updates with -I or -L option (#240254)
- accept multiple -I options
- fix broadcast client/server to accept/allow sending
  broadcasts on 255.255.255.255 (#226958)
- fix return codes in init script (#240120)
- exit with nonzero code if ntpd -q did not set clock (#240134)
- drop revert452 patch, fixed in kernel 2.6.19
- make with _smp_mflags


ntp-4.2.4p0-bcast.patch:

--- NEW FILE ntp-4.2.4p0-bcast.patch ---
https://ntp.isc.org/bugs/show_bug.cgi?id=779
https://ntp.isc.org/bugs/show_bug.cgi?id=823

--- ntp-4.2.4p0/ntpd/ntp_peer.c.bcast	2006-12-28 13:03:31.000000000 +0100
+++ ntp-4.2.4p0/ntpd/ntp_peer.c	2007-05-22 14:37:22.000000000 +0200
@@ -696,7 +696,8 @@
 	 * as our (network) source address would be undefined and
 	 * crypto will not work without knowing the own transmit address
 	 */
-	if (interface != NULL && interface->flags & INT_WILDCARD)
+	if (interface != NULL && interface->flags & INT_WILDCARD &&
+			!(cast_flags & MDF_BCAST))
 		interface = NULL;
 
 	return interface;
--- ntp-4.2.4p0/ntpd/ntp_io.c.bcast	2007-05-22 14:29:19.000000000 +0200
+++ ntp-4.2.4p0/ntpd/ntp_io.c	2007-05-22 14:29:19.000000000 +0200
@@ -145,6 +145,8 @@
 
 volatile int disable_dynamic_updates;   /* when set to != 0 dynamic updates won't happen */
 
+static int pktinfo_status = 0;		/* is IP_PKTINFO on wildipv4 iface enabled? */
+
 #ifdef REFCLOCK
 /*
  * Refclock stuff.	We keep a chain of structures with data concerning
@@ -1530,6 +1532,18 @@
 	}
 }
 
+static void
+set_pktinfo(int flag)
+{
+	if (wildipv4 == NULL)
+		return;
+	if (setsockopt(wildipv4->fd, SOL_IP, IP_PKTINFO, &flag, sizeof (flag))) {
+		if (debug > 1)
+			printf("setsockopt(IP_PKTINFO) failed: %s\n", strerror(errno));
+	} else
+		pktinfo_status = flag;
+}
+
 /*
  * This is just a wrapper around an internal function so we can
  * make other changes as necessary later on
@@ -1935,6 +1949,7 @@
 #else
 	netsyslog(LOG_ERR, "io_setbclient: Broadcast Client disabled by build");
 #endif
+	set_pktinfo(1);
 }
 
 /*
@@ -1957,6 +1972,7 @@
 		    continue;
 		lstatus = socket_broadcast_disable(interf, &interf->sin);
 	}
+	set_pktinfo(0);
 }
 
 /*
@@ -2844,11 +2860,9 @@
 	GETSOCKNAME_SOCKLEN_TYPE fromlen;
 	int buflen;
 	register struct recvbuf *rb;
-#ifdef HAVE_TIMESTAMP
 	struct msghdr msghdr;
 	struct iovec iovec;
 	char control[TIMESTAMP_CTLMSGBUF_SIZE];	/* pick up control messages */
-#endif
 
 	/*
 	 * Get a buffer and read the frame.  If we
@@ -2859,7 +2873,7 @@
 
 	rb = get_free_recv_buffer();
 
-	if (rb == NULL || itf->ignore_packets == ISC_TRUE)
+	if (rb == NULL || (itf->ignore_packets == ISC_TRUE && !(pktinfo_status && itf == wildipv4)))
 	{
 		char buf[RX_BUFF_SIZE];
 		struct sockaddr_storage from;
@@ -2882,13 +2896,6 @@
 
 	fromlen = sizeof(struct sockaddr_storage);
 
-#ifndef HAVE_TIMESTAMP
-	rb->recv_length = recvfrom(fd,
-			  (char *)&rb->recv_space,
-			   sizeof(rb->recv_space), 0,
-			   (struct sockaddr *)&rb->recv_srcadr,
-			   &fromlen);
-#else
 	iovec.iov_base        = (void *)&rb->recv_space;
 	iovec.iov_len         = sizeof(rb->recv_space);
 	msghdr.msg_name       = (void *)&rb->recv_srcadr;
@@ -2899,7 +2906,6 @@
 	msghdr.msg_controllen = sizeof(control);
 	msghdr.msg_flags      = 0;
 	rb->recv_length       = recvmsg(fd, &msghdr, 0);
-#endif
 
 	if (rb->recv_length == 0|| (rb->recv_length == -1 && 
 	    (errno==EWOULDBLOCK
@@ -2919,6 +2925,34 @@
 		return (rb->recv_length);
 	}
 
+	if (pktinfo_status && itf->ignore_packets == ISC_TRUE && itf == wildipv4) {
+		/* check for broadcast on 255.255.255.255, exception allowed on wildipv4 */
+		struct cmsghdr *cmsg;
+		struct in_pktinfo *pktinfo = NULL;
+
+		if ((cmsg = CMSG_FIRSTHDR(&msghdr)))
+			do {
+				if (cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_PKTINFO)
+					pktinfo = (struct in_pktinfo *) CMSG_DATA(cmsg);
+			} while ((cmsg = CMSG_NXTHDR(&msghdr, cmsg)));
+		if (pktinfo && pktinfo->ipi_addr.s_addr == INADDR_BROADCAST) {
+#ifdef DEBUG
+			if (debug > 3) {
+				printf("INADDR_BROADCAST\n");
+			}
+#endif
+		} else {
+#ifdef DEBUG
+			if (debug > 3)
+				printf("%s on (%lu) fd=%d from %s\n", "ignore",
+						free_recvbuffs(), fd, stoa(&rb->recv_srcadr));
+#endif
+			packets_ignored++;
+			freerecvbuf(rb);
+			return (rb->recv_length);
+		}
+	}
+
 #ifdef DEBUG
 	if (debug > 2) {
 		if(rb->recv_srcadr.ss_family == AF_INET)
@@ -2940,9 +2974,7 @@
 	 */
 	rb->dstadr = itf;
 	rb->fd = fd;
-#ifdef HAVE_TIMESTAMP
 	ts = fetch_timestamp(rb, &msghdr, ts);  /* pick up a network time stamp if possible */
-#endif
 	rb->recv_time = ts;
 	rb->receiver = receive;
 

ntp-4.2.4p0-ifupdate.patch:

--- NEW FILE ntp-4.2.4p0-ifupdate.patch ---
--- ntp-4.2.4p0/ntpd/ntp_io.c.ifupdate	2007-01-30 12:02:37.000000000 +0100
+++ ntp-4.2.4p0/ntpd/ntp_io.c	2007-05-17 16:32:38.000000000 +0200
@@ -1243,7 +1243,9 @@
 		 * with the appropriate socket (our name space is
 		 * (ip-address) - NOT (interface name, ip-address))
 		 */
-		iface = getinterface(&interface.sin);
+		iface = find_addr_in_list(&interface.sin);
+		if (iface && iface->flags & INT_WILDCARD)
+			iface = NULL;
 		
 		if (iface && refresh_interface(iface)) 
 		{

ntp-4.2.4p0-multilisten.patch:

--- NEW FILE ntp-4.2.4p0-multilisten.patch ---
--- ntp-4.2.4p0/include/ntpd.h.multilisten	2007-05-17 19:26:58.000000000 +0200
+++ ntp-4.2.4p0/include/ntpd.h	2007-05-17 19:28:09.000000000 +0200
@@ -79,6 +79,8 @@
 extern  void	enable_multicast_if P((struct interface *, struct sockaddr_storage *));
 extern	void	interface_dump	 P((struct interface *));
 
+extern  void    add_specific_interface P((const char *));
+extern  void    init_specific_interface P((void));
 extern  void    interface_update P((interface_receiver_t, void *));
 extern	void	init_io 	P((void));
 extern	void	input_handler	P((l_fp *));
--- ntp-4.2.4p0/ntpd/ntp_io.c.multilisten	2007-05-17 19:26:58.000000000 +0200
+++ ntp-4.2.4p0/ntpd/ntp_io.c	2007-05-17 19:27:25.000000000 +0200
@@ -66,7 +66,15 @@
 #endif  /* IPv6 Support */
 
 extern int listen_to_virtual_ips;
-extern const char *specific_interface;
+
+/* interface names to listen on */
+struct specific_interface {
+	const char *name;
+	ISC_LINK(struct specific_interface) link;
+};
+
+ISC_LIST(struct specific_interface) specific_interface_list;
+
 
 #if defined(SO_TIMESTAMP) && defined(SCM_TIMESTAMP)
 #if defined(CMSG_FIRSTHDR)
@@ -921,11 +929,12 @@
 	/*
 	 * Check if the interface is specified
 	 */
-	if (specific_interface != NULL) {
-		if (strcasecmp(isc_if->name, specific_interface) == 0)
-			return (ISC_TRUE);
-		else
-			return (ISC_FALSE);
+	if (ISC_LIST_HEAD(specific_interface_list)) {
+		struct specific_interface *iface;
+		for (iface = ISC_LIST_HEAD(specific_interface_list); iface != NULL; iface = ISC_LIST_NEXT(iface, link))
+			if (strcasecmp(isc_if->name, iface->name) == 0)
+				return (ISC_TRUE);
+		return (ISC_FALSE);
 	}
 	else {
 		if (listen_to_virtual_ips == 0  && 
@@ -1037,6 +1046,23 @@
 #endif /* !OS_MISSES_SPECIFIC_ROUTE_UPDATES */
 }
 
+void
+add_specific_interface (const char *if_name)
+{
+	struct specific_interface *iface;
+
+	iface = (struct specific_interface *)emalloc(sizeof(struct specific_interface));
+	iface->name = if_name;
+	ISC_LINK_INIT(iface, link);
+	ISC_LIST_APPEND(specific_interface_list, iface, link);
+}
+
+void
+init_specific_interface (void)
+{
+	ISC_LIST_INIT(specific_interface_list);
+}
+
 /*
  * interface_update - externally callable update function
  */
--- ntp-4.2.4p0/ntpd/cmd_args.c.multilisten	2006-12-28 13:03:26.000000000 +0100
+++ ntp-4.2.4p0/ntpd/cmd_args.c	2007-05-17 19:29:04.000000000 +0200
@@ -22,7 +22,6 @@
  * Definitions of things either imported from or exported to outside
  */
 extern char const *progname;
-extern const char *specific_interface;
 extern int default_ai_family;
 
 #ifdef HAVE_NETINFO
--- ntp-4.2.4p0/ntpd/ntpd.c.multilisten	2007-05-17 19:26:58.000000000 +0200
+++ ntp-4.2.4p0/ntpd/ntpd.c	2007-05-17 19:27:25.000000000 +0200
@@ -156,7 +156,6 @@
 #endif
 
 int	listen_to_virtual_ips = 1;
-const char *specific_interface = NULL;        /* interface name or IP address to bind to */
 
 /*
  * No-fork flag.  If set, we do not become a background daemon.
@@ -539,18 +538,14 @@
 	if (HAVE_OPT( NOVIRTUALIPS ))
 		listen_to_virtual_ips = 0;
 
+	init_specific_interface();
+
 	if (HAVE_OPT( INTERFACE )) {
-#if 0
 		int	ifacect = STACKCT_OPT( INTERFACE );
-		char**	ifaces  = STACKLST_OPT( INTERFACE );
+		const char** ifaces  = STACKLST_OPT( INTERFACE );
 
-		/* malloc space for the array of names */
-		while (ifacect-- > 0) {
-			next_iface = *ifaces++;
-		}
-#else
-		specific_interface = OPT_ARG( INTERFACE );
-#endif
+		while (ifacect-- > 0)
+			add_specific_interface(*ifaces++);
 	}
 
 	if (HAVE_OPT( NICE ))

ntp-4.2.4p0-retcode.patch:

--- NEW FILE ntp-4.2.4p0-retcode.patch ---
https://ntp.isc.org/bugs/show_bug.cgi?id=759

--- ntp-4.2.4p0/ntpd/ntp_proto.c.retcode	2006-12-28 13:03:32.000000000 +0100
+++ ntp-4.2.4p0/ntpd/ntp_proto.c	2007-05-22 15:20:07.000000000 +0200
@@ -303,7 +303,7 @@
 				if (peer_ntpdate == 0) {
 					msyslog(LOG_NOTICE,
 					    "no reply; clock not set");
-					exit (0);
+					exit (1);
 				}
 			}
 		}


Index: ntp.spec
===================================================================
RCS file: /cvs/pkgs/rpms/ntp/F-7/ntp.spec,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- ntp.spec	9 May 2007 16:45:01 -0000	1.66
+++ ntp.spec	22 May 2007 15:30:33 -0000	1.67
@@ -3,7 +3,7 @@
 Summary: Synchronizes system time using the Network Time Protocol (NTP)
 Name: ntp
 Version: 4.2.4p0
-Release: 2%{?dist}
+Release: 3%{?dist}
 License: distributable
 Group: System Environment/Daemons
 Source0: http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-%{version}.tar.gz
@@ -21,7 +21,8 @@
 Patch3: ntp-4.2.4-groups.patch
 Patch4: ntp-4.1.1c-rc3-authkey.patch
 Patch5: ntp-4.2.4-linkfastmath.patch
-Patch7: ntp-4.2.4-revert452.patch
+Patch6: ntp-4.2.4p0-ifupdate.patch
+Patch8: ntp-4.2.4p0-multilisten.patch
 Patch9: ntp-4.2.4-html2man.patch
 Patch10: ntp-4.2.4-htmldoc.patch
 Patch11: ntp-stable-4.2.0a-20050816-keyfile.patch
@@ -29,6 +30,8 @@
 Patch13: ntp-4.2.4-autoopts.patch
 Patch14: ntp-4.2.4p0-mlock.patch
 Patch17: ntp-4.2.4p0-sleep.patch
+Patch18: ntp-4.2.4p0-bcast.patch
+Patch19: ntp-4.2.4p0-retcode.patch
 
 URL: http://www.ntp.org
 Requires(pre): shadow-utils 
@@ -56,7 +59,8 @@
 %patch2 -p1 -b .droproot
 %patch3 -p1 -b .groups
 %patch4 -p1 -b .authkey
-%patch7 -p1 -b .revert452
+%patch6 -p1 -b .ifupdate
+%patch8 -p1 -b .multilisten
 %patch9 -p1 -b .html2man
 %patch10 -p1 -b .htmldoc
 %patch11 -p1 -b .keyfile
@@ -64,6 +68,8 @@
 %patch13 -p1 -b .autoopts
 %patch14 -p1 -b .mlock
 %patch17 -p1 -b .sleep
+%patch18 -p1 -b .bcast
+%patch19 -p1 -b .retcode
 
 %ifarch ia64
 %patch5 -p1 -b .linkfastmath
@@ -80,7 +86,7 @@
 	--with-openssl-libdir=%{_libdir} \
 	--enable-all-clocks --enable-parse-clocks \
 	--enable-linuxcaps
-make
+make %{?_smp_mflags}
 
 sed -i 's|$ntpq = "ntpq"|$ntpq = "%{_sbindir}/ntpq"|' scripts/ntptrace
 
@@ -176,6 +182,16 @@
 
 
 %changelog
+* Tue May 22 2007 Miroslav Lichvar <mlichvar redhat com> 4.2.4p0-3
+- fix interface updates with -I or -L option (#240254)
+- accept multiple -I options
+- fix broadcast client/server to accept/allow sending
+  broadcasts on 255.255.255.255 (#226958)
+- fix return codes in init script (#240120)
+- exit with nonzero code if ntpd -q did not set clock (#240134)
+- drop revert452 patch, fixed in kernel 2.6.19
+- make with _smp_mflags
+
 * Wed May 09 2007 Miroslav Lichvar <mlichvar redhat com> 4.2.4p0-2
 - compile with crypto support on 64bit architectures (#239576)
 - update sleep patch


Index: ntpd.init
===================================================================
RCS file: /cvs/pkgs/rpms/ntp/F-7/ntpd.init,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- ntpd.init	7 Mar 2007 18:35:41 -0000	1.24
+++ ntpd.init	22 May 2007 15:30:33 -0000	1.25
@@ -15,9 +15,6 @@
 # Source networking configuration.
 . /etc/sysconfig/network
 
-# Check that networking is up.
-[ ${NETWORKING} = "no" ] && exit 0
-
 if [ -f /etc/sysconfig/ntpd ];then
         . /etc/sysconfig/ntpd
 fi
@@ -92,6 +89,9 @@
 }
 
 start() {
+	# Check that networking is up.
+	[ "$NETWORKING" = "no" ] && exit 1
+
 	readconf;
 
 	if [ -n "$dostep" ]; then
@@ -154,7 +154,7 @@
 	;;
   *)
         echo $"Usage: $0 {start|stop|restart|condrestart|status}"
-        exit 1
+        RETVAL=3
 esac
 
 exit $RETVAL


--- ntp-4.2.4-revert452.patch DELETED ---


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]