mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-11-07 04:36:52 -10:00
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 MFC after: 3 days Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D53347
This commit is contained in:
1 parent
3535546a86
commit
d3a3854fdc
1 file changed
+17
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user