Hi,

I was using the busybox implementation of ntpd, and I noticed
something I found odd.  If I list multiple peers on the command line,
and any one of those peers fails name resolution, ntpd immediately
quits.  It seems to me that ntpd should not quit if we get a
successful name resolution for at least one of the peers.  I've
attached a patch to change this behavior, and I hope you'll consider
it for the next busybox release.

Thank you,
-Justin
--- a/networking/ntpd.c	2010-10-09 12:57:14.000000000 -0700
+++ b/networking/ntpd.c	2010-11-18 17:29:05.000000000 -0800
@@ -629,7 +629,11 @@ add_peers(char *s)
 	peer_t *p;
 
 	p = xzalloc(sizeof(*p));
-	p->p_lsa = xhost2sockaddr(s, 123);
+	p->p_lsa = host2sockaddr(s, 123);
+	if (!p->p_lsa) {
+		free(p);
+		return;
+	}
 	p->p_dotted = xmalloc_sockaddr2dotted_noport(&p->p_lsa->u.sa);
 	p->p_fd = -1;
 	p->p_xmt_msg.m_status = MODE_CLIENT | (NTP_VERSION << 3);
@@ -1905,6 +1909,8 @@ static NOINLINE void ntp_init(char **arg
 //		G.time_was_stepped = 1;
 	while (peers)
 		add_peers(llist_pop(&peers));
+	if (!G.ntp_peers)
+		xfunc_die();
 	if (!(opts & OPT_n)) {
 		bb_daemonize_or_rexec(DAEMON_DEVNULL_STDIO, argv);
 		logmode = LOGMODE_NONE;
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to