[Git][NTPsec/ntpsec][master] Fix a bug in handling of the rate-limiting KOD.
Eric S. Raymond
gitlab at mg.gitlab.com
Wed Jan 16 07:03:39 UTC 2019
Eric S. Raymond pushed to branch master at NTPsec / ntpsec
Commits:
611ce349 by Eric S. Raymond at 2019-01-16T07:03:22Z
Fix a bug in handling of the rate-limiting KOD.
The Classic code did the equivalent of this - not identical because
some structures gave been refactored:
if (rbufp->pkt.ppoll > peer->cfg.minpoll)
peer->cfg.minpoll = peer->ppoll;
poll_update(peer, rbufp->pkt.ppoll);
During the Great Refactoring of the protocol machine, Daniel changed
it to this:
if (peer->cfg.minpoll < 10) { peer->cfg.minpoll = 10; }
poll_update(peer, 10);
Thw second line prevented the polling rate from being set arbitrarily
high by a malicious KOD from the server. But the first line
introduced a bug - on receipt of any rate-limiter KOD the client would
get stuck at poll interval 10 and never recover.
This change reverts to allowing the KOD to both adjust the poll
interval and the minimum poll interval, but shortstops malicious
attempts to set them to unhelpfully high values.
- - - - -
1 changed file:
- ntpd/ntp_proto.c
Changes:
=====================================
ntpd/ntp_proto.c
=====================================
@@ -519,10 +519,11 @@ handle_procpkt(
if(!memcmp(rbufp->pkt.refid, "RATE", REFIDLEN)) {
peer->selbroken++;
report_event(PEVNT_RATE, peer, NULL);
- if (peer->cfg.minpoll < 10) { peer->cfg.minpoll = 10; }
peer->burst = peer->retry = 0;
peer->throttle = (NTP_SHIFT + 1) * (1 << peer->cfg.minpoll);
- poll_update(peer, 10);
+ if (rbufp->pkt.ppoll > peer->cfg.minpoll)
+ peer->cfg.minpoll = min(peer->ppoll, 10);
+ poll_update(peer, min(rbufp->pkt.ppoll, 10));
}
return;
}
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/611ce34988a2c9eabaa84ff0af7d240a6b44a9dc
--
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/611ce34988a2c9eabaa84ff0af7d240a6b44a9dc
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20190116/74de5e2c/attachment.html>
More information about the vc
mailing list