blob: 66586634d19a67b4b7445d4a82b5edaa9d720ad3 [file] [log] [blame]
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +00001/*
2 * tc_filter.c "tc filter".
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 *
9 * Authors: Alexey Kuznetsov, <kuznet@ms2.inr.ac.ru>
10 *
11 */
12
13#include <stdio.h>
14#include <stdlib.h>
15#include <unistd.h>
16#include <syslog.h>
17#include <fcntl.h>
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000018#include <sys/socket.h>
19#include <netinet/in.h>
20#include <arpa/inet.h>
21#include <string.h>
22#include <linux/if_ether.h>
23
24#include "rt_names.h"
25#include "utils.h"
26#include "tc_util.h"
27#include "tc_common.h"
28
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000029static void usage(void)
30{
Hasso Teppere5d179d2006-12-10 16:33:05 +020031 fprintf(stderr, "Usage: tc filter [ add | del | change | replace | show ] dev STRING\n");
Stephen Hemmingerde33a432008-02-07 19:25:26 -080032 fprintf(stderr, " [ pref PRIO ] protocol PROTO\n");
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000033 fprintf(stderr, " [ estimator INTERVAL TIME_CONSTANT ]\n");
Daniel Borkmann8f9afdd2016-01-12 01:42:20 +010034 fprintf(stderr, " [ root | ingress | egress | parent CLASSID ]\n");
35 fprintf(stderr, " [ handle FILTERID ] [ [ FILTER_TYPE ] [ help | OPTIONS ] ]\n");
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000036 fprintf(stderr, "\n");
Daniel Borkmann8f9afdd2016-01-12 01:42:20 +010037 fprintf(stderr, " tc filter show [ dev STRING ] [ root | ingress | egress | parent CLASSID ]\n");
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000038 fprintf(stderr, "Where:\n");
Daniel Borkmann4bd62442015-04-16 21:20:06 +020039 fprintf(stderr, "FILTER_TYPE := { rsvp | u32 | bpf | fw | route | etc. }\n");
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000040 fprintf(stderr, "FILTERID := ... format depends on classifier, see there\n");
41 fprintf(stderr, "OPTIONS := ... try tc filter add <desired FILTER_KIND> help\n");
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000042}
43
Stephen Hemminger32a121c2016-03-21 11:48:36 -070044static int tc_filter_modify(int cmd, unsigned int flags, int argc, char **argv)
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000045{
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000046 struct {
Stephen Hemminger32a121c2016-03-21 11:48:36 -070047 struct nlmsghdr n;
48 struct tcmsg t;
49 char buf[MAX_MSG];
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000050 } req;
51 struct filter_util *q = NULL;
52 __u32 prio = 0;
Patrick McHardyae761062008-06-23 15:59:18 +020053 __u32 protocol = 0;
Patrick McHardy083a5f02008-03-26 07:40:03 +010054 int protocol_set = 0;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000055 char *fhandle = NULL;
56 char d[16];
57 char k[16];
58 struct tc_estimator est;
59
60 memset(&req, 0, sizeof(req));
61 memset(&est, 0, sizeof(est));
62 memset(d, 0, sizeof(d));
63 memset(k, 0, sizeof(k));
64 memset(&req, 0, sizeof(req));
65
66 req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg));
67 req.n.nlmsg_flags = NLM_F_REQUEST|flags;
68 req.n.nlmsg_type = cmd;
69 req.t.tcm_family = AF_UNSPEC;
70
Patrick McHardyae761062008-06-23 15:59:18 +020071 if (cmd == RTM_NEWTFILTER && flags & NLM_F_CREATE)
Florian Westphal05fb9182011-07-27 06:47:05 +000072 protocol = htons(ETH_P_ALL);
Patrick McHardyae761062008-06-23 15:59:18 +020073
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000074 while (argc > 0) {
75 if (strcmp(*argv, "dev") == 0) {
76 NEXT_ARG();
77 if (d[0])
78 duparg("dev", *argv);
79 strncpy(d, *argv, sizeof(d)-1);
80 } else if (strcmp(*argv, "root") == 0) {
81 if (req.t.tcm_parent) {
82 fprintf(stderr, "Error: \"root\" is duplicate parent ID\n");
osdl.net!shemminger024481b2005-03-14 19:02:41 +000083 return -1;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000084 }
85 req.t.tcm_parent = TC_H_ROOT;
Daniel Borkmann8f9afdd2016-01-12 01:42:20 +010086 } else if (strcmp(*argv, "ingress") == 0) {
87 if (req.t.tcm_parent) {
88 fprintf(stderr, "Error: \"ingress\" is duplicate parent ID\n");
89 return -1;
90 }
91 req.t.tcm_parent = TC_H_MAKE(TC_H_CLSACT,
92 TC_H_MIN_INGRESS);
93 } else if (strcmp(*argv, "egress") == 0) {
94 if (req.t.tcm_parent) {
95 fprintf(stderr, "Error: \"egress\" is duplicate parent ID\n");
96 return -1;
97 }
98 req.t.tcm_parent = TC_H_MAKE(TC_H_CLSACT,
99 TC_H_MIN_EGRESS);
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000100 } else if (strcmp(*argv, "parent") == 0) {
101 __u32 handle;
Stephen Hemminger32a121c2016-03-21 11:48:36 -0700102
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000103 NEXT_ARG();
104 if (req.t.tcm_parent)
105 duparg("parent", *argv);
106 if (get_tc_classid(&handle, *argv))
Dan Kenigsbergf1675d62012-08-16 02:25:56 +0000107 invarg("Invalid parent ID", *argv);
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000108 req.t.tcm_parent = handle;
109 } else if (strcmp(*argv, "handle") == 0) {
110 NEXT_ARG();
111 if (fhandle)
112 duparg("handle", *argv);
113 fhandle = *argv;
114 } else if (matches(*argv, "preference") == 0 ||
115 matches(*argv, "priority") == 0) {
116 NEXT_ARG();
117 if (prio)
118 duparg("priority", *argv);
Li Wei424adc12012-07-10 16:45:28 +0800119 if (get_u32(&prio, *argv, 0) || prio > 0xFFFF)
Dan Kenigsbergf1675d62012-08-16 02:25:56 +0000120 invarg("invalid priority value", *argv);
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000121 } else if (matches(*argv, "protocol") == 0) {
122 __u16 id;
Stephen Hemminger32a121c2016-03-21 11:48:36 -0700123
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000124 NEXT_ARG();
Patrick McHardy083a5f02008-03-26 07:40:03 +0100125 if (protocol_set)
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000126 duparg("protocol", *argv);
127 if (ll_proto_a2n(&id, *argv))
Dan Kenigsbergf1675d62012-08-16 02:25:56 +0000128 invarg("invalid protocol", *argv);
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000129 protocol = id;
Patrick McHardy083a5f02008-03-26 07:40:03 +0100130 protocol_set = 1;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000131 } else if (matches(*argv, "estimator") == 0) {
132 if (parse_estimator(&argc, &argv, &est) < 0)
133 return -1;
134 } else if (matches(*argv, "help") == 0) {
135 usage();
Stephen Hemminger3a99df72008-10-13 07:00:48 -0700136 return 0;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000137 } else {
138 strncpy(k, *argv, sizeof(k)-1);
139
140 q = get_filter_kind(k);
141 argc--; argv++;
142 break;
143 }
144
145 argc--; argv++;
146 }
147
148 req.t.tcm_info = TC_H_MAKE(prio<<16, protocol);
149
150 if (k[0])
151 addattr_l(&req.n, sizeof(req), TCA_KIND, k, strlen(k)+1);
152
153 if (q) {
154 if (q->parse_fopt(q, fhandle, argc, argv, &req.n))
osdl.net!shemminger024481b2005-03-14 19:02:41 +0000155 return 1;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000156 } else {
157 if (fhandle) {
Stephen Hemminger32a121c2016-03-21 11:48:36 -0700158 fprintf(stderr, "Must specify filter type when using \"handle\"\n");
osdl.net!shemminger024481b2005-03-14 19:02:41 +0000159 return -1;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000160 }
161 if (argc) {
162 if (matches(*argv, "help") == 0)
163 usage();
164 fprintf(stderr, "Garbage instead of arguments \"%s ...\". Try \"tc filter help\".\n", *argv);
osdl.net!shemminger024481b2005-03-14 19:02:41 +0000165 return -1;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000166 }
167 }
168 if (est.ewma_log)
169 addattr_l(&req.n, sizeof(req), TCA_RATE, &est, sizeof(est));
170
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000171
172 if (d[0]) {
Stephen Hemminger3d0b7432014-12-20 15:47:17 -0800173 ll_init_map(&rth);
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000174
175 if ((req.t.tcm_ifindex = ll_name_to_index(d)) == 0) {
176 fprintf(stderr, "Cannot find device \"%s\"\n", d);
osdl.net!shemminger024481b2005-03-14 19:02:41 +0000177 return 1;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000178 }
179 }
180
Stephen Hemmingerc079e122015-05-27 12:26:14 -0700181 if (rtnl_talk(&rth, &req.n, NULL, 0) < 0) {
osdl.net!shemminger2373fde2004-08-13 23:54:55 +0000182 fprintf(stderr, "We have an error talking to the kernel\n");
osdl.net!shemminger024481b2005-03-14 19:02:41 +0000183 return 2;
osdl.net!shemminger2373fde2004-08-13 23:54:55 +0000184 }
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000185
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000186 return 0;
187}
188
189static __u32 filter_parent;
190static int filter_ifindex;
191static __u32 filter_prio;
192static __u32 filter_protocol;
Stephen Hemminger32a121c2016-03-21 11:48:36 -0700193__u16 f_proto;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000194
Jamal Hadi Salim5bec3482006-08-08 11:55:15 -0700195int print_filter(const struct sockaddr_nl *who,
Stephen Hemmingerae665a52006-12-05 10:10:22 -0800196 struct nlmsghdr *n,
osdl.net!shemmingerde481782004-08-31 17:45:21 +0000197 void *arg)
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000198{
Stephen Hemminger32a121c2016-03-21 11:48:36 -0700199 FILE *fp = (FILE *)arg;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000200 struct tcmsg *t = NLMSG_DATA(n);
201 int len = n->nlmsg_len;
Stephen Hemminger32a121c2016-03-21 11:48:36 -0700202 struct rtattr *tb[TCA_MAX+1];
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000203 struct filter_util *q;
204 char abuf[256];
205
206 if (n->nlmsg_type != RTM_NEWTFILTER && n->nlmsg_type != RTM_DELTFILTER) {
207 fprintf(stderr, "Not a filter\n");
208 return 0;
209 }
210 len -= NLMSG_LENGTH(sizeof(*t));
211 if (len < 0) {
212 fprintf(stderr, "Wrong len %d\n", len);
213 return -1;
214 }
215
216 memset(tb, 0, sizeof(tb));
217 parse_rtattr(tb, TCA_MAX, TCA_RTA(t), len);
218
219 if (tb[TCA_KIND] == NULL) {
osdl.net!shemminger2373fde2004-08-13 23:54:55 +0000220 fprintf(stderr, "print_filter: NULL kind\n");
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000221 return -1;
222 }
223
224 if (n->nlmsg_type == RTM_DELTFILTER)
225 fprintf(fp, "deleted ");
226
227 fprintf(fp, "filter ");
228 if (!filter_ifindex || filter_ifindex != t->tcm_ifindex)
229 fprintf(fp, "dev %s ", ll_index_to_name(t->tcm_ifindex));
230
231 if (!filter_parent || filter_parent != t->tcm_parent) {
232 if (t->tcm_parent == TC_H_ROOT)
233 fprintf(fp, "root ");
Daniel Borkmann8f9afdd2016-01-12 01:42:20 +0100234 else if (t->tcm_parent == TC_H_MAKE(TC_H_CLSACT, TC_H_MIN_INGRESS))
235 fprintf(fp, "ingress ");
236 else if (t->tcm_parent == TC_H_MAKE(TC_H_CLSACT, TC_H_MIN_EGRESS))
237 fprintf(fp, "egress ");
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000238 else {
239 print_tc_classid(abuf, sizeof(abuf), t->tcm_parent);
240 fprintf(fp, "parent %s ", abuf);
241 }
242 }
Daniel Borkmann8f9afdd2016-01-12 01:42:20 +0100243
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000244 if (t->tcm_info) {
jamaleefcbc72008-04-20 10:47:48 -0400245 f_proto = TC_H_MIN(t->tcm_info);
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000246 __u32 prio = TC_H_MAJ(t->tcm_info)>>16;
Stephen Hemminger32a121c2016-03-21 11:48:36 -0700247
jamaleefcbc72008-04-20 10:47:48 -0400248 if (!filter_protocol || filter_protocol != f_proto) {
249 if (f_proto) {
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000250 SPRINT_BUF(b1);
251 fprintf(fp, "protocol %s ",
jamaleefcbc72008-04-20 10:47:48 -0400252 ll_proto_n2a(f_proto, b1, sizeof(b1)));
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000253 }
254 }
255 if (!filter_prio || filter_prio != prio) {
256 if (prio)
257 fprintf(fp, "pref %u ", prio);
258 }
259 }
Stephen Hemmingerff247462012-04-10 08:47:55 -0700260 fprintf(fp, "%s ", rta_getattr_str(tb[TCA_KIND]));
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000261 q = get_filter_kind(RTA_DATA(tb[TCA_KIND]));
262 if (tb[TCA_OPTIONS]) {
263 if (q)
264 q->print_fopt(q, fp, tb[TCA_OPTIONS], t->tcm_handle);
265 else
266 fprintf(fp, "[cannot parse parameters]");
267 }
268 fprintf(fp, "\n");
269
ch[shemminger]!tgrafe5879dc2004-12-07 23:52:52 +0000270 if (show_stats && (tb[TCA_STATS] || tb[TCA_STATS2])) {
271 print_tcstats_attr(fp, tb, " ", NULL);
osdl.net!shemmingerde481782004-08-31 17:45:21 +0000272 fprintf(fp, "\n");
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000273 }
osdl.net!shemmingerde481782004-08-31 17:45:21 +0000274
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000275 fflush(fp);
276 return 0;
277}
278
Stephen Hemmingerd1f28cf2013-02-12 11:09:03 -0800279static int tc_filter_list(int argc, char **argv)
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000280{
281 struct tcmsg t;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000282 char d[16];
283 __u32 prio = 0;
284 __u32 protocol = 0;
285 char *fhandle = NULL;
286
287 memset(&t, 0, sizeof(t));
288 t.tcm_family = AF_UNSPEC;
289 memset(d, 0, sizeof(d));
290
291 while (argc > 0) {
292 if (strcmp(*argv, "dev") == 0) {
293 NEXT_ARG();
294 if (d[0])
295 duparg("dev", *argv);
296 strncpy(d, *argv, sizeof(d)-1);
297 } else if (strcmp(*argv, "root") == 0) {
298 if (t.tcm_parent) {
299 fprintf(stderr, "Error: \"root\" is duplicate parent ID\n");
osdl.net!shemminger024481b2005-03-14 19:02:41 +0000300 return -1;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000301 }
302 filter_parent = t.tcm_parent = TC_H_ROOT;
Daniel Borkmann8f9afdd2016-01-12 01:42:20 +0100303 } else if (strcmp(*argv, "ingress") == 0) {
304 if (t.tcm_parent) {
305 fprintf(stderr, "Error: \"ingress\" is duplicate parent ID\n");
306 return -1;
307 }
308 filter_parent = TC_H_MAKE(TC_H_CLSACT,
309 TC_H_MIN_INGRESS);
310 t.tcm_parent = filter_parent;
311 } else if (strcmp(*argv, "egress") == 0) {
312 if (t.tcm_parent) {
313 fprintf(stderr, "Error: \"egress\" is duplicate parent ID\n");
314 return -1;
315 }
316 filter_parent = TC_H_MAKE(TC_H_CLSACT,
317 TC_H_MIN_EGRESS);
318 t.tcm_parent = filter_parent;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000319 } else if (strcmp(*argv, "parent") == 0) {
320 __u32 handle;
Stephen Hemminger32a121c2016-03-21 11:48:36 -0700321
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000322 NEXT_ARG();
323 if (t.tcm_parent)
324 duparg("parent", *argv);
325 if (get_tc_classid(&handle, *argv))
Dan Kenigsbergf1675d62012-08-16 02:25:56 +0000326 invarg("invalid parent ID", *argv);
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000327 filter_parent = t.tcm_parent = handle;
328 } else if (strcmp(*argv, "handle") == 0) {
329 NEXT_ARG();
330 if (fhandle)
331 duparg("handle", *argv);
332 fhandle = *argv;
333 } else if (matches(*argv, "preference") == 0 ||
334 matches(*argv, "priority") == 0) {
335 NEXT_ARG();
336 if (prio)
337 duparg("priority", *argv);
338 if (get_u32(&prio, *argv, 0))
Dan Kenigsbergf1675d62012-08-16 02:25:56 +0000339 invarg("invalid preference", *argv);
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000340 filter_prio = prio;
341 } else if (matches(*argv, "protocol") == 0) {
342 __u16 res;
Stephen Hemminger32a121c2016-03-21 11:48:36 -0700343
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000344 NEXT_ARG();
345 if (protocol)
346 duparg("protocol", *argv);
347 if (ll_proto_a2n(&res, *argv))
Dan Kenigsbergf1675d62012-08-16 02:25:56 +0000348 invarg("invalid protocol", *argv);
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000349 protocol = res;
350 filter_protocol = protocol;
351 } else if (matches(*argv, "help") == 0) {
352 usage();
353 } else {
354 fprintf(stderr, " What is \"%s\"? Try \"tc filter help\"\n", *argv);
osdl.net!shemminger024481b2005-03-14 19:02:41 +0000355 return -1;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000356 }
357
358 argc--; argv++;
359 }
360
361 t.tcm_info = TC_H_MAKE(prio<<16, protocol);
362
Stephen Hemminger3d0b7432014-12-20 15:47:17 -0800363 ll_init_map(&rth);
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000364
365 if (d[0]) {
366 if ((t.tcm_ifindex = ll_name_to_index(d)) == 0) {
367 fprintf(stderr, "Cannot find device \"%s\"\n", d);
osdl.net!shemminger024481b2005-03-14 19:02:41 +0000368 return 1;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000369 }
370 filter_ifindex = t.tcm_ifindex;
371 }
372
Stephen Hemminger3d0b7432014-12-20 15:47:17 -0800373 if (rtnl_dump_request(&rth, RTM_GETTFILTER, &t, sizeof(t)) < 0) {
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000374 perror("Cannot send dump request");
osdl.net!shemminger024481b2005-03-14 19:02:41 +0000375 return 1;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000376 }
377
Stephen Hemminger3d0b7432014-12-20 15:47:17 -0800378 if (rtnl_dump_filter(&rth, print_filter, stdout) < 0) {
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000379 fprintf(stderr, "Dump terminated\n");
osdl.net!shemminger024481b2005-03-14 19:02:41 +0000380 return 1;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000381 }
382
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000383 return 0;
384}
385
386int do_filter(int argc, char **argv)
387{
388 if (argc < 1)
389 return tc_filter_list(0, NULL);
390 if (matches(*argv, "add") == 0)
391 return tc_filter_modify(RTM_NEWTFILTER, NLM_F_EXCL|NLM_F_CREATE, argc-1, argv+1);
392 if (matches(*argv, "change") == 0)
393 return tc_filter_modify(RTM_NEWTFILTER, 0, argc-1, argv+1);
394 if (matches(*argv, "replace") == 0)
395 return tc_filter_modify(RTM_NEWTFILTER, NLM_F_CREATE, argc-1, argv+1);
396 if (matches(*argv, "delete") == 0)
397 return tc_filter_modify(RTM_DELTFILTER, 0, argc-1, argv+1);
398#if 0
399 if (matches(*argv, "get") == 0)
400 return tc_filter_get(RTM_GETTFILTER, 0, argc-1, argv+1);
401#endif
402 if (matches(*argv, "list") == 0 || matches(*argv, "show") == 0
403 || matches(*argv, "lst") == 0)
404 return tc_filter_list(argc-1, argv+1);
Hasso Teppere5d179d2006-12-10 16:33:05 +0200405 if (matches(*argv, "help") == 0) {
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000406 usage();
Hasso Teppere5d179d2006-12-10 16:33:05 +0200407 return 0;
Stephen Hemminger32a121c2016-03-21 11:48:36 -0700408 }
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000409 fprintf(stderr, "Command \"%s\" is unknown, try \"tc filter help\".\n", *argv);
osdl.net!shemminger024481b2005-03-14 19:02:41 +0000410 return -1;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000411}