[Git][NTPsec/ntpsec][master] Fix for Issue #437: Poor recovery from new network

Hal Murray gitlab at mg.gitlab.com
Tue Feb 13 05:38:50 UTC 2018


Hal Murray pushed to branch master at NTPsec / ntpsec


Commits:
f3870e27 by Hal Murray at 2018-02-12T21:35:38-08:00
Fix for Issue #437: Poor recovery from new network

I think it needs more work, but it at least tries now.

- - - - -


3 changed files:

- include/ntp_dns.h
- ntpd/ntp_io.c
- ntpd/ntp_proto.c


Changes:

=====================================
include/ntp_dns.h
=====================================
--- a/include/ntp_dns.h
+++ b/include/ntp_dns.h
@@ -19,4 +19,7 @@ extern void dns_take_server(struct peer*, sockaddr_u*);
 extern void dns_take_pool(struct peer*, sockaddr_u*);
 extern void dns_take_status(struct peer*, DNS_Status);
 
+/* New interface has appeared - try again */
+extern void dns_new_interface(void);
+
 #endif	/* GUARD_NTP_DNS_H */


=====================================
ntpd/ntp_io.c
=====================================
--- a/ntpd/ntp_io.c
+++ b/ntpd/ntp_io.c
@@ -1322,9 +1322,12 @@ interface_update(
 	if (!new_interface_found)
 		return;
 
+#ifdef ENABLE_DNS_LOOKUP
 #ifdef DEBUG
 	msyslog(LOG_DEBUG, "IO: new interface(s) found: waking up resolver");
 #endif
+	dns_new_interface();
+#endif
 }
 
 


=====================================
ntpd/ntp_proto.c
=====================================
--- a/ntpd/ntp_proto.c
+++ b/ntpd/ntp_proto.c
@@ -2518,7 +2518,7 @@ dns_take_pool(
 				current_time + POOL_SOLICIT_WINDOW + 1);
 	}
 
-	DPRINT(1, ("transmit: at %u %s->%s pool\n",
+	DPRINT(1, ("dns_take_pool: at %u %s->%s pool\n",
 		   current_time, latoa(lcladr), socktoa(rmtadr)));
 }
 
@@ -2569,6 +2569,22 @@ void dns_take_status(struct peer* peer, DNS_Status status) {
 	peer->hpoll = hpoll;
 	peer->nextdate = current_time + (1U << hpoll);
 }
+
+/*
+ * dns_new_interface
+ *   A new interface is now active
+ *   retry danging DNS lookups
+ */
+void dns_new_interface(void) {
+    struct peer *p;
+    for (p = peer_list; p != NULL; p = p->p_link) {
+	if ((p->cfg.flags & FLAG_DNS) || (p->cast_flags & MDF_POOL)) {
+	    p->hpoll = p->cfg.minpoll;
+	    transmit(p);   /* does all the work */
+	}
+    }
+}
+
 #endif /* ENABLE_DNS_LOOKUP */
 
 



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/f3870e271a33ffd16ac4bec222602b67a1ad570e

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/f3870e271a33ffd16ac4bec222602b67a1ad570e
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20180213/4e21bf54/attachment.html>


More information about the vc mailing list