blob: 7747c8db39d15dc34a5ba75a27fce1b6bf6ffc2d [file] [log] [blame]
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +00001/*
2 * tc_class.c "tc class".
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>
18#include <sys/socket.h>
19#include <netinet/in.h>
20#include <arpa/inet.h>
21#include <string.h>
22#include <math.h>
23
24#include "utils.h"
25#include "tc_util.h"
26#include "tc_common.h"
Jiri Pirko4952b452016-03-22 10:02:20 +010027#include "list.h"
Vadim Kochand954b342014-12-26 02:10:06 +020028
29struct graph_node {
30 struct hlist_node hlist;
31 __u32 id;
32 __u32 parent_id;
33 struct graph_node *parent_node;
34 struct graph_node *right_node;
35 void *data;
36 int data_len;
37 int nodes_count;
38};
39
40static struct hlist_head cls_list = {};
41static struct hlist_head root_cls_list = {};
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000042
osdl.net!shemmingerb611d512005-03-14 19:02:41 +000043static void usage(void);
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000044
45static void usage(void)
46{
Hasso Teppere5d179d2006-12-10 16:33:05 +020047 fprintf(stderr, "Usage: tc class [ add | del | change | replace | show ] dev STRING\n");
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000048 fprintf(stderr, " [ classid CLASSID ] [ root | parent CLASSID ]\n");
49 fprintf(stderr, " [ [ QDISC_KIND ] [ help | OPTIONS ] ]\n");
50 fprintf(stderr, "\n");
51 fprintf(stderr, " tc class show [ dev STRING ] [ root | parent CLASSID ]\n");
52 fprintf(stderr, "Where:\n");
53 fprintf(stderr, "QDISC_KIND := { prio | cbq | etc. }\n");
54 fprintf(stderr, "OPTIONS := ... try tc class add <desired QDISC_KIND> help\n");
osdl.net!shemmingerb611d512005-03-14 19:02:41 +000055 return;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000056}
57
Stephen Hemminger32a121c2016-03-21 11:48:36 -070058static int tc_class_modify(int cmd, unsigned int flags, int argc, char **argv)
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000059{
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000060 struct {
Stephen Hemminger32a121c2016-03-21 11:48:36 -070061 struct nlmsghdr n;
62 struct tcmsg t;
63 char buf[4096];
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000064 } req;
65 struct qdisc_util *q = NULL;
66 struct tc_estimator est;
67 char d[16];
68 char k[16];
69
70 memset(&req, 0, sizeof(req));
71 memset(&est, 0, sizeof(est));
72 memset(d, 0, sizeof(d));
73 memset(k, 0, sizeof(k));
74
75 req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg));
76 req.n.nlmsg_flags = NLM_F_REQUEST|flags;
77 req.n.nlmsg_type = cmd;
78 req.t.tcm_family = AF_UNSPEC;
79
80 while (argc > 0) {
81 if (strcmp(*argv, "dev") == 0) {
82 NEXT_ARG();
83 if (d[0])
84 duparg("dev", *argv);
85 strncpy(d, *argv, sizeof(d)-1);
86 } else if (strcmp(*argv, "classid") == 0) {
87 __u32 handle;
Stephen Hemminger32a121c2016-03-21 11:48:36 -070088
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000089 NEXT_ARG();
90 if (req.t.tcm_handle)
91 duparg("classid", *argv);
92 if (get_tc_classid(&handle, *argv))
Dan Kenigsbergf1675d62012-08-16 02:25:56 +000093 invarg("invalid class ID", *argv);
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000094 req.t.tcm_handle = handle;
shemminger7e6b8092006-03-10 23:40:56 +000095 } else if (strcmp(*argv, "handle") == 0) {
96 fprintf(stderr, "Error: try \"classid\" instead of \"handle\"\n");
97 return -1;
Stephen Hemminger3d0b7432014-12-20 15:47:17 -080098 } else if (strcmp(*argv, "root") == 0) {
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +000099 if (req.t.tcm_parent) {
100 fprintf(stderr, "Error: \"root\" is duplicate parent ID.\n");
osdl.net!shemmingerb611d512005-03-14 19:02:41 +0000101 return -1;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000102 }
103 req.t.tcm_parent = TC_H_ROOT;
104 } else if (strcmp(*argv, "parent") == 0) {
105 __u32 handle;
Stephen Hemminger32a121c2016-03-21 11:48:36 -0700106
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000107 NEXT_ARG();
108 if (req.t.tcm_parent)
109 duparg("parent", *argv);
110 if (get_tc_classid(&handle, *argv))
Dan Kenigsbergf1675d62012-08-16 02:25:56 +0000111 invarg("invalid parent ID", *argv);
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000112 req.t.tcm_parent = handle;
113 } else if (matches(*argv, "estimator") == 0) {
114 if (parse_estimator(&argc, &argv, &est))
115 return -1;
116 } else if (matches(*argv, "help") == 0) {
117 usage();
118 } else {
119 strncpy(k, *argv, sizeof(k)-1);
120
121 q = get_qdisc_kind(k);
122 argc--; argv++;
123 break;
124 }
125 argc--; argv++;
126 }
127
128 if (k[0])
129 addattr_l(&req.n, sizeof(req), TCA_KIND, k, strlen(k)+1);
130 if (est.ewma_log)
131 addattr_l(&req.n, sizeof(req), TCA_RATE, &est, sizeof(est));
132
133 if (q) {
134 if (q->parse_copt == NULL) {
135 fprintf(stderr, "Error: Qdisc \"%s\" is classless.\n", k);
osdl.net!shemmingerb611d512005-03-14 19:02:41 +0000136 return 1;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000137 }
138 if (q->parse_copt(q, argc, argv, &req.n))
osdl.net!shemmingerb611d512005-03-14 19:02:41 +0000139 return 1;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000140 } else {
141 if (argc) {
142 if (matches(*argv, "help") == 0)
143 usage();
144 fprintf(stderr, "Garbage instead of arguments \"%s ...\". Try \"tc class help\".", *argv);
osdl.net!shemmingerb611d512005-03-14 19:02:41 +0000145 return -1;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000146 }
147 }
148
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000149 if (d[0]) {
osdl.net!shemminger79016602005-03-14 19:34:12 +0000150 ll_init_map(&rth);
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000151
152 if ((req.t.tcm_ifindex = ll_name_to_index(d)) == 0) {
153 fprintf(stderr, "Cannot find device \"%s\"\n", d);
osdl.net!shemmingerb611d512005-03-14 19:02:41 +0000154 return 1;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000155 }
156 }
157
Stephen Hemmingerc079e122015-05-27 12:26:14 -0700158 if (rtnl_talk(&rth, &req.n, NULL, 0) < 0)
osdl.net!shemmingerb611d512005-03-14 19:02:41 +0000159 return 2;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000160
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000161 return 0;
162}
163
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000164int filter_ifindex;
165__u32 filter_qdisc;
Denys Fedoryshchenkof4a8b232009-05-26 15:20:26 -0700166__u32 filter_classid;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000167
Vadim Kochand954b342014-12-26 02:10:06 +0200168static void graph_node_add(__u32 parent_id, __u32 id, void *data,
169 int len)
170{
171 struct graph_node *node = malloc(sizeof(struct graph_node));
172
173 memset(node, 0, sizeof(*node));
174 node->id = id;
175 node->parent_id = parent_id;
176
177 if (data && len) {
178 node->data = malloc(len);
179 node->data_len = len;
180 memcpy(node->data, data, len);
181 }
182
183 if (parent_id == TC_H_ROOT)
184 hlist_add_head(&node->hlist, &root_cls_list);
185 else
186 hlist_add_head(&node->hlist, &cls_list);
187}
188
189static void graph_indent(char *buf, struct graph_node *node, int is_newline,
190 int add_spaces)
191{
192 char spaces[100] = {0};
193
194 while (node && node->parent_node) {
195 node->parent_node->right_node = node;
196 node = node->parent_node;
197 }
198 while (node && node->right_node) {
199 if (node->hlist.next)
200 strcat(buf, "| ");
201 else
202 strcat(buf, " ");
203
204 node = node->right_node;
205 }
206
207 if (is_newline) {
208 if (node->hlist.next && node->nodes_count)
209 strcat(buf, "| |");
210 else if (node->hlist.next)
211 strcat(buf, "| ");
212 else if (node->nodes_count)
213 strcat(buf, " |");
214 else if (!node->hlist.next)
215 strcat(buf, " ");
216 }
217 if (add_spaces > 0) {
218 sprintf(spaces, "%-*s", add_spaces, "");
219 strcat(buf, spaces);
220 }
221}
222
223static void graph_cls_show(FILE *fp, char *buf, struct hlist_head *root_list,
224 int level)
225{
226 struct hlist_node *n, *tmp_cls;
227 char cls_id_str[256] = {};
228 struct rtattr *tb[TCA_MAX + 1] = {};
229 struct qdisc_util *q;
230 char str[100] = {};
231
232 hlist_for_each_safe(n, tmp_cls, root_list) {
233 struct hlist_node *c, *tmp_chld;
234 struct hlist_head children = {};
235 struct graph_node *cls = container_of(n, struct graph_node,
236 hlist);
237
238 hlist_for_each_safe(c, tmp_chld, &cls_list) {
239 struct graph_node *child = container_of(c,
240 struct graph_node, hlist);
241
242 if (cls->id == child->parent_id) {
243 hlist_del(c);
244 hlist_add_head(c, &children);
245 cls->nodes_count++;
246 child->parent_node = cls;
247 }
248 }
249
250 graph_indent(buf, cls, 0, 0);
251
252 print_tc_classid(cls_id_str, sizeof(cls_id_str), cls->id);
253 sprintf(str, "+---(%s)", cls_id_str);
254 strcat(buf, str);
255
256 parse_rtattr(tb, TCA_MAX, (struct rtattr *)cls->data,
257 cls->data_len);
258
259 if (tb[TCA_KIND] == NULL) {
260 strcat(buf, " [unknown qdisc kind] ");
261 } else {
262 const char *kind = rta_getattr_str(tb[TCA_KIND]);
263
264 sprintf(str, " %s ", kind);
265 strcat(buf, str);
266 fprintf(fp, "%s", buf);
267 buf[0] = '\0';
268
269 q = get_qdisc_kind(kind);
270 if (q && q->print_copt) {
271 q->print_copt(q, fp, tb[TCA_OPTIONS]);
272 }
273 if (q && show_stats) {
274 int cls_indent = strlen(q->id) - 2 +
275 strlen(cls_id_str);
276 struct rtattr *stats = NULL;
277
278 graph_indent(buf, cls, 1, cls_indent);
279
280 if (tb[TCA_STATS] || tb[TCA_STATS2]) {
281 fprintf(fp, "\n");
282 print_tcstats_attr(fp, tb, buf, &stats);
283 buf[0] = '\0';
284 }
285 if (cls->hlist.next || cls->nodes_count) {
286 strcat(buf, "\n");
287 graph_indent(buf, cls, 1, 0);
288 }
289 }
290 }
291 free(cls->data);
292 fprintf(fp, "%s\n", buf);
293 buf[0] = '\0';
294
295 graph_cls_show(fp, buf, &children, level + 1);
296 if (!cls->hlist.next) {
297 graph_indent(buf, cls, 0, 0);
298 strcat(buf, "\n");
299 }
300
301 fprintf(fp, "%s", buf);
302 buf[0] = '\0';
303 free(cls);
304 }
305}
306
Stephen Hemmingerae665a52006-12-05 10:10:22 -0800307int print_class(const struct sockaddr_nl *who,
osdl.net!shemminger50772dc2004-12-07 21:48:29 +0000308 struct nlmsghdr *n, void *arg)
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000309{
Stephen Hemminger32a121c2016-03-21 11:48:36 -0700310 FILE *fp = (FILE *)arg;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000311 struct tcmsg *t = NLMSG_DATA(n);
312 int len = n->nlmsg_len;
Vadim Kochand954b342014-12-26 02:10:06 +0200313 struct rtattr *tb[TCA_MAX + 1] = {};
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000314 struct qdisc_util *q;
315 char abuf[256];
316
317 if (n->nlmsg_type != RTM_NEWTCLASS && n->nlmsg_type != RTM_DELTCLASS) {
318 fprintf(stderr, "Not a class\n");
319 return 0;
320 }
321 len -= NLMSG_LENGTH(sizeof(*t));
322 if (len < 0) {
323 fprintf(stderr, "Wrong len %d\n", len);
324 return -1;
325 }
Vadim Kochand954b342014-12-26 02:10:06 +0200326
327 if (show_graph) {
328 graph_node_add(t->tcm_parent, t->tcm_handle, TCA_RTA(t), len);
329 return 0;
330 }
331
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000332 if (filter_qdisc && TC_H_MAJ(t->tcm_handle^filter_qdisc))
333 return 0;
334
Denys Fedoryshchenkof4a8b232009-05-26 15:20:26 -0700335 if (filter_classid && t->tcm_handle != filter_classid)
336 return 0;
337
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000338 parse_rtattr(tb, TCA_MAX, TCA_RTA(t), len);
339
340 if (tb[TCA_KIND] == NULL) {
osdl.net!shemminger2373fde2004-08-13 23:54:55 +0000341 fprintf(stderr, "print_class: NULL kind\n");
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000342 return -1;
343 }
344
345 if (n->nlmsg_type == RTM_DELTCLASS)
346 fprintf(fp, "deleted ");
347
348 abuf[0] = 0;
349 if (t->tcm_handle) {
350 if (filter_qdisc)
351 print_tc_classid(abuf, sizeof(abuf), TC_H_MIN(t->tcm_handle));
352 else
353 print_tc_classid(abuf, sizeof(abuf), t->tcm_handle);
354 }
Stephen Hemmingerff247462012-04-10 08:47:55 -0700355 fprintf(fp, "class %s %s ", rta_getattr_str(tb[TCA_KIND]), abuf);
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000356
357 if (filter_ifindex == 0)
358 fprintf(fp, "dev %s ", ll_index_to_name(t->tcm_ifindex));
359
360 if (t->tcm_parent == TC_H_ROOT)
361 fprintf(fp, "root ");
362 else {
363 if (filter_qdisc)
364 print_tc_classid(abuf, sizeof(abuf), TC_H_MIN(t->tcm_parent));
365 else
366 print_tc_classid(abuf, sizeof(abuf), t->tcm_parent);
367 fprintf(fp, "parent %s ", abuf);
368 }
369 if (t->tcm_info)
370 fprintf(fp, "leaf %x: ", t->tcm_info>>16);
371 q = get_qdisc_kind(RTA_DATA(tb[TCA_KIND]));
372 if (tb[TCA_OPTIONS]) {
373 if (q && q->print_copt)
374 q->print_copt(q, fp, tb[TCA_OPTIONS]);
375 else
376 fprintf(fp, "[cannot parse class parameters]");
377 }
378 fprintf(fp, "\n");
379 if (show_stats) {
ch[shemminger]!tgrafe5879dc2004-12-07 23:52:52 +0000380 struct rtattr *xstats = NULL;
Stephen Hemmingerae665a52006-12-05 10:10:22 -0800381
ch[shemminger]!tgrafe5879dc2004-12-07 23:52:52 +0000382 if (tb[TCA_STATS] || tb[TCA_STATS2]) {
383 print_tcstats_attr(fp, tb, " ", &xstats);
osdl.net!shemminger2c5474a2004-08-31 17:54:25 +0000384 fprintf(fp, "\n");
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000385 }
ch[shemminger]!tgrafe5879dc2004-12-07 23:52:52 +0000386 if (q && (xstats || tb[TCA_XSTATS]) && q->print_xstats) {
387 q->print_xstats(q, fp, xstats ? : tb[TCA_XSTATS]);
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000388 fprintf(fp, "\n");
389 }
390 }
391 fflush(fp);
392 return 0;
393}
394
395
Stephen Hemmingerd1f28cf2013-02-12 11:09:03 -0800396static int tc_class_list(int argc, char **argv)
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000397{
398 struct tcmsg t;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000399 char d[16];
Vadim Kochand954b342014-12-26 02:10:06 +0200400 char buf[1024] = {0};
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000401
402 memset(&t, 0, sizeof(t));
403 t.tcm_family = AF_UNSPEC;
404 memset(d, 0, sizeof(d));
405
Nigel Kukard9bea14f2013-10-30 18:44:58 +0000406 filter_qdisc = 0;
407 filter_classid = 0;
408
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000409 while (argc > 0) {
410 if (strcmp(*argv, "dev") == 0) {
411 NEXT_ARG();
412 if (d[0])
413 duparg("dev", *argv);
414 strncpy(d, *argv, sizeof(d)-1);
415 } else if (strcmp(*argv, "qdisc") == 0) {
416 NEXT_ARG();
417 if (filter_qdisc)
418 duparg("qdisc", *argv);
419 if (get_qdisc_handle(&filter_qdisc, *argv))
Dan Kenigsbergf1675d62012-08-16 02:25:56 +0000420 invarg("invalid qdisc ID", *argv);
Denys Fedoryshchenkof4a8b232009-05-26 15:20:26 -0700421 } else if (strcmp(*argv, "classid") == 0) {
422 NEXT_ARG();
423 if (filter_classid)
424 duparg("classid", *argv);
425 if (get_tc_classid(&filter_classid, *argv))
Dan Kenigsbergf1675d62012-08-16 02:25:56 +0000426 invarg("invalid class ID", *argv);
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000427 } else if (strcmp(*argv, "root") == 0) {
428 if (t.tcm_parent) {
429 fprintf(stderr, "Error: \"root\" is duplicate parent ID\n");
osdl.net!shemmingerb611d512005-03-14 19:02:41 +0000430 return -1;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000431 }
432 t.tcm_parent = TC_H_ROOT;
433 } else if (strcmp(*argv, "parent") == 0) {
434 __u32 handle;
Stephen Hemminger32a121c2016-03-21 11:48:36 -0700435
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000436 if (t.tcm_parent)
437 duparg("parent", *argv);
438 NEXT_ARG();
439 if (get_tc_classid(&handle, *argv))
Dan Kenigsbergf1675d62012-08-16 02:25:56 +0000440 invarg("invalid parent ID", *argv);
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000441 t.tcm_parent = handle;
442 } else if (matches(*argv, "help") == 0) {
443 usage();
444 } else {
445 fprintf(stderr, "What is \"%s\"? Try \"tc class help\".\n", *argv);
osdl.net!shemmingerb611d512005-03-14 19:02:41 +0000446 return -1;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000447 }
448
449 argc--; argv++;
450 }
451
Stephen Hemminger3d0b7432014-12-20 15:47:17 -0800452 ll_init_map(&rth);
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000453
454 if (d[0]) {
455 if ((t.tcm_ifindex = ll_name_to_index(d)) == 0) {
456 fprintf(stderr, "Cannot find device \"%s\"\n", d);
osdl.net!shemmingerb611d512005-03-14 19:02:41 +0000457 return 1;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000458 }
459 filter_ifindex = t.tcm_ifindex;
460 }
461
Stephen Hemminger3d0b7432014-12-20 15:47:17 -0800462 if (rtnl_dump_request(&rth, RTM_GETTCLASS, &t, sizeof(t)) < 0) {
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000463 perror("Cannot send dump request");
osdl.net!shemmingerb611d512005-03-14 19:02:41 +0000464 return 1;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000465 }
466
Stephen Hemminger3d0b7432014-12-20 15:47:17 -0800467 if (rtnl_dump_filter(&rth, print_class, stdout) < 0) {
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000468 fprintf(stderr, "Dump terminated\n");
osdl.net!shemmingerb611d512005-03-14 19:02:41 +0000469 return 1;
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000470 }
471
Vadim Kochand954b342014-12-26 02:10:06 +0200472 if (show_graph)
473 graph_cls_show(stdout, &buf[0], &root_cls_list, 0);
474
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000475 return 0;
476}
477
478int do_class(int argc, char **argv)
479{
480 if (argc < 1)
481 return tc_class_list(0, NULL);
482 if (matches(*argv, "add") == 0)
483 return tc_class_modify(RTM_NEWTCLASS, NLM_F_EXCL|NLM_F_CREATE, argc-1, argv+1);
484 if (matches(*argv, "change") == 0)
485 return tc_class_modify(RTM_NEWTCLASS, 0, argc-1, argv+1);
486 if (matches(*argv, "replace") == 0)
487 return tc_class_modify(RTM_NEWTCLASS, NLM_F_CREATE, argc-1, argv+1);
488 if (matches(*argv, "delete") == 0)
489 return tc_class_modify(RTM_DELTCLASS, 0, argc-1, argv+1);
490#if 0
491 if (matches(*argv, "get") == 0)
492 return tc_class_get(RTM_GETTCLASS, 0, argc-1, argv+1);
493#endif
494 if (matches(*argv, "list") == 0 || matches(*argv, "show") == 0
495 || matches(*argv, "lst") == 0)
496 return tc_class_list(argc-1, argv+1);
Hasso Teppere5d179d2006-12-10 16:33:05 +0200497 if (matches(*argv, "help") == 0) {
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000498 usage();
Hasso Teppere5d179d2006-12-10 16:33:05 +0200499 return 0;
500 }
osdl.org!shemmingeraba5acd2004-04-15 20:56:59 +0000501 fprintf(stderr, "Command \"%s\" is unknown, try \"tc class help\".\n", *argv);
502 return -1;
503}