summaryrefslogtreecommitdiffstats
path: root/package/utils/busybox/patches/230-ntpd_delayed_resolve.patch
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2014-05-25 17:42:09 +0000
committerFelix Fietkau <nbd@openwrt.org>2014-05-25 17:42:09 +0000
commitf4f553efa787e1f8f25bb2176f5e6c4c3aa659a9 (patch)
tree310f556f4a68661a07ada2d87790ff02796c941a /package/utils/busybox/patches/230-ntpd_delayed_resolve.patch
parenta54791f2baa2e193b5197b754f0b6b29d86d656e (diff)
downloadmaster-31e0f0ae-f4f553efa787e1f8f25bb2176f5e6c4c3aa659a9.tar.gz
master-31e0f0ae-f4f553efa787e1f8f25bb2176f5e6c4c3aa659a9.tar.bz2
master-31e0f0ae-f4f553efa787e1f8f25bb2176f5e6c4c3aa659a9.zip
busybox: update to 1.22.1
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 40852
Diffstat (limited to 'package/utils/busybox/patches/230-ntpd_delayed_resolve.patch')
-rw-r--r--package/utils/busybox/patches/230-ntpd_delayed_resolve.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/package/utils/busybox/patches/230-ntpd_delayed_resolve.patch b/package/utils/busybox/patches/230-ntpd_delayed_resolve.patch
new file mode 100644
index 0000000000..d46a0e3f24
--- /dev/null
+++ b/package/utils/busybox/patches/230-ntpd_delayed_resolve.patch
@@ -0,0 +1,48 @@
+--- a/networking/ntpd.c
++++ b/networking/ntpd.c
+@@ -238,6 +238,7 @@ typedef struct {
+ typedef struct {
+ len_and_sockaddr *p_lsa;
+ char *p_dotted;
++ char *p_hostname;
+ int p_fd;
+ int datapoint_idx;
+ uint32_t lastpkt_refid;
+@@ -738,8 +739,9 @@ add_peers(char *s)
+ peer_t *p;
+
+ p = xzalloc(sizeof(*p));
+- p->p_lsa = xhost2sockaddr(s, 123);
+- p->p_dotted = xmalloc_sockaddr2dotted_noport(&p->p_lsa->u.sa);
++ p->p_hostname = s;
++ p->p_lsa = NULL;
++ p->p_dotted = NULL;
+ 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); */
+@@ -788,6 +790,25 @@ send_query_to_peer(peer_t *p)
+ *
+ * Uncomment this and use strace to see it in action:
+ */
++
++ /* See if the peer hostname already resolved yet, if not, retry to resolv and return on failure */
++ if (!p->p_lsa)
++ {
++ p->p_lsa = host2sockaddr(p->p_hostname, 123);
++
++ if (p->p_lsa)
++ {
++ p->p_dotted = xmalloc_sockaddr2dotted_noport(&p->p_lsa->u.sa);
++ VERB1 bb_error_msg("resolved peer %s to %s", p->p_hostname, p->p_dotted);
++ }
++ else
++ {
++ set_next(p, RETRY_INTERVAL);
++ VERB1 bb_error_msg("could not resolve peer %s, skipping", p->p_hostname);
++ return;
++ }
++ }
++
+ #define PROBE_LOCAL_ADDR /* { len_and_sockaddr lsa; lsa.len = LSA_SIZEOF_SA; getsockname(p->query.fd, &lsa.u.sa, &lsa.len); } */
+
+ if (p->p_fd == -1) {