Date: Tue, 08 May 2018 13:40:57 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 228068] tclass is not used when sending to IPv4 mapped address via IPv6 socket Message-ID: <bug-228068-227@https.bugs.freebsd.org/bugzilla/>
next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D228068 Bug ID: 228068 Summary: tclass is not used when sending to IPv4 mapped address via IPv6 socket Product: Base System Version: 11.1-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: preynold.freebsd@gmail.com When sending a udp packet from an IPv6 socket to an IPv4 mapped address, I would expect the setting for IPV6_TCLASS to be used in the TOS IP header fi= eld. It does not appear to be. A similar mapping for TTL should be present, thou= gh I did not check for that. Can be seen with a simple c program and wireshark: #include <stdio.h> #include <string.h> #include <netinet/in.h> #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> int main() { int s =3D socket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP); if (s < 0) { perror("socket"); return -1; } int value =3D (40 << 2) & 0xFC; int ret =3D setsockopt(s, IPPROTO_IPV6, IPV6_TCLASS, &value, sizeof(va= lue)); if (ret < 0) { perror("setsockopt"); return -2; } struct addrinfo hints; memset(&hints, 0, sizeof(hints)); struct addrinfo *res =3D NULL; ret =3D getaddrinfo("::ffff:10.10.10.10", "1234", &hints, &res); if (ret !=3D 0) { perror("getaddrinfo"); return -3; } const char *msg =3D "hello world"; ssize_t n =3D sendto(s, msg, strlen(msg), 0, res->ai_addr, res->ai_add= rlen); if (n < 0) { freeaddrinfo(res); perror("sendto"); return -4; } freeaddrinfo(res); return 0; } --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-228068-227>