ntp: accept packets from unknown sources only from server sockets

This commit is contained in:
Miroslav Lichvar
2014-03-26 11:15:09 +01:00
parent 727bf195d1
commit 91e74c704b
3 changed files with 23 additions and 0 deletions

View File

@@ -1457,6 +1457,13 @@ NCR_ProcessUnknown
int valid_auth, auth_len;
unsigned long key_id;
/* Ignore the packet if it wasn't received by server socket */
if (!NIO_IsServerSocket(local_addr->sock_fd)) {
DEBUG_LOG(LOGF_NtpCore, "NTP request packet received by client socket %d",
local_addr->sock_fd);
return;
}
/* Check version */
version = (message->lvm >> 3) & 0x7;
if (version < NTP_MIN_COMPAT_VERSION || version > NTP_MAX_COMPAT_VERSION) {