https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=228068
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: [email protected]
Reporter: [email protected]
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 field.
It does not appear to be. A similar mapping for TTL should be present, though 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 = socket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP);
if (s < 0) {
perror("socket");
return -1;
}
int value = (40 << 2) & 0xFC;
int ret = setsockopt(s, IPPROTO_IPV6, IPV6_TCLASS, &value, sizeof(value));
if (ret < 0) {
perror("setsockopt");
return -2;
}
struct addrinfo hints;
memset(&hints, 0, sizeof(hints));
struct addrinfo *res = NULL;
ret = getaddrinfo("::ffff:10.10.10.10", "1234", &hints, &res);
if (ret != 0) {
perror("getaddrinfo");
return -3;
}
const char *msg = "hello world";
ssize_t n = sendto(s, msg, strlen(msg), 0, res->ai_addr, res->ai_addrlen);
if (n < 0) {
freeaddrinfo(res);
perror("sendto");
return -4;
}
freeaddrinfo(res);
return 0;
}
--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"