summaryrefslogtreecommitdiff
path: root/usr.sbin/ntpd/client.c
AgeCommit message (Collapse)Author
2005-02-21fix an error messageHenning Brauer
2005-02-03Implement simple duplicate suppression of peer errors; ok henning@Darren Tucker
2005-01-28Simplify interval scaling and randomize query intervals; ok henning@Darren Tucker
2005-01-28Make network unreachable errors non-fatal; ok henning@Darren Tucker
2005-01-27Scale query interval by the overall offset not per-peer offset, so weDarren Tucker
don't query outliers more often than any other server. ok henning@
2005-01-27Delay before retrying a query on timeout; ok henning@Darren Tucker
2004-12-15Poll unsynchronized servers at the maximum interval and log a message aboutDarren Tucker
them when in debug mode; ok henning@
2004-12-15Factor out interval scaling code; ok henning@Darren Tucker
2004-12-14If polling a server results in an error, drop that server to the maximumDarren Tucker
poll interval; ok henning@
2004-12-13Discard replies with alarm flag set or invalid stratum; ok henning@Darren Tucker
2004-12-09define TRUSTLEVEL_MAX for the trustedlevel value of 10; henning@ okMichael Shalayeff
2004-12-08uniquely name members of s_fixedpt and l_fixedpt; henning@ okMichael Shalayeff
2004-11-10ntp_adjtime() -> priv_adjtime()Henning Brauer
ntp_settime() -> priv_settime() ntp_host_dns() -> priv_host_dns()
2004-11-05Use SA_LEN() instead of ss.ss_len. Evaluates to the same result but it'sDarren Tucker
easier on portable. ok henning@
2004-10-22in server mode reply with stratum from the peer that we currently preferHenning Brauer
plus one
2004-10-15Only set IPTOS_LOWDELAY on IPv4 interfaces; pointed out by phessler, ok henningDarren Tucker
2004-10-14Have ntpd use IPTOS_LOWDELAY; ok henning@Darren Tucker
2004-10-13in struct ntp_msg, rename "distance" to "rootdelay" to closer match RFCsHenning Brauer
and such
2004-10-13thinko, htonl() -> ntohl(). as we don't use the value in question effect zeroHenning Brauer
2004-10-08whitespace both in comment; from berndHenning Brauer
2004-10-05in client_addr_init() and client_nextaddr(), do not set up the socket andHenning Brauer
connect it, instead leave it at -1. in client_query, set up and connect the socket if it is -1. and, the real reason for this change: handle connect failures gracefully ok otto
2004-09-30now that we connect() the client sockets we need to handle ECONNREFUSED asHenning Brauer
non-fatal too, from camield@
2004-09-24connect() the client-side sockets. idea & test & ok camield@Henning Brauer
2004-09-18add a new -s option, that tells ntpd to set the time using settimeofday()Henning Brauer
once at startup. ntpd delays daemonizing until it has done the intial time setting (or ran into the timeout) in this mode to make sure stuff started later in rc is not subject to time jumps. this eleminates the need to run rdate -n beforehands. with some input from & ok ryan and bob, march music from mickey
2004-09-14paranoia: reset query->fd to -1 after close, from canacar some time agoHenning Brauer
2004-08-16Be more careful setting next and deadline, they should not both be != 0Otto Moerbeek
at the same time. ok henning@
2004-08-13Reset deadline on failed transmit. Avoids a spinning process ifOtto Moerbeek
all sends fail. ok henning@
2004-08-12do not try to getaddrinfo() in the unprivileged process, send an imsgHenning Brauer
asking the privileged one to do it. sends back an imsg with the resulting addresses in a bunch of struct sockaddr_storage in the data part. this should fix all remaining issues with dns (non-)availability at ntpd startup, be it due to named on localhost or something else. tested by marco@ and Chris Paul <chris.paul@sentinare.com>
2004-07-28when a dns lookup fails at parse time, do not abort but try againHenning Brauer
to resolve the hostname every 60 seconds fixes ntpd invocations before e. g. a dialup link is established and such. as we want ntpd to be a "fire and forget" background daemon it should cope with such situations. tested by many
2004-07-20wrap the heads for the linked list of addresses into a new ntp_addr_wrapHenning Brauer
which, besides the head pointer for the list of course, stores the original address as specified (i. e. as hostname instead of resolved IPs) and flags and such.
2004-07-18there are a few recvfrom(2) errors we do not want to panic onHenning Brauer
2004-07-18query interval scaling, episode IIHenning Brauer
1) base the interval calculation on the offset from the last reply, not from the last peer update. Allows us to send more queries again faster when the local clock diverges too much 2) every time we form a peer update (for which we need 8 replies) check wether we have a ready peer update for all peers that are currently trusted, and if so, calculate the total offset and call adjtime(). that means that adjtime is no longer called in fixed intervals but whenever we have enough data to reliably calculate the local clock offset. In practice, that means we call adjtime() less often, but with probably better data. 3) invalidate peer updates after beeing used. no point in re-using them - this resulted in calling adjtime() multiple times with the same offset, which doesn't make sense tested by many
2004-07-14do not do the stratum guessing dance.Henning Brauer
stratum is pretty much pointless anyway these days, and we certainly do not want to send out illegal packets (stratum=0) until synced...
2004-07-11Start collecting the remote server state along with the calculatedAlexander Guy
offsets, in preparation for having correct server statistics in responses to client queries. ok henning@
2004-07-10missing {}Henning Brauer
2004-07-10check wether we have enough data to form a peer update on receiptionHenning Brauer
of each packet, not only after each 8th (where we have enough for sure)
2004-07-10oupsHenning Brauer
2004-07-10scale query interval based on local clock offset. tested by manyHenning Brauer
not as efficient as I want it to be yet, but more is coming
2004-07-09don't panic when sendto() fails; for the client part just re-scheduleHenning Brauer
noticed & fix tested by fries@
2004-07-09rework dns handling with all its cosequences...Henning Brauer
we know have both a "server" and "servers" keyword. they differ when the hostname resolves to more than one IP, server picks one and servers expands to all. that means no longer stuffing a sockaddr_storage into ntp_peer but a pointer to a linked list of ntp_addr structs. in the "servers" case the list of n addresses returned by host() is expanded into n ntp_peer structs and thus n individual peers. in the "server" case the whole list is attached to ntp_peer, and whenever we do not receive a reply in time we traverse the list one further, so that hosts with both AAAA and A records are first tried with the AAAA one but we gracefully fall back to the A one. semantics with theo; hacked up on the Montreal->Frankfurt flight. again Air Canada surprised me, that older 767 hat pretty decent seats.
2004-07-08lof replies with log_debug so one gets increased verbosity when inHenning Brauer
foreground/debug mode
2004-07-07RFC 2030 is incorrect with regards to the computation of the delay valueAlexander Guy
for NTP queries/replies. RFC 1305 and some of Mills' other papers have the correct formula. ok henning@
2004-07-07don't log every single reply we receive and log local clock adjustemt nicerHenning Brauer
2004-07-07knf!Theo de Raadt
2004-07-07if the cookie in the received packet doesn't match discard it silently;Henning Brauer
the logging was useful for development but is a bad idea in production use as a remote attacker could flood your logs
2004-07-07keep a "trustlevel" per peer. loose credit for loosing a packet, looseHenning Brauer
a lot of credit for not having supplied us with enough data within an adjtime run interval, and get a little credit each time we get a good reply packet. if a peer is below 20%, only send a packet occasionally to see wether it is back. send out queries much more often between 20 and 80% to (re-)sync quickly, and above 80% usethe regular interval. do not use peers < 60% for calculating teh local clock offset. designed with theo at the pho, alexander ok
2004-07-06Implement the clock filter as descirbed by David Mills:Henning Brauer
form the last 8 replied received from a peer, find the one with the lowest delay. Use that as the peer's update taken into account for calculating the local clock's offset. Invalidate that reply and all ones received earlier than it so that they do not get used again.
2004-07-06when we received a apcket with incorrect cookie log from whom as wellHenning Brauer
2004-07-06log host packet was received from (originally using a long convolutedJason Wright
function until henning showed me the light... log_sockaddr... nifty); this diff is from henning and should be henning ok =)
2004-07-06initialize the variables that track the offset array; ok henning@Christian Weisgerber