mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 16:35:06 -05:00
ntp: don't send packets with RX/TX timestamp equal to another timestamp
Before sending a new packet, check if the receive/transmit timestamp is not equal to the origin timestamp or the previous receive/transmit timestamp in order to prevent the packet from being its own valid response (in the symmetric mode) and invalidate responses to the previous packet. This improves protection against replay attacks in the symmetric mode.
This commit is contained in:
4
util.h
4
util.h
@@ -136,6 +136,10 @@ extern int UTI_IsZeroNtp64(NTP_int64 *ts);
|
||||
b, and 1 if a is after b. */
|
||||
extern int UTI_CompareNtp64(NTP_int64 *a, NTP_int64 *b);
|
||||
|
||||
/* Compare an NTP timestamp with up to three other timestamps. Returns 0
|
||||
if a is not equal to any of b1, b2, and b3, 1 otherwise. */
|
||||
extern int UTI_IsEqualAnyNtp64(NTP_int64 *a, NTP_int64 *b1, NTP_int64 *b2, NTP_int64 *b3);
|
||||
|
||||
/* Convert a timespec into an NTP timestamp */
|
||||
extern void UTI_TimespecToNtp64(struct timespec *src, NTP_int64 *dest, NTP_int64 *fuzz);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user