diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-12-03 00:20:58 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-12-03 00:20:58 +0100 |
commit | 6a110c969f357d5ab3503660c6404a1ee9d916eb (patch) | |
tree | 1b340877fc1ff3d8ae26e8709e84f05eb87782b9 /networking | |
parent | 7cb1d6ccf36eccb294bd26e1c6da6866e7fc0ab7 (diff) | |
download | busybox-6a110c969f357d5ab3503660c6404a1ee9d916eb.tar.gz |
ntpd: remove dynamic dns resolution code, too complex. -69 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking')
-rw-r--r-- | networking/ntpd.c | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/networking/ntpd.c b/networking/ntpd.c index 375f009a6..ca79e0338 100644 --- a/networking/ntpd.c +++ b/networking/ntpd.c @@ -108,7 +108,6 @@ typedef struct { #define OFFSET_ARRAY_SIZE 8 typedef struct { len_and_sockaddr *lsa; - char *hostname; char *dotted; /* When to send new query (if fd == -1) * or when receive times out (if fd >= 0): */ @@ -166,24 +165,14 @@ set_next(ntp_peer_t *p, unsigned t) p->next_action_time = time(NULL) + t; } -static len_and_sockaddr* -resolve_hostname(ntp_peer_t *p) -{ - p->lsa = host2sockaddr(p->hostname, 123); - if (p->lsa) - p->dotted = xmalloc_sockaddr2dotted_noport(&p->lsa->u.sa); - return p->lsa; -} - static void add_peers(char *s) { ntp_peer_t *p; p = xzalloc(sizeof(*p)); - p->hostname = s; - p->dotted = s; - resolve_hostname(p); + p->lsa = xhost2sockaddr(s, 123); + p->dotted = xmalloc_sockaddr2dotted_noport(&p->lsa->u.sa); p->fd = -1; p->msg.m_status = MODE_CLIENT | (NTP_VERSION << 3); p->trustlevel = TRUSTLEVEL_PATHETIC; @@ -307,15 +296,6 @@ send_query_to_peer(ntp_peer_t *p) int fd, family; len_and_sockaddr *local_lsa; -//TODO: big ntpd uses all IPs, not just 1st, do we need to mimic that? -//TODO: periodically re-resolve DNS names? - if (!p->lsa) { - if (!resolve_hostname(p)) { - set_next(p, INTERVAL_QUERY_PATHETIC); - return -1; - } - } - family = p->lsa->u.sa.sa_family; p->fd = fd = xsocket_type(&local_lsa, family, SOCK_DGRAM); /* local_lsa has "null" address and port 0 now. |