Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NTP status/widget long IPv6 address. Issue #10307 #4223

Merged
merged 1 commit into from
Mar 11, 2020

Conversation

vktg
Copy link
Contributor

@vktg vktg commented Mar 8, 2020

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 )

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

@rbgarga rbgarga requested a review from jim-p March 9, 2020 12:40
Copy link
Contributor

@jim-p jim-p left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of this is unnecessary with the right bit of pre-processing.

If you only change the ntpq call as follows, then it all works with existing code:

exec('/usr/local/sbin/ntpq -pnw ' . $inet_version . ' | /usr/bin/tail +3 | /usr/bin/sed \'N;s/\n\s*//;P;D\'', $ntpq_output);

Trying to pass that sed string through double quoted strings from PHP is a PITA so best to flip to single quotes like shown in my example.

@jim-p
Copy link
Contributor

jim-p commented Mar 9, 2020

Applying the patch as-is didn't work, the lines with a long hostname (like pool placeholders) had an empty ref column and other values were shifted over. See my review comment for a much simpler alternative fix.

@vktg
Copy link
Contributor Author

vktg commented Mar 9, 2020

Testing /usr/local/sbin/ntpq -pnw ' . $inet_version . ' | /usr/bin/tail +3 | /usr/bin/sed \'N;s/\n\s*//;P;D\' I found that it returns only 'oversized', but not 'normal' peer string

@jim-p
Copy link
Contributor

jim-p commented Mar 10, 2020

Hmm, I saw both. But I did find another system where it failed in a different way. Try this instead:

exec('/usr/local/sbin/ntpq -pnw ' . $inet_version . ' | /usr/bin/tail +3 | /usr/bin/sed -E \'N;s/\n[[:blank:]]+/ /;P;D\'', $ntpq_output);

@netgate-git-updates netgate-git-updates merged commit d89c2b2 into pfsense:master Mar 11, 2020
@rschell
Copy link
Contributor

rschell commented Mar 12, 2020

This solution is still not quite right. I'm losing the last peer which happens to be the active one.

for example:
image

results in:
image

the -pnw full results are something like:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants