← Commit list

afb5d8b2d

Denys Vlasenko
Denys Vlasenko
2020-09-29
SUCCESS Duration: 149s

Subject

ntpd: fix the case where two replies received at once and first one causes a step

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

networking/ntpd.c+9 -0
@@ -2025,6 +2025,15 @@ recv_and_process_peer_pkt(peer_t *p)
offset = 0;
+ /* The below can happen as follows:
+ * = we receive two peer rsponses at once.
+ * = recv_and_process_peer_pkt(PEER1) -> update_local_clock()
+ * -> step_time() and it closes all other fds, sets all ->fd to -1.
+ * = recv_and_process_peer_pkt(PEER2) sees PEER2->fd == -1
+ */
+ if (p->p_fd < 0)
+ return;
+
/* We can recvfrom here and check from.IP, but some multihomed
* ntp servers reply from their *other IP*.
* TODO: maybe we should check at least what we can: from.port == 123?