[ntp:questions] empty refid in ntpq output
Steven Sommars
stevesommarsntp at gmail.com
Fri May 3 14:05:46 UTC 2019
See NTP bug 3484, http://bugs.ntp.org/show_bug.cgi?id=3484,
"ntpq response from ntpd is incorrect when REFID is null"
On Fri, May 3, 2019 at 4:21 AM <Greg.Dowd at microchip.com> wrote:
> I have seen this myself. IIRC, when the input for refid ID is exactly
> \0\0\0\0 then it is displayed as "blank" in ntpq output. And maybe only if
> it is stratum 1? Anything else gets at least a . char in the string
> conversion routine. And if it is s2 or higher, I think it is parsed
> differently with an addr string for 4 and a hash print for 6. NTPd is
> fine, this is only the string formatting code for ntpq where this is
> introduced. You might be able to count fields and stuff, or used fixed
> length parse, or you could change that 1 piece of code around line 1707 in
> ntpq-subs.c
> } else if (!strcmp("refid", name)) {
> if ( (pvl == peervarlist)
> && (drefid == REFID_IPV4)) {
> have_da_rid = TRUE;
> drlen = strlen(value);
> >>>> if (0 == drlen) {
> >>>> dstadr_refid = "";
> } else if (drlen <= 4) {
> ZERO(u32);
> memcpy(&u32, value, drlen);
> dstadr_refid = refid_str(u32, 1);
>
> Greg Dowd
> Principal Engineering Technologist, FTD
> Microsemi
> 3870 N. First St. | San Jose | CA 95134 | USA
> Office: 408.964.7643
> Email: greg.dowd at microchip.com
> Company Website: www.microsemi.com
>
>
>
> -----Original Message-----
> From: questions [mailto:questions-bounces+greg.dowd=
> microsemi.com at lists.ntp.org] On Behalf Of Daniel Nelson
> Sent: Tuesday, April 30, 2019 10:43 AM
> To: questions at lists.ntp.org
> Subject: [ntp:questions] empty refid in ntpq output
>
> External E-Mail
>
>
> I'm working on a project that attempts to parse the output of `ntpq -p`,
> and have heard a report that sometimes the refid is empty. Here is the
> output I'm seeing, the indention was mangled by the logging system, so I've
> attempted to realign things below:
>
> remote refid st t when poll reach delay offset jitter
>
> ==============================================================================
> 0.ubuntu.pool.n .POOL. 16 p - 64 0 0.000 0.000 0.000
> +198.1.1.1 16 u 1048 1024 376 15.384 -0.538 0.943
>
> My question is, what does an empty refid indicate and are there any tips
> for machine parsing the output correctly given that the lines may have a
> differing number of columns.
> _______________________________________________
> questions mailing list
> questions at lists.ntp.org
> http://lists.ntp.org/listinfo/questions
>
> _______________________________________________
> questions mailing list
> questions at lists.ntp.org
> http://lists.ntp.org/listinfo/questions
>
More information about the questions
mailing list