diff options
author | jow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2011-11-07 01:45:04 +0000 |
---|---|---|
committer | jow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2011-11-07 01:45:04 +0000 |
commit | 6f3973eee4a1005c3fc1966469d79034c7197250 (patch) | |
tree | 40113ee06e7f67f2692abd63e1f9d86f9123ed23 /package/busybox | |
parent | 0920594b94d2449dbef5c95ea3fea1b193195286 (diff) |
[package] busybox: ntpd: indefinitely try to resolve peer addresses (#10361)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@28794 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/busybox')
-rw-r--r-- | package/busybox/Makefile | 2 | ||||
-rw-r--r-- | package/busybox/patches/610-ntpd_delayed_resolve.patch | 48 |
2 files changed, 49 insertions, 1 deletions
diff --git a/package/busybox/Makefile b/package/busybox/Makefile index ac4218f29..a5f154820 100644 --- a/package/busybox/Makefile +++ b/package/busybox/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=busybox PKG_VERSION:=1.19.3 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_FLAGS:=essential PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 diff --git a/package/busybox/patches/610-ntpd_delayed_resolve.patch b/package/busybox/patches/610-ntpd_delayed_resolve.patch new file mode 100644 index 000000000..5e17ae16c --- /dev/null +++ b/package/busybox/patches/610-ntpd_delayed_resolve.patch @@ -0,0 +1,48 @@ +--- a/networking/ntpd.c ++++ b/networking/ntpd.c +@@ -216,6 +216,7 @@ typedef struct { + typedef struct { + len_and_sockaddr *p_lsa; + char *p_dotted; ++ char *p_hostname; + /* when to send new query (if p_fd == -1) + * or when receive times out (if p_fd >= 0): */ + int p_fd; +@@ -646,8 +647,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); */ +@@ -696,6 +698,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) { |