mirror of
https://github.com/openvswitch/ovs
synced 2025-10-25 15:07:05 +00:00
socket-util: Disable dscp setting on Windows.
According to msdn documentation, one is discouraged from using IP_TOS for ipv4 sockets (it apparently does not actually set anything). Also, IPV6_TCLASS does not work in Windows (it always returns an error and also is undocumented). Looks like Microsoft recommends QoS2 APIs to achieve the same. Till we add those API calls, simply return on Windows. (Noticed while running unit tests for ipv6. set_dscp would fail.) Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
@@ -93,6 +93,11 @@ set_dscp(int fd, uint8_t dscp)
|
||||
int val;
|
||||
bool success;
|
||||
|
||||
#ifdef _WIN32
|
||||
/* XXX: Consider using QoS2 APIs for Windows to set dscp. */
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
if (dscp > 63) {
|
||||
return EINVAL;
|
||||
}
|
||||
@@ -101,22 +106,14 @@ set_dscp(int fd, uint8_t dscp)
|
||||
success = false;
|
||||
val = dscp << 2;
|
||||
if (setsockopt(fd, IPPROTO_IP, IP_TOS, &val, sizeof val)) {
|
||||
#ifndef _WIN32
|
||||
if (sock_errno() != ENOPROTOOPT) {
|
||||
#else
|
||||
if (sock_errno() != WSAENOPROTOOPT) {
|
||||
#endif
|
||||
return sock_errno();
|
||||
}
|
||||
} else {
|
||||
success = true;
|
||||
}
|
||||
if (setsockopt(fd, IPPROTO_IPV6, IPV6_TCLASS, &val, sizeof val)) {
|
||||
#ifndef _WIN32
|
||||
if (sock_errno() != ENOPROTOOPT) {
|
||||
#else
|
||||
if (sock_errno() != WSAENOPROTOOPT) {
|
||||
#endif
|
||||
return sock_errno();
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user