On Fri, Nov 16, 2007 at 01:13:42PM +0100, Otto Moerbeek wrote: > On Fri, Nov 16, 2007 at 12:40:29PM +0100, frantisek holop wrote: > > hmm, on Fri, Nov 16, 2007 at 12:30:00PM +0100, Toni Mueller said that > > > > could someone test this before i submit a bug report? > > > > > > I've removed the '-s' flag for this reason, although I would very much > > > prefer to have it in place in the case that I have net access. I don't > > > know whether it would be feasible for ntpd to see whether there's an > > > appropriate route, and whether the relevant interfaces are up. > > > > it definitely worked in 4.1 even with "-s". > > It is this commit, which manages to keep the outging buffer full. > > http://www.openbsd.org/cgi-bin/cvsweb/src/usr.sbin/ntpd/client.c.diff?r1=1.75&r2=1.76&f=h > > Reverting it makes the problem go away. > > Still thinking how to solve this. > > -Otto
This seems to work for me, -Otto Index: client.c =================================================================== RCS file: /cvs/src/usr.sbin/ntpd/client.c,v retrieving revision 1.76 diff -u -p -r1.76 client.c --- client.c 1 May 2007 07:40:45 -0000 1.76 +++ client.c 16 Nov 2007 12:37:25 -0000 @@ -123,7 +123,8 @@ client_query(struct ntp_peer *p) int tos = IPTOS_LOWDELAY; if (p->addr == NULL && client_nextaddr(p) == -1) { - set_next(p, scale_interval(INTERVAL_QUERY_AGGRESSIVE)); + set_next(p, MAX(SETTIME_TIMOUT, + scale_interval(INTERVAL_QUERY_AGGRESSIVE))); return (0); } @@ -140,8 +141,8 @@ client_query(struct ntp_peer *p) if (errno == ECONNREFUSED || errno == ENETUNREACH || errno == EHOSTUNREACH || errno == EADDRNOTAVAIL) { client_nextaddr(p); - set_next(p, - scale_interval(INTERVAL_QUERY_AGGRESSIVE)); + set_next(p, MAX(SETTIME_TIMOUT, + scale_interval(INTERVAL_QUERY_AGGRESSIVE))); return (-1); } else fatal("client_query connect"); Index: ntpd.c =================================================================== RCS file: /cvs/src/usr.sbin/ntpd/ntpd.c,v retrieving revision 1.52 diff -u -p -r1.52 ntpd.c --- ntpd.c 13 Sep 2007 20:34:12 -0000 1.52 +++ ntpd.c 16 Nov 2007 12:37:25 -0000 @@ -193,12 +193,24 @@ main(int argc, char *argv[]) fatal("daemon"); } - if (nfds > 0 && (pfd[PFD_PIPE].revents & POLLOUT)) - if (msgbuf_write(&ibuf->w) < 0) { + if (nfds > 0 && (pfd[PFD_PIPE].revents & POLLOUT)) { + int ret; + + if ((ret = msgbuf_write(&ibuf->w)) < 0) { log_warn("pipe write error (to child)"); quit = 1; } - + if (ret == 0 && lconf.settime) { + lconf.settime = 0; + timeout = INFTIM; + log_init(lconf.debug); + log_debug("could not send request, skipping" + "initial time setting"); + if (!lconf.debug) + if (daemon(1, 0)) + fatal("daemon"); + } + } if (nfds > 0 && pfd[PFD_PIPE].revents & POLLIN) { nfds--; if (dispatch_imsg(&lconf) == -1)