tc: filter: validate filter priority in userspace.
Because we use the high 16 bits of tcm_info to pass prio value to kernel, thus it's range would be [0, 0xffff], without validation in tc when user pass a lager(>65535) priority, the actual priority set in kernel would confuse the user. So, add a validation to ensure prio in the range.
This commit is contained in:
parent
690b11f4a6
commit
424adc19bf
|
|
@ -105,7 +105,7 @@ int tc_filter_modify(int cmd, unsigned flags, int argc, char **argv)
|
||||||
NEXT_ARG();
|
NEXT_ARG();
|
||||||
if (prio)
|
if (prio)
|
||||||
duparg("priority", *argv);
|
duparg("priority", *argv);
|
||||||
if (get_u32(&prio, *argv, 0))
|
if (get_u32(&prio, *argv, 0) || prio > 0xFFFF)
|
||||||
invarg(*argv, "invalid priority value");
|
invarg(*argv, "invalid priority value");
|
||||||
} else if (matches(*argv, "protocol") == 0) {
|
} else if (matches(*argv, "protocol") == 0) {
|
||||||
__u16 id;
|
__u16 id;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue