All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: Linux Netdev List <netdev@vger.kernel.org>
Subject: [IPROUTE]: Fix classifier help
Date: Wed, 26 Mar 2008 07:40:03 +0100	[thread overview]
Message-ID: <47E9EFC3.3000600@trash.net> (raw)

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



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

commit c504ffd627ac211eebf5ed34ef0fbfd7f1dbb347
Author: Patrick McHardy <kaber@trash.net>
Date:   Wed Mar 26 07:38:43 2008 +0100

    [IPROUTE]: Fix classifier help

    The new check whether the user has specified a protocol makes
    "ip filter <type> help" fails with "protocol is required".

    This could be fixed by moving it further down, but a more user-friendly
    way it to simply use ETH_P_ALL as default if nothing is specified.

    Signed-off-by: Patrick McHardy <kaber@trash.net>

diff --git a/tc/tc_filter.c b/tc/tc_filter.c
index d70c656..6701f9a 100644
--- a/tc/tc_filter.c
+++ b/tc/tc_filter.c
@@ -54,7 +54,8 @@ int tc_filter_modify(int cmd, unsigned flags, int argc, char **argv)
 	} req;
 	struct filter_util *q = NULL;
 	__u32 prio = 0;
-	__u32 protocol = 0;
+	__u32 protocol = ETH_P_ALL;
+	int protocol_set = 0;
 	char *fhandle = NULL;
 	char  d[16];
 	char  k[16];
@@ -106,11 +107,12 @@ int tc_filter_modify(int cmd, unsigned flags, int argc, char **argv)
 		} else if (matches(*argv, "protocol") == 0) {
 			__u16 id;
 			NEXT_ARG();
-			if (protocol)
+			if (protocol_set)
 				duparg("protocol", *argv);
 			if (ll_proto_a2n(&id, *argv))
 				invarg(*argv, "invalid protocol");
 			protocol = id;
+			protocol_set = 1;
 		} else if (matches(*argv, "estimator") == 0) {
 			if (parse_estimator(&argc, &argv, &est) < 0)
 				return -1;
@@ -127,11 +129,6 @@ int tc_filter_modify(int cmd, unsigned flags, int argc, char **argv)
 		argc--; argv++;
 	}
 
-	if (!protocol) {
-		fprintf(stderr, "\"protocol\" is required.\n");
-		return -1;
-	}
-
 	req.t.tcm_info = TC_H_MAKE(prio<<16, protocol);
 
 	if (k[0])

                 reply	other threads:[~2008-03-26  6:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=47E9EFC3.3000600@trash.net \
    --to=kaber@trash.net \
    --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 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.