summaryrefslogtreecommitdiff
path: root/usr.sbin/ntpd/client.c
AgeCommit message (Collapse)Author
2006-10-27use clock_gettime(CLOCK_MONOTONIC, ..) to get a monotonically increasingHenning Brauer
time, and make ntpd use that to send the next uery to an ntp peer and the like. this has the advantage that changes to the clock do not interfere with the intervals. for example, when we start on machines without an RTC and the initial settime (-s) kicks in, intervals were strange. idea from amandal@entrisphere.com, this implementation by me tested ckuethe, phessler, mbalmer, ok mbalmer
2006-10-21in client_nextaddr, check fd != -1 before close, just nicer this wayHenning Brauer
From: amandal@entrisphere.com
2006-10-21when ntp_sendmsg fails, reset trustlevel to TRUSTLEVEL_PATHETICHenning Brauer
From: amandal@entrisphere.com
2006-10-21EADDRNOTAVAIL after connect is one of the soft errors where we don't abortHenning Brauer
too. from amandal@entrisphere.com
2006-06-07Compensate old offsets with the amount of adjustment done, avoidingOtto Moerbeek
overcompensating. From DragonFly, uses recent adjtime(2) changes, so you'll need a recent kernel. ok henning@
2006-06-04Only invalidate stored replies if an adjustment was really made.Otto Moerbeek
ok henning@
2006-05-29When ntpd backs off polling due to a negative delay, tell the user how longChris Kuethe
it will wait until the next poll. ok henning@
2006-05-25figure out the refid to send to NTP v3 clients early and store itHenning Brauer
first bits from a way to long flight
2005-09-24Log source address for 'malformed packet' errors. ok henning@Darren Tucker
2005-08-10Propogate server's leap indicator flags to clients; ok henning@Darren Tucker
2005-07-11Print actual error when in debug mode; ok henning@Darren Tucker
2005-07-06add another non-fatal error for recvfrom; ok henning@Darren Tucker
2005-07-05Save transmit time for each peer for later use as refid for SNTPv4Darren Tucker
replies. ok henning@
2005-06-19use a little state engine to keep track of delayed dns lookups and such,Henning Brauer
eases things tested by Jason Ackley <jason@ackley.net> Matthias Kilian <kili@outback.escape.de> Stephen Marley <stephen@marley.org.uk> sturm@ theo ok
2005-04-19move the "reply from ... " log msg in -d mdoe uop a bit so it actuallyHenning Brauer
comes before the "adjusting local clock by..." one, joerg
2005-04-18prevent replies with negative delay from being used, could happen with -sHenning Brauer
From: Joerg Sonnenberger <joerg@britannica.bec.de> of dragonfly
2005-03-08let client_query return 0 if it requested dns resolutionHenning Brauer
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...