Trouble with NTP Tally/Peer Status
Once I had everything up and running I started to get acceptable numbers for offset and jitter however one thing which stubbornly refused to change was the first character of the peer status line. The “*” is a one character indication of the role of the peer aka the peer status or tally code. I knew that the PPS logic was working correctly but the status refused to change.
pi@ntpi ~ $ ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== *GPS_ONCORE(0) .GPS. 0 l 1 16 377 0.000 -0.001 0.003 +ptbtime1.ptb.de .PTB. 1 u 34 64 377 36.019 -1.340 6.205 +stratum2-3.NTP. 129.70.130.70 2 u 12 64 377 34.453 -1.166 1.222 +stratum2-3.NTP. 129.70.130.70 2 u 62 64 377 34.526 -1.193 0.178 -clock2.infonet. .PPS. 1 u 54 64 377 59.021 -4.390 2.726 -ntp.univ-angers 145.238.203.14 2 u 48 64 377 44.575 -7.638 0.406 pi@ntpi ~ $
I followed many red herrings until the only conclusion was that this flag was not being correctly set by ntpd. After study of the source (I am using /ntp-dev-4.2.7p319) for refclock_oncore.c it seemed that the flag was reset at the top of oncore_get_timestamp and set at the end of the function; this doesn’t work! Since this guarantees that the flag is always reset when refclock_process is called. I checked the previous implementation (4.2.6p5) and found a different implementation… looks like a regression.
I modified my local version to set the flag more along the lines of the 4.2.6p5, i.e. to carry over the flag between invocations, setting it if the code reached the end of the happy path in oncore_get_timestamp and resetting it in the case of any failure.
And… Hey Presto!
root@ntpi:/# ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== oGPS_ONCORE(0) .GPS. 0 l 4 16 377 0.000 -0.001 0.002 *ptbtime1.ptb.de .PTB. 1 u 2 64 377 38.102 -0.148 0.147 -frankfurt1.firs 161.62.157.173 3 u 17 64 377 31.474 -1.970 2.257 -diane.ensma.fr 193.79.237.14 2 u 15 64 377 44.064 -3.768 0.453 +iris.wf-hosting 105.240.56.33 2 u 15 64 377 17.128 -0.196 1.980 +login-vlan87.bu 165.94.197.40 2 u 60 64 377 49.098 -0.547 0.303 root@ntpi:/#
Mission accomplished!
Pingback: NTP Server using Raspberry Pi and VP Oncore GPS Module – Part 4 | aardvarklabs