The branch stable/14 has been updated by tuexen:

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

commit 3aa6981e658b84aa0fee879697ae69b70f8c8f9d
Author:     Michael Tuexen <[email protected]>
AuthorDate: 2025-10-26 17:52:33 +0000
Commit:     Michael Tuexen <[email protected]>
CommitDate: 2025-10-31 14:11:40 +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.
    
    Reviewed by:            bz, glebius
    Sponsored by:           Netflix, Inc.
    Differential Revision:  https://reviews.freebsd.org/D53346
    
    (cherry picked from commit 3535546a86846ddb0ca5fe4a0689ac635b504459)
---
 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 ffffaa684f52..fdde19bc4475 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -1146,7 +1146,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