otto
8c79773d1d
if resolving a name fails, be more aggressive retrying, but with care:
do not have more than one dns request outstanding per peer. resolves
slow recovery when resolving fails initially, without clogging the
pipe with lots of dns requests; tested by Jason George; ok deraadt@
17 years ago
deraadt
c34c8f6d6a
aggressive spelling fix, spotted by jbg
17 years ago
henning
4f07972cbe
use clock_gettime(CLOCK_MONOTONIC, ..) to get a monotonically increasing
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
18 years ago
henning
9e886819ac
in client_nextaddr, check fd != -1 before close, just nicer this way
From: amandal@entrisphere.com
18 years ago
henning
43bb2c0b5f
when ntp_sendmsg fails, reset trustlevel to TRUSTLEVEL_PATHETIC
From: amandal@entrisphere.com
18 years ago
henning
8031d5c7e5
EADDRNOTAVAIL after connect is one of the soft errors where we don't abort
too. from amandal@entrisphere.com
18 years ago
otto
89f43414db
Compensate old offsets with the amount of adjustment done, avoiding
overcompensating. From DragonFly, uses recent adjtime(2) changes,
so you'll need a recent kernel. ok henning@
18 years ago
otto
24fa8ea878
Only invalidate stored replies if an adjustment was really made.
ok henning@
18 years ago
ckuethe
9325c20f99
When ntpd backs off polling due to a negative delay, tell the user how long
it will wait until the next poll.
ok henning@
18 years ago
henning
309a243757
figure out the refid to send to NTP v3 clients early and store it
first bits from a way to long flight
18 years ago
dtucker
73c6d5ec9f
Log source address for 'malformed packet' errors. ok henning@
19 years ago
dtucker
f31cfdaa27
Propogate server's leap indicator flags to clients; ok henning@
19 years ago
dtucker
4eaa821e76
Print actual error when in debug mode; ok henning@
19 years ago
dtucker
b5f096de27
add another non-fatal error for recvfrom; ok henning@
19 years ago
dtucker
f9299bb123
Save transmit time for each peer for later use as refid for SNTPv4
replies. ok henning@
19 years ago
henning
ed37b625d3
use a little state engine to keep track of delayed dns lookups and such,
eases things
tested by Jason Ackley <jason@ackley.net> Matthias Kilian
<kili@outback.escape.de> Stephen Marley <stephen@marley.org.uk> sturm@
theo ok
19 years ago
henning
f2765f2a2f
move the "reply from ... " log msg in -d mdoe uop a bit so it actually
comes before the "adjusting local clock by..." one, joerg
19 years ago
henning
7082200ffe
prevent replies with negative delay from being used, could happen with -s
From: Joerg Sonnenberger <joerg@britannica.bec.de> of dragonfly
19 years ago
henning
6801136c41
let client_query return 0 if it requested dns resolution
19 years ago
henning
356208894f
fix an error message
19 years ago
dtucker
c1809222fb
Implement simple duplicate suppression of peer errors; ok henning@
19 years ago
dtucker
21a049e79f
Simplify interval scaling and randomize query intervals; ok henning@
19 years ago
dtucker
e0c54820e7
Make network unreachable errors non-fatal; ok henning@
19 years ago
dtucker
270c434643
Scale query interval by the overall offset not per-peer offset, so we
don't query outliers more often than any other server. ok henning@
19 years ago
dtucker
5d09ee1c02
Delay before retrying a query on timeout; ok henning@
19 years ago
dtucker
890af70b55
Poll unsynchronized servers at the maximum interval and log a message about
them when in debug mode; ok henning@
20 years ago
dtucker
f8fddf9886
Factor out interval scaling code; ok henning@
20 years ago
dtucker
ec912cc477
If polling a server results in an error, drop that server to the maximum
poll interval; ok henning@
20 years ago
dtucker
1bfbeb3ca8
Discard replies with alarm flag set or invalid stratum; ok henning@
20 years ago
mickey
a077b10ff0
define TRUSTLEVEL_MAX for the trustedlevel value of 10; henning@ ok
20 years ago
mickey
b521cde7ce
uniquely name members of s_fixedpt and l_fixedpt; henning@ ok
20 years ago
henning
b84ae4cbbe
ntp_adjtime() -> priv_adjtime()
ntp_settime() -> priv_settime()
ntp_host_dns() -> priv_host_dns()
20 years ago
dtucker
ceecbd1877
Use SA_LEN() instead of ss.ss_len. Evaluates to the same result but it's
easier on portable. ok henning@
20 years ago
henning
d94b864a67
in server mode reply with stratum from the peer that we currently prefer
plus one
20 years ago
dtucker
3b0155d86c
Only set IPTOS_LOWDELAY on IPv4 interfaces; pointed out by phessler, ok henning
20 years ago
dtucker
dcc316e5a2
Have ntpd use IPTOS_LOWDELAY; ok henning@
20 years ago
henning
0fe5ca5a17
in struct ntp_msg, rename "distance" to "rootdelay" to closer match RFCs
and such
20 years ago
henning
0d2f286428
thinko, htonl() -> ntohl(). as we don't use the value in question effect zero
20 years ago
henning
0cd13f252a
whitespace both in comment; from bernd
20 years ago
henning
abc9700cfb
in client_addr_init() and client_nextaddr(), do not set up the socket and
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
20 years ago
henning
c25a5d5725
now that we connect() the client sockets we need to handle ECONNREFUSED as
non-fatal too, from camield@
20 years ago
henning
944ef50b12
connect() the client-side sockets. idea & test & ok camield@
20 years ago
henning
80548b0292
add a new -s option, that tells ntpd to set the time using settimeofday()
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
20 years ago
henning
372c584a99
paranoia: reset query->fd to -1 after close, from canacar some time ago
20 years ago
otto
3fa78249ed
Be more careful setting next and deadline, they should not both be != 0
at the same time.
ok henning@
20 years ago
otto
daecdacb15
Reset deadline on failed transmit. Avoids a spinning process if
all sends fail. ok henning@
20 years ago
henning
f5548494ff
do not try to getaddrinfo() in the unprivileged process, send an imsg
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>
20 years ago
henning
5512eb59e0
when a dns lookup fails at parse time, do not abort but try again
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
20 years ago
henning
6fe4af12fd
wrap the heads for the linked list of addresses into a new ntp_addr_wrap
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.
20 years ago
henning
7253f8812f
there are a few recvfrom(2) errors we do not want to panic on
20 years ago