]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
Fix classifier help
authorPatrick McHardy <kaber@trash.net>
Wed, 26 Mar 2008 06:40:03 +0000 (07:40 +0100)
committerStephen Hemminger <stephen.hemminger@vyatta.com>
Thu, 17 Apr 2008 17:07:02 +0000 (10:07 -0700)
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>
tc/tc_filter.c

index d70c656dcfe561757a91c284d5e16c9e5523d916..6701f9ae28981f0c8186e0ef06255a8180ed0a07 100644 (file)
@@ -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])