The branch releng/15.0 has been updated by cperciva:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=bdbb23567f8d9d4d0736927592303dfca599007e

commit bdbb23567f8d9d4d0736927592303dfca599007e
Author:     Michael Tuexen <[email protected]>
AuthorDate: 2025-10-26 17:52:33 +0000
Commit:     Colin Percival <[email protected]>
CommitDate: 2025-10-30 04:21:53 +0000

    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.
    
    Approved by:    re (cperciva)
    Reviewed by:            bz, glebius
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D53346
    
    (cherry picked from commit 3535546a86846ddb0ca5fe4a0689ac635b504459)
    (cherry picked from commit 8f5162f6fc1c8ac9abc55028561bb5b855fe61b8)
---
 sys/netinet/udp_usrreq.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

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

Reply via email to