mirror of
https://github.com/ParrotXray/Mantis.git
synced 2026-08-24 18:50:28 +09:00
fix: detect NTP direction via mode byte (RFC 5905)
This commit is contained in:
parent
045f194ae5
commit
9a4b50ed96
@ -450,5 +450,19 @@ fn detect_initiator(payload: &[u8], protocol: u8, src_port: u16, dst_port: u16)
|
||||
return Some((payload[2] >> 7) == 0);
|
||||
}
|
||||
|
||||
// NTP over UDP (port 123, RFC 5905): byte 0, bits 2-0 = mode.
|
||||
// 3 = client (initiator), 4 = server (responder)
|
||||
// Handles the symmetric case where both src and dst use port 123.
|
||||
if protocol == 17 && (src_port == 123 || dst_port == 123) {
|
||||
let mode = payload[0] & 0x07;
|
||||
if mode == 3 {
|
||||
return Some(true);
|
||||
}
|
||||
if mode == 4 {
|
||||
return Some(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user