[ntp] refresh peers on routing updates (#1028176)

Miroslav Lichvar mlichvar at fedoraproject.org
Mon Dec 9 16:14:25 UTC 2013


commit 31db72698e599879a04bfc0b4aeed4e46789dafa
Author: Miroslav Lichvar <mlichvar at redhat.com>
Date:   Mon Dec 9 14:27:23 2013 +0100

    refresh peers on routing updates (#1028176)

 ntp-4.2.6p4-rtnetlink.patch    |   15 -----
 ntp-4.2.6p5-refreshroute.patch |  111 ++++++++++++++++++++++++++++++++++++++++
 ntp.spec                       |    6 +-
 3 files changed, 114 insertions(+), 18 deletions(-)
---
diff --git a/ntp-4.2.6p5-refreshroute.patch b/ntp-4.2.6p5-refreshroute.patch
new file mode 100644
index 0000000..d8737e2
--- /dev/null
+++ b/ntp-4.2.6p5-refreshroute.patch
@@ -0,0 +1,111 @@
+Backported from ntp-dev-4.2.7p399
+
+diff -up ntp-4.2.6p5/ntpd/ntp_io.c.refreshroute ntp-4.2.6p5/ntpd/ntp_io.c
+--- ntp-4.2.6p5/ntpd/ntp_io.c.refreshroute	2013-10-17 13:48:34.808727175 +0200
++++ ntp-4.2.6p5/ntpd/ntp_io.c	2013-12-09 14:02:28.076249785 +0100
+@@ -1785,7 +1785,6 @@ update_interfaces(
+ 	isc_result_t		result;
+ 	isc_interface_t		isc_if;
+ 	int			new_interface_found;
+-	int			refresh_peers;
+ 	unsigned int		family;
+ 	endpt			enumep;
+ 	endpt *			ep;
+@@ -1800,7 +1799,6 @@ update_interfaces(
+ 	 */
+ 
+ 	new_interface_found = FALSE;
+-	refresh_peers = FALSE;
+ 	iter = NULL;
+ 	result = isc_interfaceiter_create(mctx, &iter);
+ 
+@@ -1836,6 +1834,8 @@ update_interfaces(
+ 
+ 		convert_isc_if(&isc_if, &enumep, port);
+ 
++		DPRINT_INTERFACE(4, (&enumep, "examining ", "\n"));
++
+ 		/* 
+ 		 * Check if and how we are going to use the interface.
+ 		 */
+@@ -1843,19 +1843,23 @@ update_interfaces(
+ 					 enumep.flags)) {
+ 
+ 		case ACTION_IGNORE:
++			DPRINTF(4, ("ignoring interface %s (%s) - by nic rules\n",
++				    enumep.name, stoa(&enumep.sin)));
+ 			continue;
+ 
+ 		case ACTION_LISTEN:
++			DPRINTF(4, ("listen interface %s (%s) - by nic rules\n",
++				    enumep.name, stoa(&enumep.sin)));
+ 			enumep.ignore_packets = ISC_FALSE;
+ 			break;
+ 
+ 		case ACTION_DROP:
++			DPRINTF(4, ("drop on interface %s (%s) - by nic rules\n",
++				    enumep.name, stoa(&enumep.sin)));
+ 			enumep.ignore_packets = ISC_TRUE;
+ 			break;
+ 		}
+ 
+-		DPRINT_INTERFACE(4, (&enumep, "examining ", "\n"));
+-
+ 		 /* interfaces must be UP to be usable */
+ 		if (!(enumep.flags & INT_UP)) {
+ 			DPRINTF(4, ("skipping interface %s (%s) - DOWN\n",
+@@ -1898,15 +1902,8 @@ update_interfaces(
+ 				 */
+ 				strncpy(ep->name, enumep.name,
+ 					sizeof(ep->name));
+-				if (ep->ignore_packets !=
+-				    enumep.ignore_packets) {
+-					ep->ignore_packets = 
++				ep->ignore_packets = 
+ 					    enumep.ignore_packets;
+-					refresh_peers = TRUE;
+-					DPRINTF(4, ("refreshing peers due to %s ignore_packets change to %d\n",
+-					    stoa(&ep->sin),
+-					    ep->ignore_packets));
+-				}
+ 			} else {
+ 				/* name collision - rename interface */
+ 				strncpy(ep->name, "*multiple*",
+@@ -1971,9 +1968,6 @@ update_interfaces(
+ 					(*receiver)(data, &ifi);
+ 
+ 				new_interface_found = TRUE;
+-				refresh_peers = TRUE;
+-				DPRINTF(4, ("refreshing peers due to new addr %s\n",
+-					stoa(&ep->sin)));
+ 				DPRINT_INTERFACE(3,
+ 					(ep, "updating ",
+ 					 " new - created\n"));
+@@ -2013,9 +2007,6 @@ update_interfaces(
+ 		DPRINT_INTERFACE(3, (ep, "updating ",
+ 				     "GONE - deleting\n"));
+ 		remove_interface(ep);
+-		refresh_peers = TRUE;
+-		DPRINTF(4, ("refreshing peers due to deleted addr %s",
+-			    stoa(&ep->sin)));
+ 
+ 		ifi.action = IFS_DELETED;
+ 		ifi.ep = ep;
+@@ -2037,12 +2028,12 @@ update_interfaces(
+ 	}
+ 
+ 	/*
+-	 * phase 3 - re-configure as the world has changed if necessary
++	 * phase 3 - re-configure as the world has possibly changed
++	 *
++	 * never ever make this conditional again - it is needed to track
++	 * routing updates. see bug #2506
+ 	 */
+-	if (refresh_peers) {
+-		refresh_all_peerinterfaces();
+-		msyslog(LOG_INFO, "peers refreshed");
+-	}
++	refresh_all_peerinterfaces();
+ 
+ 	if (sys_bclient)
+ 		io_setbclient();
diff --git a/ntp.spec b/ntp.spec
index 595b957..cc07ca4 100644
--- a/ntp.spec
+++ b/ntp.spec
@@ -61,8 +61,6 @@ Patch5: ntp-4.2.6p1-linkfastmath.patch
 Patch6: ntp-4.2.6p5-fipsmd5.patch
 # ntpbz #759
 Patch7: ntp-4.2.6p1-retcode.patch
-# ntpbz #992
-Patch8: ntp-4.2.6p4-rtnetlink.patch
 # ntpbz #2309
 Patch9: ntp-4.2.6p5-hexpw.patch
 # ntpbz #898
@@ -75,6 +73,8 @@ Patch12: ntp-4.2.4p7-getprecision.patch
 Patch13: ntp-4.2.6p1-logdefault.patch
 # add option -m to lock memory
 Patch14: ntp-4.2.6p5-mlock.patch
+# ntpbz #2506
+Patch15: ntp-4.2.6p5-refreshroute.patch
 # ntpbz #2040
 Patch16: ntp-4.2.6p5-identlen.patch
 # ntpbz #1670
@@ -180,13 +180,13 @@ This package contains NTP documentation in HTML format.
 %endif
 %patch6 -p1 -b .fipsmd5
 %patch7 -p1 -b .retcode
-%patch8 -p1 -b .rtnetlink
 %patch9 -p1 -b .hexpw
 %patch10 -p1 -b .htmldoc
 %patch11 -p1 -b .updatebclient
 %patch12 -p1 -b .getprecision
 %patch13 -p1 -b .logdefault
 %patch14 -p1 -b .mlock
+%patch15 -p1 -b .refreshroute
 %patch16 -p1 -b .identlen
 %patch17 -p1 -b .broadcastdelay
 %patch18 -p1 -b .delaycalib


More information about the scm-commits mailing list