diff options
| author | Michael Tuexen <tuexen@FreeBSD.org> | 2025-10-26 17:52:33 +0000 |
|---|---|---|
| committer | Michael Tuexen <tuexen@FreeBSD.org> | 2025-10-26 17:52:33 +0000 |
| commit | 3535546a86846ddb0ca5fe4a0689ac635b504459 (patch) | |
| tree | 35aa73f90d6d437ceb8ce0efa162589c9e41d370 | |
| parent | 1c8d7bb4cf7a6b19262333b2a9b1dacf3094b938 (diff) | |
udp: honor IPV6_TCLASS socket option for UDP/IPv4 packets
Honor the IPPROTO_IPV6-level socket option IPV6_TCLASS when sending
an UDP/IPv4 packet on an AF_INET6 socket.
Reviewed by: bz, glebius
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D53346
| -rw-r--r-- | sys/netinet/udp_usrreq.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 04d01099d54a..6ce1bcce6fc6 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1172,7 +1172,19 @@ udp_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *addr, else INP_RLOCK(inp); NET_EPOCH_ENTER(et); +#ifdef INET6 + if ((flags & PRUS_IPV6) != 0) { + if ((inp->in6p_outputopts != NULL) && + (inp->in6p_outputopts->ip6po_tclass != -1)) + tos = (u_char)inp->in6p_outputopts->ip6po_tclass; + else + tos = 0; + } else { + tos = inp->inp_ip_tos; + } +#else tos = inp->inp_ip_tos; +#endif if (control != NULL) { /* * XXX: Currently, we assume all the optional information is |
