summaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@FreeBSD.org>2025-10-26 17:58:15 +0000
committerMichael Tuexen <tuexen@FreeBSD.org>2025-10-31 14:12:22 +0000
commit984a58c13166f9fffe1c7b03d89e3f3d790d07cb (patch)
tree4528a0f7eba26abc5ffa42e90b8b851b306abdf2 /sys/netinet
parent3aa6981e658b84aa0fee879697ae69b70f8c8f9d (diff)
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/udp_usrreq.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index fdde19bc4475..a1000dadf583 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -1182,6 +1182,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;