Commit Graph

83 Commits

Author SHA1 Message Date
Denys Vlasenko
982e87f2fb Whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-30 11:52:58 +02:00
Denys Vlasenko
5a7e3376b7 ntpd: set offset to 0.0 in "usync" event
function                                             old     new   delta
ntpd_main                                           1030    1026      -4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-05-23 16:06:59 +02:00
Denys Vlasenko
07c5987498 ntpd: set G.last_script_run even if script isn't configured
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-05-22 18:18:51 +02:00
Denys Vlasenko
5ffdd1d981 ntpd: make "unsync" code actually work.
While at it: don't run "periodic" if interrupted by a signal.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-05-22 18:16:34 +02:00
Denys Vlasenko
d99ef636f6 ntpd: drop delay outliers; run "unsync" handler if no replies for some time
function                                             old     new   delta
ntpd_main                                            960    1029     +69
recv_and_process_peer_pkt                            834     892     +58
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 127/0)             Total: 127 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-05-22 17:48:19 +02:00
Denys Vlasenko
8f2cb7ab26 libbb: introduce and use strftime_[YYYYMMDD]HHMMSS()
function                                             old     new   delta
strftime_fmt                                           -      53     +53
strftime_YYYYMMDDHHMMSS                                -      12     +12
strftime_HHMMSS                                        -      12     +12
human_time                                            44      43      -1
fmtstr_t                                               9       -      -9
step_time                                            361     345     -16
watch_main                                           261     232     -29
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 0/3 up/down: 77/-55)             Total: 22 bytes
   text	   data	    bss	    dec	    hex	filename
 919203	    932	  17692	 937827	  e4f63	busybox_old
 919209	    932	  17692	 937833	  e4f69	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-29 12:30:33 +01:00
Paul Marks
b7841cf7b9 ntpd: fix incorrect m_status field in outgoing packets. Closes 5120
When using busybox ntpd with an NTPv3 client and NTPv4 server (or vice
versa), the version numbers can be incorrectly ORed together, yielding
the bogus value of "NTPv7".  This makes ntpd unusable with clients
such as Chrony and Windows "Internet Time".

This patch avoids the version mangling, by copying only the Leap
Indicator bits from the server's status field.

Signed-off-by: Paul Marks <paul@pmarks.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-14 02:39:10 +01:00
Denys Vlasenko
6967578728 whitespace fixes. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-14 01:34:48 +01:00
Anthony G. Basile
12677acf0a CONFIG_PID_FILE_PATH: new configuration option for pidfile paths
We set a default path for the directory where pidfiles are create
when FEATURE_PIDFILE is selected.  The default has no effect on
applets which must specify a pidfile path on the command line to
run, and it can be overridden by applets which optionally allow
the user to specify the pidfile path.

We also add pidfile write/remove support for klogd, ntpd and watchdog.
For syslogd, we add a missing remove_pidfile() for better cleanup
on daemon exit.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-12-19 15:53:33 -05:00
Mike Frysinger
c5fe9f7b72 include sys/resource.h where needed
We use functions from sys/resource.h in misc applets, but don't include
the header.  This breaks building with newer glibc versions, so add the
include where needed.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-07-05 23:19:09 -04:00
Denys Vlasenko
4125a6b630 ntpd: on time step, kill all outstanding replies from other peers
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-11 11:41:46 +02:00
Denys Vlasenko
3e3a8d50b3 ntpd: fix build failure if !NTPD_SERVER. Closes 4994
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-04-01 16:31:04 +02:00
Denys Vlasenko
79bec06168 ntpd: make "reply from IP" messages more uniform
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-08 13:02:52 +01:00
Denys Vlasenko
d98dc92d6a ntpd: drop offset averaging code
function                                             old     new   delta
filter_datapoints                                    475     174    -301

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-08 03:27:49 +01:00
Denys Vlasenko
8be49c3a80 ntpd: tweak log messages format
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-06 19:16:50 +01:00
Denys Vlasenko
547ee7926e ntpd: fix a case when discipline_jitter = 0 if we step
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-05 10:18:00 +01:00
Denys Vlasenko
132b044f4b ntpd: experimental code to correct frequency a bit more aggressively
function                                             old     new   delta
update_local_clock                                   730     792     +62
recv_and_process_peer_pkt                            850     835     -15

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-05 00:51:48 +01:00
Denys Vlasenko
97e5281641 ntpd: fix the "are we a server" check in previous commit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-03 13:50:31 +01:00
Denys Vlasenko
e8ce285395 ntpd: avoid printing messages between send and recv. good for fast networks
function                                             old     new   delta
ntpd_main                                            887     929     +42

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-03 12:15:46 +01:00
Denys Vlasenko
b124c3491b ntpd: log clock drift with three digits after decimal point
+15 bytes.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-02 15:51:43 +01:00
Denys Vlasenko
74584b8665 ntpd: log jitter on update too; increase assumed clock precision x2 - to 2ms
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-03-02 01:22:40 +01:00
Denys Vlasenko
fc4ebd0d0b ntpd: fix offset adjustment after step; better step printing
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-02-28 02:45:00 +01:00
Denys Vlasenko
16c52a5d7b ntpd: increase OPT_qq constant to not collide with -L
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-02-23 14:28:47 +01:00
Denys Vlasenko
66426760be *: remove "Options:" string from help texts
function                                             old     new   delta
packed_usage                                       28706   28623     -83

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-05 03:58:28 +02:00
Cristian Ionescu-Idbohrn
662972a77a The [-Wunused-but-set-variable] warnings
networking/ntpd.c:1748:19: warning: variable 'version' set but not used

Signed-off-by: Cristian Ionescu-Idbohrn <cii@axis.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-16 03:53:00 +02:00
Pere Orga
5bc8c005a8 move remaining help text from include/usage.src.h
Signed-off-by: Pere Orga <gotrunks@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-11 03:29:49 +02:00
Denys Vlasenko
8e23fafade ntpd: decrease ntpd -q "no response" timeout to 10 sec
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-07 01:45:20 +02:00
Denys Vlasenko
b7c9fb27cb whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-03 00:05:48 +01:00
Denys Vlasenko
fb132e4737 whitespace cleanup
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-29 11:46:52 +02:00
Leonid Lisovskiy
894ef60032 ntpd: fix usage text and a typo in constant name
Signed-off-by: Leonid Lisovskiy <lly.dev@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-20 22:36:51 +02:00
Denys Vlasenko
d678257c26 ntpd: allow peer-less (standalone stratum 1 server) operation
Based on patch by Jean-Christophe Dubois (jcd@tribudubois.net)

function                                             old     new   delta
ntp_init                                             384     399     +15
recv_and_process_client_pkt                          469     480     +11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-04 01:20:44 +02:00
Denys Vlasenko
74c992af5c ntpd: with -q, exit after 60 seconds even if time is not synced.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-27 02:15:01 +02:00
Denys Vlasenko
0ef64bdb40 *: make GNU licensing statement forms more regular
This change retains "or later" state! No licensing _changes_ here,
only form is adjusted (article, space between "GPL" and "v2" and so on).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16 20:14:46 +02:00
Denys Vlasenko
0f8960542f *: more empty lines removed. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-26 01:35:44 +02:00
Denys Vlasenko
f3ea792bad *: mass cosmetic removal of extra empty lines. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-07-26 01:06:14 +02:00
Denys Vlasenko
eff6d59343 ntpd: step correction to variables had wrong sign, fixing
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-24 20:23:40 +02:00
Denys Vlasenko
8531d76a15 *: code shrink and better "died from signal" reporting from wait4pid
function                                             old     new   delta
parse                                                964     967      +3
udhcp_run_script                                     670     665      -5
singlemount                                          911     906      -5
mount_it_now                                         360     355      -5
inotifyd_main                                        521     516      -5
xspawn                                                21       -     -21
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/4 up/down: 3/-41)             Total: -38 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-18 22:44:00 +01:00
Denys Vlasenko
24928ffd8d ntpd: explain why scripts can be run in quick succession
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-25 19:30:16 +01:00
Denys Vlasenko
57f46c1afd ntpd: remove some code which is at best unneeded and at worst wrong
function                                             old     new   delta
step_time                                            246     256     +10
ntpd_main                                            855     844     -11
update_local_clock                                   767     714     -53

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-17 03:01:15 +01:00
Denys Vlasenko
9b20adca4b ntpd: add anti-clock-hopping code
function                                             old     new   delta
select_and_cluster                                   837     950    +113
update_local_clock                                   759     767      +8
root_distance                                         61       -     -61

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-17 02:51:33 +01:00
Denys Vlasenko
5b9a910749 ntpd: disable frequency estimation code
function                                             old     new   delta
reset_peer_stats                                     164     168      +4
ntp_init                                             371     368      -3
recv_and_process_peer_pkt                            869     852     -17
update_local_clock                                   823     759     -64
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/3 up/down: 4/-84)             Total: -80 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-17 01:05:58 +01:00
Denys Vlasenko
65d722bb0d ntpd: explain algorithm
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-11 02:14:04 +01:00
Denys Vlasenko
12628b7797 ntpd: expose more data to the script; more eagerly drop to lower poll
function                                             old     new   delta
run_script                                           340     395     +55
recv_and_process_peer_pkt                            817     869     +52
passwd_main                                         1027    1058     +31
ntpd_main                                            845     855     +10
update_local_clock                                   853     823     -30
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/1 up/down: 148/-30)           Total: 118 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-11 01:31:59 +01:00
Denys Vlasenko
ae47335dc4 ntpd: show at loglevel 2 and export in env current poll interval
function                                             old     new   delta
run_script                                           273     340     +67
ntpd_main                                            832     845     +13

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-07 11:51:13 +01:00
Denys Vlasenko
6959f6bc23 hwclock: disable time diff code; ntpd -S script: do not wait for completion
function                                             old     new   delta
rtcname                                                4       -      -4
run_script                                           278     273      -5
hwclock_main                                         466     439     -27
read_rtc                                              86      38     -48
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/3 up/down: 0/-84)             Total: -84 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-07 08:31:46 +01:00
Denys Vlasenko
06667f21d6 ntpd: renew cur_time after script run, it can take a while
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-06 13:05:08 +01:00
Denys Vlasenko
ede737b7cf ntpd: add -S PROG option. This feature is crucial for CMOS/RTC syncronization
function                                             old     new   delta
run_script                                           112     278    +166
ntpd_main                                            779     825     +46
update_local_clock                                   824     858     +34
packed_usage                                       26518   26540     +22
ntp_init                                             366     371      +5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 5/0 up/down: 273/0)             Total: 273 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-06 12:27:47 +01:00
Denys Vlasenko
074e8dcba7 ntpd: make -w less cumbersome to use
function                                             old     new   delta
packed_usage                                       26767   26779     +12
recv_and_process_peer_pkt                            808     817      +9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-04 23:58:13 +01:00
Denys Vlasenko
4168fdd8e6 ntpd: add -w "watch" option, useful for debugging to look at our own data
Also fixed a small buglet discovered using -w

function                                             old     new   delta
recv_and_process_peer_pkt                            895     944     +49
select_and_cluster                                  1132    1150     +18
packed_usage                                       26769   26767      -2

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-04 00:19:13 +01:00
Denys Vlasenko
2d3253d1f9 ntpd: fix comment, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-03 21:52:46 +01:00