[PATCH] Use NTP packet only when both header and data are valid |
[ Thread Index |
Date Index
| More chrony.tuxfamily.org/chrony-dev Archives
]
- Subject: [PATCH] Use NTP packet only when both header and data are valid
- From: Miroslav Lichvar <mlichvar@xxxxxxxxxx>
- Date: Wed, 11 Nov 2009 17:55:15 +0100
---
ntp_core.c | 18 ++++--------------
1 files changed, 4 insertions(+), 14 deletions(-)
diff --git a/ntp_core.c b/ntp_core.c
index 66434ad..85ed1c5 100644
--- a/ntp_core.c
+++ b/ntp_core.c
@@ -1009,8 +1009,7 @@ receive_packet(NTP_Packet *message, struct timeval *now, NCR_Instance inst, int
}
/* Test 7 checks that the stratum in the packet is appropriate */
- if ((message->stratum > REF_GetOurStratum()) ||
- (message->stratum > NTP_MAX_STRATUM)) {
+ if (message->stratum > NTP_MAX_STRATUM) {
test7 = 0; /* Failed */
} else {
test7 = 1;
@@ -1071,26 +1070,17 @@ receive_packet(NTP_Packet *message, struct timeval *now, NCR_Instance inst, int
LOG(LOGS_INFO, LOGF_NtpCore, "kod_rate=%d valid_kod=%d", kod_rate, valid_kod);
#endif
- if (valid_header) {
- inst->tx_count = 0;
- SRC_SetReachable(inst->source);
- }
-
/* Do this before we accumulate a new sample into the stats registers, obviously */
estimated_offset = SRC_PredictOffset(inst->source, &sample_time);
- if (valid_data) {
+ if (valid_header && valid_data) {
+ inst->tx_count = 0;
+ SRC_SetReachable(inst->source);
SRC_AccumulateSample(inst->source,
&sample_time,
theta, delta, epsilon,
root_delay, root_dispersion,
message->stratum, (NTP_Leap) pkt_leap);
- }
-
-
- /* Only do performance monitoring if we got valid data! */
-
- if (valid_data) {
/* Now examine the registers. First though, if the prediction is
not even within +/- the peer distance of the peer, we are clearly
--
1.6.2.5
--d9ADC0YsG2v16Js0--
---
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble? Email listmaster@xxxxxxxxxxxxxxxxxxxx.