if IPV6_TCLASS isn't defined do something reasonable

This commit is contained in:
Jon Dugan 2010-09-08 20:33:54 +00:00
parent 2c206d5456
commit 009a41300f

View File

@ -1388,10 +1388,15 @@ iperf_init_stream(struct iperf_stream *sp, struct iperf_test *test)
/* Set IP TOS */
if ((opt = test->settings->tos)) {
if (test->settings->domain == AF_INET6) {
#ifdef IPV6_TCLASS
if (setsockopt(sp->socket, IPPROTO_IPV6, IPV6_TCLASS, &opt, sizeof(opt)) < 0) {
i_errno = IESETCOS;
return (-1);
}
#else
i_errno = IESETCOS;
return (-1);
#endif
} else {
if (setsockopt(sp->socket, IPPROTO_IP, IP_TOS, &opt, sizeof(opt)) < 0) {
i_errno = IESETTOS;