q_cake: Make fwmark uint instead of int
This will help avoid overflow, since setting it to 0xffffffff would result in -1 when converted to integer, resulting in being "-1", setting the fwmark to 0x00. Signed-off-by: Odin Ugedal <odin@ugedal.com> Acked-by: Toke Høiland-Jørgensen <toke@redhat.com> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
parent
e07c57e94e
commit
6f883f168c
|
|
@ -97,6 +97,7 @@ static int cake_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||
unsigned int interval = 0;
|
||||
unsigned int diffserv = 0;
|
||||
unsigned int memlimit = 0;
|
||||
unsigned int fwmark = 0;
|
||||
unsigned int target = 0;
|
||||
__u64 bandwidth = 0;
|
||||
int ack_filter = -1;
|
||||
|
|
@ -107,7 +108,6 @@ static int cake_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||
int autorate = -1;
|
||||
int ingress = -1;
|
||||
int overhead = 0;
|
||||
int fwmark = -1;
|
||||
int wash = -1;
|
||||
int nat = -1;
|
||||
int atm = -1;
|
||||
|
|
@ -335,15 +335,12 @@ static int cake_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||
return -1;
|
||||
}
|
||||
} else if (strcmp(*argv, "fwmark") == 0) {
|
||||
unsigned int fwm;
|
||||
|
||||
NEXT_ARG();
|
||||
if (get_u32(&fwm, *argv, 0)) {
|
||||
if (get_u32(&fwmark, *argv, 0)) {
|
||||
fprintf(stderr,
|
||||
"Illegal value for \"fwmark\": \"%s\"\n", *argv);
|
||||
return -1;
|
||||
}
|
||||
fwmark = fwm;
|
||||
} else if (strcmp(*argv, "help") == 0) {
|
||||
explain();
|
||||
return -1;
|
||||
|
|
@ -388,7 +385,7 @@ static int cake_parse_opt(struct qdisc_util *qu, int argc, char **argv,
|
|||
if (memlimit)
|
||||
addattr_l(n, 1024, TCA_CAKE_MEMORY, &memlimit,
|
||||
sizeof(memlimit));
|
||||
if (fwmark != -1)
|
||||
if (fwmark)
|
||||
addattr_l(n, 1024, TCA_CAKE_FWMARK, &fwmark,
|
||||
sizeof(fwmark));
|
||||
if (nat != -1)
|
||||
|
|
|
|||
Loading…
Reference in New Issue