netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Andreas Henriksson <andreas@fatal.se>
Cc: netdev@vger.kernel.org, shemminger@vyatta.com
Subject: Re: Request for help with iproute2 bugs.
Date: Mon, 23 Nov 2009 12:03:41 +0100	[thread overview]
Message-ID: <4B0A6C0D.9030402@trash.net> (raw)
In-Reply-To: <20091123103742.GA14713@amd64.fatal.se>

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

Andreas Henriksson wrote:
> http://bugs.debian.org/532727
>   iproute: "tc filter add ... protocol ip fw" broken?
> 

This one is caused by a regression in iproute2. The attached patch
should fix it.

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

commit b3d80773099c13f60598857901cb2724c210614f
Author: Patrick McHardy <kaber@trash.net>
Date:   Mon Nov 23 12:00:46 2009 +0100

    f_fw: fix compat mode
    
    The kernel takes a lack of options as indication that the fw classifier
    should operate in compatibility mode, where marks are mapped directly to
    classids.
    
    Commit e22b42a (tc mask patch) broke this by adding an empty TCA_OPTIONS
    attribute even if no handle is specified. Restore the old behaviour.
    
    Signed-off-by: Patrick McHardy <kaber@trash.net>

diff --git a/tc/f_fw.c b/tc/f_fw.c
index b511735..cc8ea2d 100644
--- a/tc/f_fw.c
+++ b/tc/f_fw.c
@@ -38,15 +38,13 @@ static int fw_parse_opt(struct filter_util *qu, char *handle, int argc, char **a
 	struct tc_police tp;
 	struct tcmsg *t = NLMSG_DATA(n);
 	struct rtattr *tail;
+	__u32 mask = 0;
+	int mask_set = 0;
 
 	memset(&tp, 0, sizeof(tp));
 
-	tail = NLMSG_TAIL(n);
-	addattr_l(n, 4096, TCA_OPTIONS, NULL, 0);
-
 	if (handle) {
 		char *slash;
-		__u32 mask = 0;
 		if ((slash = strchr(handle, '/')) != NULL)
 			*slash = '\0';
 		if (get_u32(&t->tcm_handle, handle, 0)) {
@@ -58,13 +56,19 @@ static int fw_parse_opt(struct filter_util *qu, char *handle, int argc, char **a
 				fprintf(stderr, "Illegal \"handle\" mask\n");
 				return -1;
 			}
-			addattr32(n, MAX_MSG, TCA_FW_MASK, mask);
+			mask_set = 1;
 		}
 	}
 
 	if (argc == 0)
 		return 0;
 
+	tail = NLMSG_TAIL(n);
+	addattr_l(n, 4096, TCA_OPTIONS, NULL, 0);
+
+	if (mask_set)
+		addattr32(n, MAX_MSG, TCA_FW_MASK, mask);
+
 	while (argc > 0) {
 		if (matches(*argv, "classid") == 0 ||
 		    matches(*argv, "flowid") == 0) {

  reply	other threads:[~2009-11-23 11:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-23 10:37 Request for help with iproute2 bugs Andreas Henriksson
2009-11-23 11:03 ` Patrick McHardy [this message]
2009-12-02  0:20   ` Stephen Hemminger
2009-12-03  1:08 ` Simon Horman
2009-12-07  3:47   ` Simon Horman
2009-12-07  6:50     ` Bug#532152: " Andreas Henriksson
2009-12-26 18:12   ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B0A6C0D.9030402@trash.net \
    --to=kaber@trash.net \
    --cc=andreas@fatal.se \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).