aboutsummaryrefslogtreecommitdiffstats
path: root/main/busybox/4005-ntpd-do-not-use-a-peer-more-than-once-say-if-two-pee.patch
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2016-05-27 10:09:59 +0300
committerTimo Teräs <timo.teras@iki.fi>2016-05-27 10:25:03 +0300
commite4c5349a4ab2851deaf7794ef9d469f4ec9f4ff2 (patch)
tree7c4c7ce499182fe53b49f17afecd886d448e3119 /main/busybox/4005-ntpd-do-not-use-a-peer-more-than-once-say-if-two-pee.patch
parent3737eae3be7c465f3b0ef9c5c87b2a21024fd19e (diff)
downloadaports-e4c5349a4ab2851deaf7794ef9d469f4ec9f4ff2.tar.bz2
aports-e4c5349a4ab2851deaf7794ef9d469f4ec9f4ff2.tar.xz
main/busybox: cherry-pick ntpd fixes from master and mailing list
Diffstat (limited to 'main/busybox/4005-ntpd-do-not-use-a-peer-more-than-once-say-if-two-pee.patch')
-rw-r--r--main/busybox/4005-ntpd-do-not-use-a-peer-more-than-once-say-if-two-pee.patch57
1 files changed, 57 insertions, 0 deletions
diff --git a/main/busybox/4005-ntpd-do-not-use-a-peer-more-than-once-say-if-two-pee.patch b/main/busybox/4005-ntpd-do-not-use-a-peer-more-than-once-say-if-two-pee.patch
new file mode 100644
index 0000000000..ccad842507
--- /dev/null
+++ b/main/busybox/4005-ntpd-do-not-use-a-peer-more-than-once-say-if-two-pee.patch
@@ -0,0 +1,57 @@
+From f37f28199f508f5fee44753d320f044a91e76e39 Mon Sep 17 00:00:00 2001
+From: Denys Vlasenko <vda.linux@googlemail.com>
+Date: Fri, 4 Mar 2016 07:06:53 +0100
+Subject: [PATCH 4005/4007] ntpd: do not use a peer more than once (say, if two
+ peers resolve to the same IP)
+
+function old new delta
+add_peers 98 166 +68
+
+Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
+---
+ networking/ntpd.c | 17 ++++++++++++++++-
+ 1 file changed, 16 insertions(+), 1 deletion(-)
+
+diff --git a/networking/ntpd.c b/networking/ntpd.c
+index 4695c33..517806e 100644
+--- a/networking/ntpd.c
++++ b/networking/ntpd.c
+@@ -727,7 +727,7 @@ reset_peer_stats(peer_t *p, double offset)
+
+ /* Used to set p->filter_datapoint[i].d_dispersion = MAXDISP
+ * and clear reachable bits, but this proved to be too agressive:
+- * after step (tested with suspinding laptop for ~30 secs),
++ * after step (tested with suspending laptop for ~30 secs),
+ * this caused all previous data to be considered invalid,
+ * making us needing to collect full ~8 datapoins per peer
+ * after step in order to start trusting them.
+@@ -766,11 +766,26 @@ reset_peer_stats(peer_t *p, double offset)
+ static void
+ add_peers(const char *s)
+ {
++ llist_t *item;
+ peer_t *p;
+
+ p = xzalloc(sizeof(*p));
+ p->p_lsa = xhost2sockaddr(s, 123);
+ p->p_dotted = xmalloc_sockaddr2dotted_noport(&p->p_lsa->u.sa);
++
++ /* Names like N.<country2chars>.pool.ntp.org are randomly resolved
++ * to a pool of machines. Sometimes different N's resolve to the same IP.
++ * It is not useful to have two peers with same IP. We skip duplicates.
++ */
++ for (item = G.ntp_peers; item != NULL; item = item->link) {
++ peer_t *pp = (peer_t *) item->data;
++ if (strcmp(p->p_dotted, pp->p_dotted) == 0) {
++ bb_error_msg("duplicate peer %s (%s)", s, p->p_dotted);
++ free(p);
++ return;
++ }
++ }
++
+ p->p_fd = -1;
+ p->p_xmt_msg.m_status = MODE_CLIENT | (NTP_VERSION << 3);
+ p->next_action_time = G.cur_time; /* = set_next(p, 0); */
+--
+2.8.3
+