Mask the upper bits of dscp instead of failing if the user

supplied a too big value
This commit is contained in:
Nils O. Selåsdal
2013-12-04 23:21:30 +01:00
parent b5e1d086a4
commit b24f27ec9f
+1 -7
View File
@@ -89,14 +89,8 @@ int uc_set_ip_dscp(int fd, unsigned int dscp)
int val; int val;
//only 6 bits for dscp //only 6 bits for dscp
if (dscp > 63) { val = (dscp & 0x3f) << 2;
errno = EINVAL;
return -1;
}
val = dscp << 2;
return setsockopt(fd, IPPROTO_IP, IP_TOS, &val, sizeof val); return setsockopt(fd, IPPROTO_IP, IP_TOS, &val, sizeof val);
} }