[PATCH 5/9] ntp: Support NTPv3 protocol version

Patrik Flykt patrik.flykt at linux.intel.com
Mon Sep 16 00:29:47 PDT 2013


On Tue, 2013-09-10 at 15:46 +0200, Peter Meerwald wrote:
> NTPv3 is advertised by Windows 7, but only v4 is accepted
> 
> rc/ntp.c:send_timeout() send timeout (retries 1)
> src/ntp.c:decode_msg() flags : 0x1c
> src/ntp.c:decode_msg() stratum : 1
> src/ntp.c:decode_msg() poll : 1024.000000 seconds (10)
> src/ntp.c:decode_msg() precision : 0.015625 seconds (-6)
> src/ntp.c:decode_msg() root delay : 0 seconds (fraction 0)
> src/ntp.c:decode_msg() root disp. : 2560 seconds (fraction 19716)
> src/ntp.c:decode_msg() reference : 0x4c434f4c
> src/ntp.c:decode_msg() unsupported version 3
> connmand[21770]: src/ntp.c:decode_msg() flags : 0x1c
> connmand[21770]: src/ntp.c:decode_msg() stratum : 1
> connmand[21770]: src/ntp.c:decode_msg() poll : 1024.000000 seconds (10)
> connmand[21770]: src/ntp.c:decode_msg() precision : 0.015625 seconds (-6)
> connmand[21770]: src/ntp.c:decode_msg() root delay : 0 seconds (fraction 0)
> connmand[21770]: src/ntp.c:decode_msg() root disp. : 2560 seconds (fraction 19716)
> connmand[21770]: src/ntp.c:decode_msg() reference : 0x4c434f4c
> connmand[21770]: src/ntp.c:decode_msg() unsupported version 3
> 
> enable v3 also
> ---
>  src/ntp.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/ntp.c b/src/ntp.c
> index 6db9af7..a1013e1 100644
> --- a/src/ntp.c
> +++ b/src/ntp.c
> @@ -253,7 +253,7 @@ static void decode_msg(void *base, size_t len, struct timeval *tv,
>  		return;
>  	}
>  
> -	if (NTP_FLAGS_VN_DECODE(msg->flags) != 4) {
> +	if (NTP_FLAGS_VN_DECODE(msg->flags) != 3 && NTP_FLAGS_VN_DECODE(msg->flags) != 4) {
>  		DBG("unsupported version %d", NTP_FLAGS_VN_DECODE(msg->flags));
>  		return;
>  	}

When we're sending an NTP packet, the version number is always set to 4.
That probably doesn't work very well with a bunch of other NTP servers?

Cheers,

	Patrik




More information about the connman mailing list