netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* tc regression?
@ 2008-06-23 13:30 Badalian Vyacheslav
  2008-06-23 13:53 ` Patrick McHardy
  0 siblings, 1 reply; 4+ messages in thread
From: Badalian Vyacheslav @ 2008-06-23 13:30 UTC (permalink / raw)
  To: netdev

Hello all.

Ditrib: Gentoo (i hope its not gentoo bug...)

I try update package to "sys-apps/iproute2-2.6.25.20080417" and see that 
filter can't del filter...

# tc filter show dev eth1 | grep 4:29:d1
filter parent 1: protocol ip pref 5 u32 fh 4:29:d1 order 209 key ht 4 
bkt 29 flowid 1:b7aa

# tc filter del dev eth1 parent 1: pref 5 handle 4:29:d1 u32
RTNETLINK answers: Invalid argument
We have an error talking to the kernel

after rollback to package"sys-apps/iproute2-2.6.24.20080108" all deleted 
normal...

kernel 2.4.24

Thanks!

P.S. not any critical for me... only "for intresting" report =)

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

* Re: tc regression?
  2008-06-23 13:30 tc regression? Badalian Vyacheslav
@ 2008-06-23 13:53 ` Patrick McHardy
  2008-06-23 13:59   ` Patrick McHardy
  0 siblings, 1 reply; 4+ messages in thread
From: Patrick McHardy @ 2008-06-23 13:53 UTC (permalink / raw)
  To: Badalian Vyacheslav; +Cc: netdev

[-- Attachment #1: Type: text/plain, Size: 797 bytes --]

Badalian Vyacheslav wrote:
> Hello all.
> 
> Ditrib: Gentoo (i hope its not gentoo bug...)
> 
> I try update package to "sys-apps/iproute2-2.6.25.20080417" and see that 
> filter can't del filter...
> 
> # tc filter show dev eth1 | grep 4:29:d1
> filter parent 1: protocol ip pref 5 u32 fh 4:29:d1 order 209 key ht 4 
> bkt 29 flowid 1:b7aa
> 
> # tc filter del dev eth1 parent 1: pref 5 handle 4:29:d1 u32
> RTNETLINK answers: Invalid argument
> We have an error talking to the kernel
> 
> after rollback to package"sys-apps/iproute2-2.6.24.20080108" all deleted 
> normal...

The current iproute version uses "protocol all" by default
if its not specified. This is actually only useful for creating
new filters, on deletion an unset protocol is treated as wildcard.

Does this patch fix it?





[-- Attachment #2: x --]
[-- Type: text/plain, Size: 680 bytes --]

diff --git a/tc/tc_filter.c b/tc/tc_filter.c
index db44dec..880b887 100644
--- a/tc/tc_filter.c
+++ b/tc/tc_filter.c
@@ -54,7 +54,7 @@ int tc_filter_modify(int cmd, unsigned flags, int argc, char **argv)
 	} req;
 	struct filter_util *q = NULL;
 	__u32 prio = 0;
-	__u32 protocol = ETH_P_ALL;
+	__u32 protocol = 0;
 	int protocol_set = 0;
 	char *fhandle = NULL;
 	char  d[16];
@@ -72,6 +72,9 @@ int tc_filter_modify(int cmd, unsigned flags, int argc, char **argv)
 	req.n.nlmsg_type = cmd;
 	req.t.tcm_family = AF_UNSPEC;
 
+	if (flags == RTM_NEWTFILTER && flags & NLM_F_CREATE)
+		protocol = ETH_P_ALL;
+
 	while (argc > 0) {
 		if (strcmp(*argv, "dev") == 0) {
 			NEXT_ARG();

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

* Re: tc regression?
  2008-06-23 13:53 ` Patrick McHardy
@ 2008-06-23 13:59   ` Patrick McHardy
  2008-06-25 13:54     ` Badalian Vyacheslav
  0 siblings, 1 reply; 4+ messages in thread
From: Patrick McHardy @ 2008-06-23 13:59 UTC (permalink / raw)
  To: Badalian Vyacheslav; +Cc: netdev

[-- Attachment #1: Type: text/plain, Size: 885 bytes --]

Patrick McHardy wrote:
> Badalian Vyacheslav wrote:
>> Hello all.
>>
>> Ditrib: Gentoo (i hope its not gentoo bug...)
>>
>> I try update package to "sys-apps/iproute2-2.6.25.20080417" and see 
>> that filter can't del filter...
>>
>> # tc filter show dev eth1 | grep 4:29:d1
>> filter parent 1: protocol ip pref 5 u32 fh 4:29:d1 order 209 key ht 4 
>> bkt 29 flowid 1:b7aa
>>
>> # tc filter del dev eth1 parent 1: pref 5 handle 4:29:d1 u32
>> RTNETLINK answers: Invalid argument
>> We have an error talking to the kernel
>>
>> after rollback to package"sys-apps/iproute2-2.6.24.20080108" all 
>> deleted normal...
> 
> The current iproute version uses "protocol all" by default
> if its not specified. This is actually only useful for creating
> new filters, on deletion an unset protocol is treated as wildcard.
> 
> Does this patch fix it?

Oops, buggy patch. This one should work.


[-- Attachment #2: x --]
[-- Type: text/plain, Size: 678 bytes --]

diff --git a/tc/tc_filter.c b/tc/tc_filter.c
index db44dec..880b887 100644
--- a/tc/tc_filter.c
+++ b/tc/tc_filter.c
@@ -54,7 +54,7 @@ int tc_filter_modify(int cmd, unsigned flags, int argc, char **argv)
 	} req;
 	struct filter_util *q = NULL;
 	__u32 prio = 0;
-	__u32 protocol = ETH_P_ALL;
+	__u32 protocol = 0;
 	int protocol_set = 0;
 	char *fhandle = NULL;
 	char  d[16];
@@ -72,6 +72,9 @@ int tc_filter_modify(int cmd, unsigned flags, int argc, char **argv)
 	req.n.nlmsg_type = cmd;
 	req.t.tcm_family = AF_UNSPEC;
 
+	if (cmd == RTM_NEWTFILTER && flags & NLM_F_CREATE)
+		protocol = ETH_P_ALL;
+
 	while (argc > 0) {
 		if (strcmp(*argv, "dev") == 0) {
 			NEXT_ARG();

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

* Re: tc regression?
  2008-06-23 13:59   ` Patrick McHardy
@ 2008-06-25 13:54     ` Badalian Vyacheslav
  0 siblings, 0 replies; 4+ messages in thread
From: Badalian Vyacheslav @ 2008-06-25 13:54 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: netdev

sorry for long answer.... I will try it tomorrow!...
> Patrick McHardy wrote:
>> Badalian Vyacheslav wrote:
>>> Hello all.
>>>
>>> Ditrib: Gentoo (i hope its not gentoo bug...)
>>>
>>> I try update package to "sys-apps/iproute2-2.6.25.20080417" and see 
>>> that filter can't del filter...
>>>
>>> # tc filter show dev eth1 | grep 4:29:d1
>>> filter parent 1: protocol ip pref 5 u32 fh 4:29:d1 order 209 key ht 
>>> 4 bkt 29 flowid 1:b7aa
>>>
>>> # tc filter del dev eth1 parent 1: pref 5 handle 4:29:d1 u32
>>> RTNETLINK answers: Invalid argument
>>> We have an error talking to the kernel
>>>
>>> after rollback to package"sys-apps/iproute2-2.6.24.20080108" all 
>>> deleted normal...
>>
>> The current iproute version uses "protocol all" by default
>> if its not specified. This is actually only useful for creating
>> new filters, on deletion an unset protocol is treated as wildcard.
>>
>> Does this patch fix it?
>
> Oops, buggy patch. This one should work.
>


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

end of thread, other threads:[~2008-06-25 13:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-23 13:30 tc regression? Badalian Vyacheslav
2008-06-23 13:53 ` Patrick McHardy
2008-06-23 13:59   ` Patrick McHardy
2008-06-25 13:54     ` Badalian Vyacheslav

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).