git: 0838f527c3aa - main - net/openntpd: fix for NICs with hardware timestamp support
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 05 May 2023 22:01:20 UTC
The branch main has been updated by naddy: URL: https://cgit.FreeBSD.org/ports/commit/?id=0838f527c3aa5a90e949d33e6331dcba12041ca1 commit 0838f527c3aa5a90e949d33e6331dcba12041ca1 Author: Christian Weisgerber <naddy@FreeBSD.org> AuthorDate: 2023-05-05 20:07:32 +0000 Commit: Christian Weisgerber <naddy@FreeBSD.org> CommitDate: 2023-05-05 22:01:17 +0000 net/openntpd: fix for NICs with hardware timestamp support OpenNTPD enables the reception of a timestamp with datagrams. Network adapters that support hardware timestamping of packets, e.g. mlx5en(4), create a SCM_TIME_INFO control message in addition to the SCM_TIMESTAMP one. Provide a sufficiently large buffer to accommodate this and avoid a MSG_CTRUNC error. PR: 271224 Obtained from: Dmitry Wagin <dmitry.wagin@ya.ru> --- net/openntpd/Makefile | 2 +- net/openntpd/files/patch-src_client.c | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/net/openntpd/Makefile b/net/openntpd/Makefile index 504bcf75fa60..4c1046e3e0dd 100644 --- a/net/openntpd/Makefile +++ b/net/openntpd/Makefile @@ -1,6 +1,6 @@ PORTNAME= openntpd PORTVERSION= 6.8p1 -PORTREVISION= 6 +PORTREVISION= 7 PORTEPOCH= 2 CATEGORIES= net MASTER_SITES= OPENBSD/OpenNTPD diff --git a/net/openntpd/files/patch-src_client.c b/net/openntpd/files/patch-src_client.c new file mode 100644 index 000000000000..88a1ecf36749 --- /dev/null +++ b/net/openntpd/files/patch-src_client.c @@ -0,0 +1,25 @@ +--- src/client.c.orig 2023-05-05 18:43:35 UTC ++++ src/client.c +@@ -274,6 +274,13 @@ handle_auto(uint8_t trusted, double offset) + } + + ++#ifdef SCM_TIME_INFO ++#define CMSG_MAXLEN (CMSG_SPACE(sizeof(struct timeval)) + \ ++ CMSG_SPACE(sizeof(struct sock_timestamp_info))) ++#else ++#define CMSG_MAXLEN CMSG_SPACE(sizeof(struct timeval)) ++#endif ++ + /* + * -1: Not processed, not an NTP message (e.g. icmp induced ECONNREFUSED) + * 0: Not prrocessed due to validation issues +@@ -289,7 +296,7 @@ client_dispatch(struct ntp_peer *p, u_int8_t settime, + char buf[NTP_MSGSIZE]; + union { + struct cmsghdr hdr; +- char buf[CMSG_SPACE(sizeof(tv))]; ++ char buf[CMSG_MAXLEN]; + } cmsgbuf; + #ifdef SO_TIMESTAMP + struct cmsghdr *cmsg;