Skip to content

Commit

Permalink
Fix --dscp (esnet#1162)
Browse files Browse the repository at this point in the history
TOS = DSCP * 4; so shift DSCP << 2
  • Loading branch information
presto8 authored Nov 15, 2021
1 parent 071ee91 commit d424be3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/dscp.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,11 @@ parse_qos(const char *cp)
return ipqos[i].value;
}
/* Try parsing as an integer */
/* Max DSCP value is 2**6 - 1 */
val = strtol(cp, &ep, 0);
if (*cp == '\0' || *ep != '\0' || val < 0 || val > 255)
if (*cp == '\0' || *ep != '\0' || val < 0 || val > 63)
return -1;
return val;
return val << 2;
}

const char *
Expand Down
3 changes: 2 additions & 1 deletion src/iperf3.1
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,8 @@ i.e. 52, 064 and 0x34 all specify the same value.
.TP
.BR "--dscp " \fIdscp\fR
set the IP DSCP bits. Both numeric and symbolic values are accepted. Numeric
values can be specified in decimal, octal and hex (see --tos above).
values can be specified in decimal, octal and hex (see --tos above). To set
both the DSCP bits and the ECN bits, use --tos.
.TP
.BR -L ", " --flowlabel " \fIn\fR"
set the IPv6 flow label (currently only supported on Linux)
Expand Down

0 comments on commit d424be3

Please sign in to comment.