mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-04 17:45:07 -05:00
ntp: check if packet was received by right socket
This commit is contained in:
@@ -1275,6 +1275,7 @@ NCR_ProcessKnown
|
||||
struct timeval *now, /* timestamp at time of receipt */
|
||||
double now_err,
|
||||
NCR_Instance inst, /* the instance record for this peer/server */
|
||||
int sock_fd, /* the receiving socket */
|
||||
int length /* the length of the received packet */
|
||||
)
|
||||
{
|
||||
@@ -1282,6 +1283,14 @@ NCR_ProcessKnown
|
||||
int version;
|
||||
int auth_len;
|
||||
|
||||
/* Make sure the packet was received by the sending socket */
|
||||
if (sock_fd != inst->local_addr.sock_fd) {
|
||||
DEBUG_LOG(LOGF_NtpCore,
|
||||
"Packet received by wrong socket %d (expected %d)",
|
||||
sock_fd, inst->local_addr.sock_fd);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Ignore packets from offline sources */
|
||||
if (inst->opmode == MD_OFFLINE) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user