tc: fill in handle before checking argc
When deleting a specific basic filter with handle, tc command always ignores the 'handle' option, so tcm_handle is always 0 and kernel deletes all filters in the selected group. This is wrong, we should respect 'handle' in cmdline. Cc: Jamal Hadi Salim <jhs@mojatatu.com> Cc: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
This commit is contained in:
parent
f7dd7e5e71
commit
285e7768e8
|
|
@ -43,9 +43,6 @@ static int basic_parse_opt(struct filter_util *qu, char *handle,
|
||||||
struct rtattr *tail;
|
struct rtattr *tail;
|
||||||
long h = 0;
|
long h = 0;
|
||||||
|
|
||||||
if (argc == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (handle) {
|
if (handle) {
|
||||||
h = strtol(handle, NULL, 0);
|
h = strtol(handle, NULL, 0);
|
||||||
if (h == LONG_MIN || h == LONG_MAX) {
|
if (h == LONG_MIN || h == LONG_MAX) {
|
||||||
|
|
@ -54,9 +51,11 @@ static int basic_parse_opt(struct filter_util *qu, char *handle,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
t->tcm_handle = h;
|
t->tcm_handle = h;
|
||||||
|
|
||||||
|
if (argc == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
|
tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
|
||||||
addattr_l(n, MAX_MSG, TCA_OPTIONS, NULL, 0);
|
addattr_l(n, MAX_MSG, TCA_OPTIONS, NULL, 0);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue