Mask the upper bits of dscp instead of failing if the user
supplied a too big value
This commit is contained in:
+1
-7
@@ -89,14 +89,8 @@ int uc_set_ip_dscp(int fd, unsigned int dscp)
|
||||
int val;
|
||||
|
||||
//only 6 bits for dscp
|
||||
if (dscp > 63) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
val = dscp << 2;
|
||||
val = (dscp & 0x3f) << 2;
|
||||
|
||||
return setsockopt(fd, IPPROTO_IP, IP_TOS, &val, sizeof val);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user