refid_str meets Facebook's servers

Hal Murray halmurray at sonic.net
Thu Jun 16 08:20:57 UTC 2022


I'm working on #733 -- teaching ntpstats to record info for rejected 
responses.  I have the code working so I'm playing with hack scripts to search 
for interesting cases.  That uncovered an interesting quirk.

refid_str is only used by record_raw_stats in ntp_util.
It was used by ntpq before it was converted to python.

It converts a refid to a string.  For stratum 1, the refid is text, like 
"GPS".  That gets converted to ".GPS."  The forth slot in the GPS case is 0/NUL

Facebook is returning "FB  ".  It is padding with spaces rather than NULs.  So 
refid_str turns that into ".FB  .".  I assume the extra dots are quote marks 
to show the spaces.

The down side of that is that Python's string.split turns that into 2 words: 
".FB" and ".".

Anybody object if I "fix" that by dropping trailing spaces?
And then drop the "."s which are just clutter?

While I am in there, should I translate all non-printing characters to "?" or 
something like that?


-- 
These are my opinions.  I hate spam.





More information about the devel mailing list