From b24f27ec9fb8d1912b3d11cda95490f7216f5cbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20O=2E=20Sel=C3=A5sdal?= Date: Wed, 4 Dec 2013 23:21:30 +0100 Subject: [PATCH] Mask the upper bits of dscp instead of failing if the user supplied a too big value --- src/fd_utils.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/fd_utils.c b/src/fd_utils.c index e557f60..e14fb12 100644 --- a/src/fd_utils.c +++ b/src/fd_utils.c @@ -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); } -