Protocol field on tc_filter is required

Kernel won't find matching filter if protocol value not
provided.
This commit is contained in:
Stephen Hemminger 2008-02-07 19:25:26 -08:00
parent 10bd7e8460
commit de33a43055
1 changed files with 7 additions and 2 deletions

View File

@ -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])