From: Harlan Stenn Date: Fri, 8 May 2009 21:32:49 +0000 (-0400) Subject: Stale leapsecond file fixes from Dave Mills X-Git-Tag: NTP_4_2_5P174~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b7d282c4080a0aa62333d5765cf8393339642ab;p=thirdparty%2Fntp.git Stale leapsecond file fixes from Dave Mills bk: 4a04a5019qSgFnYb-vgHUvrX9lheEA --- diff --git a/ChangeLog b/ChangeLog index b2178ee12..1122aa406 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ +* Stale leapsecond file fixes from Dave Mills. (4.2.5p173) 2009/05/08 Released by Harlan Stenn * Include (4.2.4p7-RC6) (4.2.5p172) 2009/05/06 Released by Harlan Stenn diff --git a/html/decode.html b/html/decode.html index 5516ffe0c..6fe34becf 100644 --- a/html/decode.html +++ b/html/decode.html @@ -1,693 +1,854 @@ - - - ntpd System Log Messages - - - -

Event Messages and Status Words

- giffrom Alice's Adventures in Wonderland, Lewis Carroll -

Caterpillar knows all the error codes, which is more than most of us do.

-

Last update: - 03-May-2009 3:28 - UTC

-
-

Related Links

-

-

Table of Contents

- -
-

Introduction

-

This page lists the status and event messages and error codes used for status reporting and monitoring. Status words are used to display the current status of the running program. There is one system status word and a peer status word for each association. There is a clock status word for each association that supports a reference clock driver. There is a flash code for each association which shows errors found in the last packet received (pkt) and during protocol processing (peer). These are commonly viewed using the ntpq program.

-

Significant changes in program state are reported as events. There is one set of system events and a set of peer events for each association. In adition, there is a set of clock events for each association that supports a reference clock driver. Events are normally reported to the protostats file and optionally to the system log. In addition, if the trap facility is configured, traps can be reported to a remote program that can page an administrator.

-

This page also includes a description of the error messages produced by the Autokey protocol. These messages are normally sent to the cryptostats file.

-

In the following tables the Code Field is the status or event code assigned and the Message Field a short string used for display and event reporting. The Description field contains a longer explanation of the status or event. Some messages include additional information useful for error diagnosis and performance assessment.

-

System Status Word

-

The system status word consists of four fields LI (0-1), Source (2-7), Count - (8-11) and Code (12-15). It is reported in the first line of the rv display produced by the ntpq program.

+ + +ntpd System Log Messages + + + +

Event Messages and Status Words

+giffrom Alice's Adventures in Wonderland, Lewis Carroll + +

Caterpillar knows all the error codes, which is more than most of us do.

+ +

Last update: +03-May-2009 3:28 +UTC

+
+ +

Related Links

+ +

+ +

Table of Contents

+ + + +
+ +

Introduction

+ +

This page lists the status and event messages and error codes used for status reporting and monitoring. Status words are used to display the current status of the running program. There is one system status word and a peer status word for each association. There is a clock status word for each association that supports a reference clock driver. There is a flash code for each association which shows errors found in the last packet received (pkt) and during protocol processing (peer). These are commonly viewed using the ntpq program.

+ +

Significant changes in program state are reported as events. There is one set of system events and a set of peer events for each association. In adition, there is a set of clock events for each association that supports a reference clock driver. Events are normally reported to the protostats file and optionally to the system log. In addition, if the trap facility is configured, traps can be reported to a remote program that can page an administrator.

+ +

This page also includes a description of the error messages produced by the Autokey protocol. These messages are normally sent to the cryptostats file.

+ +

In the following tables the Code Field is the status or event code assigned and the Message Field a short string used for display and event reporting. The Description field contains a longer explanation of the status or event. Some messages include additional information useful for error diagnosis and performance assessment.

+ +

System Status Word

+ +

The system status word consists of four fields LI (0-1), Source (2-7), Count (8-11) and Code (12-15). It is reported in the first line of the rv display produced by the ntpq program.

+ - - - - - - -
-
Leap
-
-
- Source
-
-
- Count
-
-
- Code
-
-

The Leap Field displays the system leap indicator bits coded as follows:

- - - - - - - - - - - - - - - - - - - - - - - - - - -
CodeMessageDescription
0leap_nonenormal synchronized state
1leap_add_secinsert second after 23:59:59 of the current day
2leap_del_secdelete second 23:59:59 of the current day
3leap_alarmnever synchronized
-

The Source Field displays the current synchronization source coded as follows:.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CodeMessageDescription
0sync_unspecnot yet synchronized
1sync_ppspulse-per-second signal (Cs, Ru, GPS, etc.)
2sync_lf_radioVLF/LF radio (WWVB, DCF77, etc.)
3sync_hf_radioMF/HF radio (WWV, etc.)
4sync_uhf_radioVHF/UHF radio/satellite (GPS, Galileo, etc.)
5sync_locallocal timecode (IRIG, LOCAL driver, etc.)
6sync_ntpNTP
7sync_otherother (IEEE 1588, openntp, crony, etc.)
8sync_wristwatcheyeball and wristwatch
9sync_telephonetelephone modem (ACTS, PTB, etc.)
-

The Count Field displays the number of events since the last time the - code changed. Upon reaching 15, subsequent events with the same code - are ignored. The Event Field displays the most recent event message - coded as follows:

+ + +
Leap
+
Source
+
Count
+
Code
+ + + + +

The Leap Field displays the system leap indicator bits coded as follows:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CodeMessageDescription
0leap_nonenormal synchronized state
1leap_add_secinsert second after 23:59:59 of the current day
2leap_del_secdelete second 23:59:59 of the current day
3leap_alarmnever synchronized
+ +

The Source Field displays the current synchronization source coded as follows:.

+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CodeMessageDescription
0unspecifiedunspecified
1freq_not_setfrequency file not available
2freq_setfrequency set from frequency file
3spike_detectspike detected
4freq_modeinitial frequency training mode
5clock_syncclock synchronized
6restartprogram restart
7panic_stopclock error more than 600 s
8no_system_peerno system peer
9leap_armedleap second armed from file or Autokey
10leap_disarmedleap second disarmed
11leap_eventleap event
12clock_stepclock stepped
13kernkernel information message
-

Peer Status Word

-

The peer status word consists of four fields: Status (0-4, Select (5-7), - Count (8-11) and Code (12-15). It is reported in the first line of - the rv associd display - produced by the ntpq program.

+ + +Code +Message +Description + + + +
0 +sync_unspec +not yet synchronized + + + +1 +sync_pps +pulse-per-second signal (Cs, Ru, GPS, etc.) + + + +2 +sync_lf_radio +VLF/LF radio (WWVB, DCF77, etc.) + + + +3 +sync_hf_radio +MF/HF radio (WWV, etc.) + + + +4 +sync_uhf_radio +VHF/UHF radio/satellite (GPS, Galileo, etc.) + + + +5 +sync_local +local timecode (IRIG, LOCAL driver, etc.) + + + +6 +sync_ntp +NTP + + + +7 +sync_other +other (IEEE 1588, openntp, crony, etc.) + + + +8 +sync_wristwatch +eyeball and wristwatch + + + +9 +sync_telephone +telephone modem (ACTS, PTB, etc.) + + + + +

The Count Field displays the number of events since the last time the code changed. Upon reaching 15, subsequent events with the same code are ignored. The Event Field displays the most recent event message coded as follows:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
no_system_peer +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CodeMessageDescription
0unspecifiedunspecified
1freq_not_setfrequency file not available
2freq_setfrequency set from frequency file
3spike_detectspike detected
4freq_modeinitial frequency training mode
5clock_syncclock synchronized
6restartprogram restart
7panic_stopclock error more than 600 s
8no system peer
9leap_armedleap second armed from file or Autokey
10leap_disarmedleap second disarmed
11leap_eventleap event
12clock_stepclock stepped
13kernkernel information message
+ +

Peer Status Word

+ +

The peer status word consists of four fields: Status (0-4, Select (5-7), Count (8-11) and Code (12-15). It is reported in the first line of the rv associd display produced by the ntpq program.

+ - - - - - - -
-
- Status
-
-
Select
-
-
- Count
-
-
- Code
-
-

The Status Field displays the peer status code bits in hexadecimal as follows:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CodeMessageDescription
08bcstbroadcast association
10reachhost reachable
20authenbauthentication enabled
40authauthentication ok
80configpersistent association
The Select Field displays the current selection. status The T Field displays the tally codes beginning the ntpq peers display. The values are coded as follows: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CodeMessageTDescription
0sel_rejectdiscarded as not valid (TEST10-TEST13)
1sel_falsetickxdiscarded by intersection algorithm
2sel_excess.discarded by table overflow (not used)
3sel_outlyer-discarded by the cluster algorithm
4sel_candidate+included by the combine algorithm
5sel_backup#backup (more than tinker maxclock sources)
6sel_sys.peer*system peer
7sel_pps.peeroPPS peer (when the prefer peer is valid)
-

The Count Field displays the number of events since the last time the code - changed. Upon reaching 15, subsequent events with the same code are ignored. - The Event Field displays the most recent event message coded as follows:

+ + +
Status
+
Select
+
Count
+
Code
+ + + + +

The Status Field displays the peer status code bits in hexadecimal as follows:

+ + + + + + + + + + + + + + + + + + + +/tr> + + + + + + + + + + + + + + + + + + + +
CodeMessageDescription
08bcstbroadcast association
10reachhost reachable
20authenbauthentication enabled
40authauthentication ok
80configpersistent association
+ +

The Select Field displays the current selection. status The T Field displays the tally codes beginning the ntpq peers display. The values are coded as follows:

+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CodeMessageDescription
1mobilizeassociation mobilized
2demobilizeassociation demobilized
3unreachableserver unreachable
4reachableserver reachable
5restartassociation restart
6no_replyno server found (ntpdate mode)
7rate_exceededrate exceeded (kiss code RATE)
8access_deniedaccess denied (kiss code DENY)
9leap_armedleap armed from server LI code
10sys_peernew system peer
11clockreference clock message (see clock status word)
-

Clock Status Word

-

The clock status word consists of four fields: Unused (0-7), Count (8-11) - and Code (12-15). It is reported in the first line of the clockvar associd display - produced by the ntpq program.

+ + +Code +Message +T +Description + + + +0 +sel_reject + +discarded as not valid (TEST10-TEST13) + + + +1 +sel_falsetick +x +discarded by intersection algorithm + + + +2 +sel_excess +. +discarded by table overflow (not used) + + + +
3 +sel_outlyer +- +discarded by the cluster algorithm + + + +4 +sel_candidate ++ +included by the combine algorithm + + + +5 +sel_backup +# +backup (more than tinker maxclock sources) + + + +6 +sel_sys.peer +* +system peer + + + +7 +sel_pps.peer +o +PPS peer (when the prefer peer is valid) + + + + +

The Count Field displays the number of events since the last time the code changed. Upon reaching 15, subsequent events with the same code are ignored. The Event Field displays the most recent event message coded as follows:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CodeMessageDescription
01mobilizeassociation mobilized
02demobilizeassociation demobilized
03unreachableserver unreachable
04reachableserver reachable
05restartassociation restart
06no_replyno server found (ntpdate mode)
07rate_exceededrate exceeded (kiss code RATE)
08access_deniedaccess denied (kiss code DENY)
09leap_armedleap armed from server LI code
0asys_peerbecome system peer
0bclock_eventsee ckock status word
0cbad_authauthentication failure
0d[popcorn/tt>popcorn spike suppressor
0einterleave_modeentering interleave mode
0finterleave_errorinterleave error (recoverable)
10TAI...leapsecond values update from server
+ +

Clock Status Word

+ +

The clock status word consists of four fields: Unused (0-7), Count (8-11) and Code (12-15). It is reported in the first line of the clockvar associd display produced by the ntpq program.

+vvv - - - - - -
-
- Unused
-
-
- Count
-
-
- Code
-
-

The Count Field displays the number of events since the last clockvar command, while the Event Field displays the most recent event message coded as follows:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CodeMessageDescription
0clk_unspenominal
1clk_noreplyno reply to poll
2clk_badformatbad timecode format
3clk_faulthardware or software fault
4clk_bad_signalsignal loss
5clk_bad_datebad date format
6clk_bad_timebad time format
-

When the clock driver sets the code to a new value, a clock_alarm (11) peer event is reported.

-

Flash Status Word

-

The flash status word is displayed by the ntpq program rv command. It consists of a number of bits coded in hexadecimal as follows:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CodeTagMessageDescription
0001TEST1pkt_dupduplicate packet
0002TEST2pkt_bogusbogus packet
0004TEST3pkt_unsyncprotocol unsynchronized
0008TEST4pkt_deniedaccess denied
0010TEST5pkt_authbad authentication
0020TEST6pkt_stratumbad synch or stratum
0040TEST7pkt_headerbad header
0080TEST8pkt_autokeybad autokey
0100TEST9pkt_cryptobad crypto
0200TEST10peer_stratumpeer bad synch or stratum
0400TEST11peer_distpeer distance exceeded
0800TEST12peer_looppeer synchronization loop
1000TEST13peer_unreachpeer unreachable
-

Kiss Codes

- Kiss codes are used in kiss-o'-death (koD) packets, billboard displays and log messages. They consist of a string of four zero-padded ASCII charactes. In practice they are informal and tend to change with time and implementation. Some of these codes can appear in the reference identifier field in ntpq billboards. Following is the current list: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CodeDescription
ACSTmanycast server
AUTHauthentication error
AUTOAutokey sequence error
BCSTbroadcast server
CRYPTAutokey protocol error
DENYaccess denied by server
INITassociation initialized
MCSTmulticast server
RATErate exceeded
TIMEassociation timeout
STEPstep time change
-

Crypto Messages

-

These messages are sent to the cryptostats file when an error is detected in the Autokey protocol.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CodeMessageDescription
1bad_formatbad extension field format or length
2bad_timestampbad timestamp
3bad_filestampbad filestamp
4bad_public_keybad or missing public key
5bad_digestunsupported digest type
6bad_identityunsupported identity type
7bad_siglengthbad signature length
8bad signatureextension field signature not verified
9cert_not_verifiedcertificate signature not verified
10cert_expiredhost certificate expired
11bad_cookiebad or missing cookie
12bad_leapsecondsbad or misssing leapseconds values
13cert_missingbad or missing certificate
14bad_group_keybad or missing group key
15proto_errorprotocol error
-
- - + +
Unused
+
Count
+
Code
+ + + + +

The Count Field displays the number of events since the last lockvar command, while the Event Field displays the most recent event message coded as follows:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CodeMessageDescription
00clk_unspenominal
01clk_noreplyno reply to poll
02clk_badformatbad timecode format
03clk_faulthardware or software fault
04clk_bad_signalsignal loss
05clk_bad_datebad date format
06clk_bad_timebad time format
+ +

When the clock driver sets the code to a new value, a clock_alarm (11) peer event is reported.

+ +

Flash Status Word

+ +

The flash status word is displayed by the ntpq program rv command. It consists of a number of bits coded in hexadecimal as follows:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CodeTagMessageDescription
0001TEST1pkt_dupduplicate packet
0002TEST2pkt_bogusbogus packet
0004TEST3pkt_unsyncprotocol unsynchronized
0008TEST4pkt_deniedaccess denied
0010TEST5pkt_authbad authentication
0020TEST6pkt_stratumbad synch or stratum
0040TEST7pkt_headerbad header
0080TEST8pkt_autokeybad autokey
0100TEST9pkt_cryptobad crypto
0200TEST10peer_stratumpeer bad synch or stratum
0400TEST11peer_distpeer distance exceeded
0800TEST12peer_looppeer synchronization loop
1000TEST13peer_unreachpeer unreachable
+ +

Kiss Codes

+ +

Kiss codes are used in kiss-o'-death (koD) packets, billboard displays and log messages. They consist of a string of four zero-padded ASCII charactes. In practice they are informal and tend to change with time and implementation. Some of these codes can appear in the reference identifier field in ntpq billboards. Following is the current list:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CodeDescription
ACSTmanycast server
AUTHauthentication error
AUTOAutokey sequence error
BCSTbroadcast server
CRYPTAutokey protocol error
DENYaccess denied by server
INITassociation initialized
MCSTmulticast server
RATErate exceeded
TIMEassociation timeout
STEPstep time change
+ +

Crypto Messages

+ +

These messages are sent to the cryptostats file when an error is detected in the Autokey protocol.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CodeMessageDescription
01bad_formatbad extension field format or length
02bad_timestampbad timestamp
03bad_filestampbad filestamp
04bad_public_keybad or missing public key
05bad_digestunsupported digest type
06bad_identityunsupported identity type
07bad_siglengthbad signature length
08bad signatureextension field signature not verified
09cert_not_verifiedcertificate signature not verified
0acert_expiredhost certificate expired
0bbad_cookiebad or missing cookie
0cbad_leapsecondsbad or misssing leapseconds values
0dcert_missingbad or missing certificate
0ebad_group_keybad or missing group key
0fproto_errorprotocol error
+ +
+ + + + \ No newline at end of file diff --git a/include/ntp.h b/include/ntp.h index 592ac7bc6..4b9691906 100644 --- a/include/ntp.h +++ b/include/ntp.h @@ -698,6 +698,9 @@ struct pkt { #define EVNT_LEAP 11 /* leap event */ #define EVNT_CLOCKRESET 12 /* clock step */ #define EVNT_KERN 13 /* kernel event */ +#define EVNT_TAI 14 /* TAI */ +#define EVNT_LEAPVAL 15 /* stale leapsecond values */ + /* * Peer event codes */ @@ -716,6 +719,7 @@ struct pkt { #define PEVNT_POPCORN (13 | PEER_EVENT) /* popcorn */ #define PEVNT_XLEAVE (14 | PEER_EVENT) /* interleave mode */ #define PEVNT_XERR (15 | PEER_EVENT) /* interleave error */ +#define PEVNT_TAI (16 | PEER_EVENT) /* TAI */ /* * Clock event codes diff --git a/include/ntpd.h b/include/ntpd.h index 153be35eb..45b1635f3 100644 --- a/include/ntpd.h +++ b/include/ntpd.h @@ -244,6 +244,7 @@ extern void record_crypto_stats (struct sockaddr_storage *, const char *); extern void record_timing_stats (const char *); #endif extern int sock_hash (struct sockaddr_storage *); +extern char * fstostr(time_t); extern double old_drift; extern int drift_file_sw; extern double wander_threshold; diff --git a/libntp/statestr.c b/libntp/statestr.c index b809b2028..9ad7f38e3 100644 --- a/libntp/statestr.c +++ b/libntp/statestr.c @@ -126,6 +126,8 @@ struct codestring sys_codes[] = { { EVNT_LEAP, "leap_event" }, { EVNT_CLOCKRESET, "clock_step" }, { EVNT_KERN, "kern" }, + { EVNT_TAI, "TAI" }, + { EVNT_LEAPVAL, "stale_leapsecond_values" }, { -1, "" } }; @@ -149,6 +151,7 @@ struct codestring peer_codes[] = { { PEVNT_POPCORN & ~PEER_EVENT, "popcorn" }, { PEVNT_XLEAVE & ~PEER_EVENT, "xmode" }, { PEVNT_XERR & ~PEER_EVENT, "xerr" }, + { PEVNT_TAI & ~PEER_EVENT, "TAI" }, { -1, "" } }; diff --git a/ntpd/ntp_control.c b/ntpd/ntp_control.c index dcee3bb12..c33fcf74e 100644 --- a/ntpd/ntp_control.c +++ b/ntpd/ntp_control.c @@ -2797,7 +2797,7 @@ report_event( ctl_sys_last_event = (u_char)err; ctl_sys_num_events++; snprintf(statstr, NTP_MAXSTRLEN, - "0.0.0.0 %04x %02x system event: %s", + "0.0.0.0 %04x %02x %s", ctlsysstatus(), err, eventstr(err)); if (str != NULL) { strcat(statstr, " "); @@ -2829,7 +2829,7 @@ report_event( #endif src = stoa(&peer->srcadr); snprintf(statstr, NTP_MAXSTRLEN, - "%s %04x %02x peer event: %s", src, + "%s %04x %02x %s", src, ctlpeerstatus(peer), err, eventstr(err)); if (str != NULL) { strcat(statstr, " "); diff --git a/ntpd/ntp_crypto.c b/ntpd/ntp_crypto.c index 0e20ae629..3d47ec5ed 100644 --- a/ntpd/ntp_crypto.c +++ b/ntpd/ntp_crypto.c @@ -943,7 +943,7 @@ crypto_recv( case CRYPTO_LEAP | CRYPTO_RESP: /* - * Discard the message if invalid We can't + * Discard the message if invalid. We can't * compare the value timestamps here, as they * can be updated by different servers. */ @@ -957,6 +957,8 @@ crypto_recv( * values and recompute the signatures. */ if (ntohl(ep->pkt[2]) > leap_expire) { + char tbuf[80], str1 [20], str2[20]; + tai_leap.tstamp = ep->tstamp; tai_leap.fstamp = ep->fstamp; tai_leap.vallen = ep->vallen; @@ -964,6 +966,11 @@ crypto_recv( leap_sec = ntohl(ep->pkt[1]); leap_expire = ntohl(ep->pkt[2]); crypto_update(); + strcpy(str1, fstostr(leap_sec)); + snprintf(tbuf, sizeof(tbuf), + "%d leap %s expire %s", leap_tai, str1, + str2); + report_event(EVNT_TAI, peer, tbuf); } peer->crypto |= CRYPTO_FLAG_LEAP; peer->flash &= ~TEST8; diff --git a/ntpd/ntp_timer.c b/ntpd/ntp_timer.c index 61dfe87fa..d831d3ca5 100644 --- a/ntpd/ntp_timer.c +++ b/ntpd/ntp_timer.c @@ -56,6 +56,7 @@ static u_long adjust_timer; /* second timer */ static u_long stats_timer; /* stats timer */ static u_long huffpuff_timer; /* huff-n'-puff timer */ u_long leapsec; /* leapseconds countdown */ +l_fp sys_time; /* current system time */ #ifdef OPENSSL static u_long revoke_timer; /* keys revoke timer */ static u_long keys_timer; /* session key timer */ @@ -250,7 +251,8 @@ timer(void) * kiss-o'-deatch function and implement the association * polling function.. */ - current_time += (1< leap_expire) + report_event(EVNT_LEAPVAL, NULL, NULL); } } diff --git a/ntpd/ntp_util.c b/ntpd/ntp_util.c index 36fa10150..9109b3ce7 100644 --- a/ntpd/ntp_util.c +++ b/ntpd/ntp_util.c @@ -339,9 +339,11 @@ stats_config( const char *invalue /* only one type so far */ ) { - FILE *fp; + FILE *fp; const char *value; - int len; + int len; + char tbuf[80]; + char str1[20], str2[20]; /* * Expand environment strings under Windows NT, since the @@ -549,14 +551,18 @@ stats_config( break; } - if (leap_file(fp) < 0) + if (leap_file(fp) < 0) { msyslog(LOG_ERR, "format error leapseconds file %s", value); - else - msyslog(LOG_NOTICE, - "leap epoch %lu expire %lu TAI offset %d from %s", - leap_sec, leap_expire, leap_tai, value); + } else { + strcpy(str1, fstostr(leap_sec)); + strcpy(str2, fstostr(leap_expire)); + snprintf(tbuf, sizeof(tbuf), + "%d leap %s expire %s", leap_tai, str1, + str2); + report_event(EVNT_TAI, NULL, tbuf); + } fclose(fp); break; @@ -1105,3 +1111,23 @@ ntp_exit(int retval) exit(retval); } #endif + +/* + * fstostr - prettyprint NTP seconds + */ +char * fstostr( + time_t fstamp + ) +{ + struct tm *tm = NULL; + static char str[20] = { '\0' }; + time_t ustamp; + + ustamp = fstamp - JAN_1970; + tm = gmtime(&ustamp); + if (tm != NULL) + snprintf(str, sizeof(str), "%04d%02d%02d%02d%02d", + tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, + tm->tm_hour, tm->tm_min); + return (str); +}