Hi Miroslav

I use chrony 3.5 on Centos 6.10, linux 2.6.32-754.29.2.el6.x86_64.
I compiled chrony from sources with gcc version 7.3.1 20180303 (Red Hat 
7.3.1-5) (GCC)

The servers are VM guests under HyperV.
Pls see the configuration.

I send you also our simplified POC test.


Many thanks for your attention, Massimo

________________________________________
Da: Miroslav Lichvar <[email protected]>
Inviato: mercoledì 27 maggio 2020 08:53
A: [email protected]
Oggetto: Re: [chrony-users] Checking chrony daemon status via NTP3 protocol

On Tue, May 26, 2020 at 05:49:15PM +0000, SALA MASSIMO wrote:
> Hi
>
> I apologize in advace if my question is trivial.
>
> The daemon is stopped (ver 3.5).
> I start it and send a NTP3 CLIENT query, to localhost port 123/udp:
>     NTP_VERSION << 3 | NTP_MODE_CLIENT
>
> The first answer has the status 0xdc : the bit NTP_LEAP_NOTSYNC is set.
> Good: the daemon is starting and looking for the Ntp servers.
>
> I query again the daemon, and in the following replies from the server:
> * the status is OK : 0x1c
> * the  server time (reference timestamp, at offset 16 of the Udp packet 
> payload) is incorrect.

This sounds like a bug. In a quick test with the current development
code and chrony-3.5 I didn't see this behavior.

How is your server configured?

--
Miroslav Lichvar


--
To unsubscribe email [email protected]
with "unsubscribe" in the subject.
For help email [email protected]
with "help" in the subject.
Trouble?  Email [email protected].



[ATS logo]
Le informazioni contenute in questo messaggio e nei suoi allegati sono ad 
esclusivo beneficio del corretto destinatario e sono da considerarsi 
confidenziali e riservate. Qualora abbiate ricevuto il messaggio per errore, 
siete pregati di darne immediata notizia al mittente e di provvedere alla sua 
cancellazione. La rivelazione del contenuto di corrispondenza destinata ad 
altri e ricevuta per errore è perseguibile penalmente e può costituire un 
trattamento illecito di dati personali.

This e-mail and any attachment is confidential and only for use of the intended 
recipient. If you are not the intended recipient, you are hereby notified that 
any disclosure of this communication is strictly prohibited. If you have 
received this communication in error, please notify the sender, and then delete 
this message from your system.

Prima di stampare, pensa all’ambiente.

Attachment: chrony.conf
Description: chrony.conf

#!/usr/bin/env python

import sys, socket, struct, time

NTP_VERSION = 3
NTP_MODE_CLIENT = 3
NTP_TS_REFERENCE_OFS = 16       # reference timestamp
UNIX_EPOCH = 2208988800

if len(sys.argv) == 1 :
        sys.exit("Usage: ntp_test.py <host>")

host = sys.argv[1]
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.settimeout(5)

payload = chr((NTP_VERSION << 3) | NTP_MODE_CLIENT) + 47 * chr(0)
s.connect((host, 123))
while True :
        s.send(payload)
        resp = s.recv(4096)
        if resp :
                #print "rx", len(resp), repr(resp.replace('\0', '.'))
                t = struct.unpack(">I4", resp[NTP_TS_REFERENCE_OFS : 
NTP_TS_REFERENCE_OFS + 4])[0]
                print t - UNIX_EPOCH
        time.sleep(1)

Reply via email to