From: Stephen Hemminger Date: Fri, 8 Feb 2008 03:25:26 +0000 (-0800) Subject: Protocol field on tc_filter is required X-Git-Tag: v2.6.25~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de33a4305563c3a3d6ee92193a65b9be9fc928a2;p=thirdparty%2Fiproute2.git Protocol field on tc_filter is required Kernel won't find matching filter if protocol value not provided. --- diff --git a/tc/tc_filter.c b/tc/tc_filter.c index a9ae424a1..d70c656dc 100644 --- a/tc/tc_filter.c +++ b/tc/tc_filter.c @@ -31,7 +31,7 @@ static void usage(void); static void usage(void) { fprintf(stderr, "Usage: tc filter [ add | del | change | replace | show ] dev STRING\n"); - fprintf(stderr, " [ pref PRIO ] [ protocol PROTO ]\n"); + fprintf(stderr, " [ pref PRIO ] protocol PROTO\n"); fprintf(stderr, " [ estimator INTERVAL TIME_CONSTANT ]\n"); fprintf(stderr, " [ root | classid CLASSID ] [ handle FILTERID ]\n"); fprintf(stderr, " [ [ FILTER_TYPE ] [ help | OPTIONS ] ]\n"); @@ -102,7 +102,7 @@ int tc_filter_modify(int cmd, unsigned flags, int argc, char **argv) if (prio) duparg("priority", *argv); if (get_u32(&prio, *argv, 0)) - invarg(*argv, "invalid prpriority value"); + invarg(*argv, "invalid priority value"); } else if (matches(*argv, "protocol") == 0) { __u16 id; NEXT_ARG(); @@ -127,6 +127,11 @@ 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])