Bug #10307
closedNTP status widget doesn't display stratum
100%
Description
On 2.4.4-RELEASE-p3, if I have a) an IPv6 NTP server, and b) the NTP status widget on the dashboard, the widget doesn't display the stratum correctly:
NTP Status Server Time 10:08:58 CST Sync Source 2620:19:4000:100::86 (stratum )
where stratum is blank entirely.
Meanwhile, the NTP Status page displays stratum for all servers:
Network Time Protocol Status Pool Placeholder pfsense.pool.nt .POOL. 16 p - 64 0 0.000 0.000 0.000 Pool Placeholder time.mbix.ca .POOL. 16 p - 64 0 0.000 0.000 0.000 Active Peer 2620:19:4000:10 16.164.40.197 2 u 504 512 377 4.913 3.742 1.795 Candidate 2620:19:4000:10 132.246.11.229 3 u 293 512 357 4.550 3.176 2.987 Outlier 2620:19:4000:10 16.164.40.197 2 u 294 512 377 6.126 1.612 1.855 Candidate 198.181.199.86 16.164.40.197 2 u 519 512 377 3.291 2.311 1.829 Candidate 198.181.199.84 132.246.11.229 3 u 17 512 377 4.055 3.105 2.640 Candidate 198.181.199.82 16.164.40.197 2 u 432 512 377 3.658 3.368 1.722
No idea if it affects other arches (although I would guess it probably does).
Not sure if this should be "Dashboard" or "NTPD" category.
Files
Updated by Adam Thompson over 4 years ago
Ohhh... as soon as it selects a sane peer, the problem goes away.
Now I don't know if the problem is "Outlier" or if the problem is IPv6 addresses.
Updated by Manuel Piovan over 4 years ago
affected version also 2.5.0
Candidate 192.168.10.200 .GPS. 1 u 28 64 17 0.187 -0.436 0.048
Candidate 172.17.0.100 192.168.10.200 2 u 25 64 17 0.971 -0.111 0.065
Active Peer 2001:470:26:5dc .GPS. 1 u 21 64 17
^ address truncated
ntp widget
Sync Source 2001:470:26:5dc:ffff:ffff:ffff:fffe (stratum )
ntp_status.widget.php line 41 -> exec("/usr/local/sbin/ntpq -pn -w $inet_version | /usr/bin/tail +3", $ntpq_output);
the problem is with the -w flag
[2.5.0-DEVELOPMENT][root@pfSense.kiokoman.home]/root: /usr/local/sbin/ntpq -pn -w | /usr/bin/tail +3
+192.168.10.200 .GPS. 1 u 24 64 377 0.272 -0.042 0.016
-172.17.0.100 192.168.10.200 2 u 7 128 377 1.053 -0.160 0.069
*2001:470:26:5dc:ffff:ffff:ffff:fffe
.GPS. 1 u 13 64 377 0.279 -0.079 1.379
0.it.pool.ntp.org
.POOL. 16 p - 64 0 0.000 +0.000 0.002
+185.19.184.35 193.204.114.233 2 u 15 64 377 18.030 +4.095 0.364
+212.45.144.3 193.204.114.232 2 u 66 64 377 18.574 +4.374 5.044
+46.235.141.130 85.199.214.99 2 u 7 128 377 31.823 +5.108 0.114
+212.45.144.88 193.204.114.233 2 u 2 128 377 18.133 +2.920 6.557
+85.199.214.99 .GPS. 1 u 7 64 377 46.107 +6.538 0.497
+162.159.200.1 10.39.8.8 3 u 9 128 377 17.660 +3.786 0.506
the regexp at line 48 does not match
without -w the address is truncated but regexp work and show the right stratum
Sync Source 2001:470:26:5dc (stratum 1, .GPS.)
introduced by Do not truncate IPv6 addresss in NTP widget (Bug #4815)
Updated by Viktor Gurov over 4 years ago
Also NTP status page shows truncated IPv6 address
from ntpq(1):
-w, --wide Display the full 'remote' value. Display the full value of the 'remote' value. If this requires more than 15 characters, display the full value, emit a newline, and continue the data display properly indented on the next line.
This PR fixes both issues:
https://github.com/pfsense/pfsense/pull/4223
Updated by Manuel Piovan over 4 years ago
tested it, work partially
NTP status page is wrong for me the table is shifted of 1 place after the long ipv6 address
NTP widget show
2001:470:26:5dc:ffff:ffff:ffff:fffe (stratum .GPS.)
you can see refid .GPS. but stratum is empty
keep up the good work viktor, you have all my esteem for your hard work !
Updated by Manuel Piovan over 4 years ago
- File Immagine.jpg Immagine.jpg added
- File Immagine2.jpg Immagine2.jpg added
screenshot added
Updated by Viktor Gurov over 4 years ago
Thanks for testing!
Can you show 'ntpq -pn -w' output?
Updated by Manuel Piovan over 4 years ago
- File Immagine3.jpg Immagine3.jpg added
of course
the problwm with the -w flag is that If this requires more than 15 characters, display the full value, emit a newline, and continue the data display properly indented on the next line.
Updated by Jim Pingle over 4 years ago
We've hit that newline issue before with ntpq
output -- see #4815
Probably will break more than it helps by adding -w
in situations where it forces a newline, but perhaps we can find a regex or similar way to parse the output which mitigates that.
Updated by Jim Pingle over 4 years ago
- Status changed from New to Pull Request Review
- Target version set to 2.5.0
Updated by Renato Botelho over 4 years ago
- Status changed from Pull Request Review to Feedback
- Assignee set to Renato Botelho
- % Done changed from 0 to 100
PR has been merged. Thanks!
Updated by Jim Pingle over 4 years ago
- Status changed from Feedback to In Progress
- Assignee changed from Renato Botelho to Jim Pingle
- % Done changed from 100 to 90
Looks like the sed pattern I suggested will skip the last line in certain cases. Need to tinker with it some more. It also doesn't properly handle some peer lines since they can start with a space. That's an easy fix, but the last line being skipped is tougher. The sed N
command has to operate on pairs of lines. I've found some workarounds but so far none have worked properly. Might have to use awk instead, but that is a bit more complex.
Updated by Jim Pingle over 4 years ago
- % Done changed from 90 to 100
I just pushed a new version using awk instead of sed which fixes the reported problem plus the other problem I found.
Updated by Jim Pingle over 4 years ago
- Status changed from In Progress to Feedback
Applied in changeset d09e19adf4253251dc2aa6d9edc3043e69096d4f.
Updated by Ronald Schellberg over 4 years ago
Latest commit appears to work even for the peer on the last line. Thanks
Updated by Manuel Piovan over 4 years ago
yup work ok with my long ipv6 address too
Updated by Viktor Gurov over 4 years ago
- Status changed from Feedback to Resolved
work ok with any address on 2.5.0.a.20200312.1334
Updated by Jim Pingle about 4 years ago
- Category changed from Dashboard to NTPD