@@ -416,20 +416,20 @@ ntp_peer_recv (uint8 peer_idx, ntp_peer_t * peer, ntp_packet_t * packet, ntp_tim
416
416
d_log_wprintf (NTP_SERVICE_NAME , IPSTR " invalid ntp version: %u" , IP2STR (& peer -> ipaddr ), packet -> version );
417
417
peer -> state = NTP_PEER_STATE_ERROR ;
418
418
}
419
- else if ((packet -> root_delay .seconds == 0 && packet -> root_delay .fraction == 0 ) ||
420
- (packet -> root_dispersion .seconds == 0 && packet -> root_dispersion .fraction == 0 ) ||
421
- (packet -> reference_ts .seconds == 0 )) {
422
- d_log_wprintf (NTP_SERVICE_NAME , IPSTR " incorrect response" , IP2STR (& peer -> ipaddr ));
423
- peer -> state = NTP_PEER_STATE_ERROR ;
424
- }
425
419
else {
426
420
// calculate RTT median and variance
427
421
sint64_t _x = ntp_time_diff_usec (recv_ts , & packet -> origin_ts );
428
422
sint64_t _y = ntp_time_diff_usec (& packet -> transmit_ts , & packet -> receive_ts );
429
423
//os_printf("-- origin=%d, recv=%d:%d, trans=%d:%d, recv2=%d\n", packet->origin_ts.seconds, packet->receive_ts.seconds, packet->receive_ts.fraction,
430
424
// packet->transmit_ts.seconds, packet->transmit_ts.fraction, recv_ts->seconds);
431
425
432
- if ((_x > 0 ) || (_y > 0 ) || (_x > _y )) { // wrong times
426
+ if ((packet -> root_delay .seconds == 0 && packet -> root_delay .fraction == 0 ) ||
427
+ (packet -> root_dispersion .seconds == 0 && packet -> root_dispersion .fraction == 0 ) ||
428
+ (packet -> reference_ts .seconds == 0 ))
429
+ {
430
+ // wrong response
431
+ }
432
+ else if ((_x > 0 ) || (_y > 0 ) || (_x > _y )) { // wrong times
433
433
os_memcpy (& peer -> peer_ts , & packet -> transmit_ts , sizeof (ntp_timestamp_t ));
434
434
os_memcpy (& peer -> local_ts , recv_ts , sizeof (ntp_timestamp_t ));
435
435
0 commit comments