All of lore.kernel.org
 help / color / mirror / Atom feed
* [Patch iproute2] tc: fill in handle before checking argc
@ 2015-05-05 22:30 Cong Wang
  2015-05-11 16:13 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Cong Wang @ 2015-05-05 22:30 UTC (permalink / raw)
  To: netdev; +Cc: Cong Wang, Jamal Hadi Salim, Stephen Hemminger

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>
---
 tc/f_basic.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/tc/f_basic.c b/tc/f_basic.c
index 1c33ca3..4adf1d2 100644
--- a/tc/f_basic.c
+++ b/tc/f_basic.c
@@ -43,9 +43,6 @@ static int basic_parse_opt(struct filter_util *qu, char *handle,
 	struct rtattr *tail;
 	long h = 0;
 
-	if (argc == 0)
-		return 0;
-
 	if (handle) {
 		h = strtol(handle, NULL, 0);
 		if (h == LONG_MIN || h == LONG_MAX) {
@@ -54,9 +51,11 @@ static int basic_parse_opt(struct filter_util *qu, char *handle,
 			return -1;
 		}
 	}
-
 	t->tcm_handle = h;
 
+	if (argc == 0)
+		return 0;
+
 	tail = (struct rtattr*)(((void*)n)+NLMSG_ALIGN(n->nlmsg_len));
 	addattr_l(n, MAX_MSG, TCA_OPTIONS, NULL, 0);
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch iproute2] tc: fill in handle before checking argc
  2015-05-05 22:30 [Patch iproute2] tc: fill in handle before checking argc Cong Wang
@ 2015-05-11 16:13 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2015-05-11 16:13 UTC (permalink / raw)
  To: Cong Wang; +Cc: netdev, Jamal Hadi Salim

On Tue,  5 May 2015 15:30:20 -0700
Cong Wang <xiyou.wangcong@gmail.com> wrote:

> 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>

Applied

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-11 16:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-05 22:30 [Patch iproute2] tc: fill in handle before checking argc Cong Wang
2015-05-11 16:13 ` Stephen Hemminger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.