iproute2: tc netem rate: allow negative packet/cell overhead
by fixing the parsing of command-line tokens Signed-off-by: Johannes Naab <jn@stusta.de>
This commit is contained in:
parent
d36035185c
commit
e72ca3fbb0
|
|
@ -147,6 +147,8 @@ static int get_distribution(const char *type, __s16 *data, int maxdata)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define NEXT_IS_NUMBER() (NEXT_ARG_OK() && isdigit(argv[1][0]))
|
#define NEXT_IS_NUMBER() (NEXT_ARG_OK() && isdigit(argv[1][0]))
|
||||||
|
#define NEXT_IS_SIGNED_NUMBER() \
|
||||||
|
(NEXT_ARG_OK() && (isdigit(argv[1][0]) || argv[1][0] == '-'))
|
||||||
|
|
||||||
/* Adjust for the fact that psched_ticks aren't always usecs
|
/* Adjust for the fact that psched_ticks aren't always usecs
|
||||||
(based on kernel PSCHED_CLOCK configuration */
|
(based on kernel PSCHED_CLOCK configuration */
|
||||||
|
|
@ -393,7 +395,7 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
||||||
explain1("rate");
|
explain1("rate");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (NEXT_IS_NUMBER()) {
|
if (NEXT_IS_SIGNED_NUMBER()) {
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
if (get_s32(&rate.packet_overhead, *argv, 0)) {
|
if (get_s32(&rate.packet_overhead, *argv, 0)) {
|
||||||
explain1("rate");
|
explain1("rate");
|
||||||
|
|
@ -407,7 +409,7 @@ static int netem_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (NEXT_IS_NUMBER()) {
|
if (NEXT_IS_SIGNED_NUMBER()) {
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
if (get_s32(&rate.cell_overhead, *argv, 0)) {
|
if (get_s32(&rate.cell_overhead, *argv, 0)) {
|
||||||
explain1("rate");
|
explain1("rate");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue