Date: Wed, 29 Oct 2025 09:12:42 GMT From: Michael Tuexen <tuexen@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: e31ff080e5d5 - stable/15 - udp: honor IPV6_TCLASS cmsg for UDP/IPv4 packets Message-ID: <202510290912.59T9Cgfg015017@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=e31ff080e5d55a0f4864177e9fc7b58e7083b095 commit e31ff080e5d55a0f4864177e9fc7b58e7083b095 Author: Michael Tuexen <tuexen@FreeBSD.org> AuthorDate: 2025-10-26 17:58:15 +0000 Commit: Michael Tuexen <tuexen@FreeBSD.org> CommitDate: 2025-10-29 09:08:59 +0000 udp: honor IPV6_TCLASS cmsg for UDP/IPv4 packets Honor the IPPROTO_IPV6-level cmsg of type IPV6_TCLASS when sending an UDP/IPv4 packet on an AF_INET6 socket. Reviewed by: bz Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D53347 (cherry picked from commit d3a3854fdc6e8da3bc6c1c13aab8d371445d2914) --- sys/netinet/udp_usrreq.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 6ce1bcce6fc6..f1d952037d5a 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1208,6 +1208,23 @@ udp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, error = udp_v4mapped_pktinfo(cm, &src, inp, flags); if (error != 0) break; + if (((flags & PRUS_IPV6) != 0) && + (cm->cmsg_level == IPPROTO_IPV6) && + (cm->cmsg_type == IPV6_TCLASS)) { + int tclass; + + if (cm->cmsg_len != CMSG_LEN(sizeof(int))) { + error = EINVAL; + break; + } + tclass = *(int *)CMSG_DATA(cm); + if (tclass < -1 || tclass > 255) { + error = EINVAL; + break; + } + if (tclass != -1) + tos = (u_char)tclass; + } #endif if (cm->cmsg_level != IPPROTO_IP) continue;home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202510290912.59T9Cgfg015017>
