Honor the IPPROTO_IPV6-level socket option IPV6_TCLASS when sending an UDP/IPv4 packet on an AF_INET6 socket.
Details
- Reviewers
bz nickbanks_netflix.com peter.lei_ieee.org lstewart glebius - Group Reviewers
transport - Commits
- rG3aa6981e658b: udp: honor IPV6_TCLASS socket option for UDP/IPv4 packets
rGbdbb23567f8d: udp: honor IPV6_TCLASS socket option for UDP/IPv4 packets
rG8f5162f6fc1c: udp: honor IPV6_TCLASS socket option for UDP/IPv4 packets
rG3535546a8684: udp: honor IPV6_TCLASS socket option for UDP/IPv4 packets
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
P.S. This actually reminds me that many years ago, I tried to unionize IPv6 specific fields of inpcb with IPv4. This utterly failed for 4-in-6 connections, so I quickly reverted without due analysis. Maybe should be looked at again.
| sys/netinet/udp_usrreq.c | ||
|---|---|---|
| 1176 | I don't think that style enforces that much syntactic sugar. if (flags & PRUS_IPV6) { should be just fine. The file actually prefers your form, but without extra pair of parentheses. Please at least remove the extra pair. | |
| 1179 | This cast raises a question why do we declare ip6po_tclass in struct ip6_pktopts as int? In ip6_output() we use not more than 8 bits of it, too. When we set it via ioctl(IPV6_TCLASS) we do the same validation. Given that we actually care about size of this structure (see 530c2c30b0c75f1a71df637ae1e09b352f8256cb by Drew), shouldn't we make this field 8-bit? | |
| sys/netinet/udp_usrreq.c | ||
|---|---|---|
| 1176 | No it is not.
(style.9) So what tuexen has is just fine. | |
| 1179 | And please use uint8_t and not u_char if you do as this is networking and not text. We need 7bit u_char one day again and sooo much stuff will explode expecting octets ;-) | |
| sys/netinet/udp_usrreq.c | ||
|---|---|---|
| 1176 |
I removed the extra pair of parentheses. This was a leftover of finding the variant of the patch to put up for review. | |
| 1179 |
The size of the value of the cmsg and the size to be used in [gs]etsockopt is specified in RFC 3542, but we can store it differently.
Can we split this in two things:
| |
| 1179 |
tos is declared as u_char, other casts in this function use u_char for tos and the type in struct ip uses u_char. I agree, uint8_t is much better, but that should be changed in a consistent way, I think. | |
I did not mean that changing of size of ip6po_tclass in struct ip6_pktopts should be part of this change, of course. Just noticed this thing and suggested an improvement.