]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
socket: increase message buffer length
authorMiroslav Lichvar <mlichvar@redhat.com>
Tue, 26 Oct 2021 13:40:09 +0000 (15:40 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 27 Oct 2021 14:22:12 +0000 (16:22 +0200)
Add extra space to the socket message buffer to be able to receive
maximum-length NTP-over-PTP SW/HW-timestamped messages from the Linux
error queue (which are looped back as layer-2 frames).

socket.c

index a6010d80a5d66d05c33fc71d70a10cc7e2080fa0..860fa0f2642e1d78833391587edfdc6201f760df 100644 (file)
--- a/socket.c
+++ b/socket.c
@@ -59,11 +59,16 @@ struct Message {
   union sockaddr_all name;
   struct iovec iov;
   /* Buffer of sufficient length for all expected messages */
-  union {
-    NTP_Packet ntp_msg;
-    PTP_NtpMessage ptp_msg;
-    CMD_Request cmd_request;
-    CMD_Reply cmd_reply;
+  struct {
+    /* Extra space for Ethernet, IPv4/IPv6, and UDP headers in
+       timestamped messages received from the Linux error queue */
+    uint8_t l234_headers[64];
+    union {
+      NTP_Packet ntp_msg;
+      PTP_NtpMessage ptp_msg;
+      CMD_Request cmd_request;
+      CMD_Reply cmd_reply;
+    } msg;
   } msg_buf;
   /* Aligned buffer for control messages */
   struct cmsghdr cmsg_buf[CMSG_BUF_SIZE / sizeof (struct cmsghdr)];