libnl: /data/src/libnl3/lib/cli/qdisc/ingress.c Source File

libnl 3.7.0

ingress.c
1 /* SPDX-License-Identifier: LGPL-2.1-only */
2 /*
3 * Copyright (c) 2013 Cong Wang <xiyou.wangcong@gmail.com>
4 */
5
6 #include <netlink/cli/utils.h>
7 #include <netlink/cli/tc.h>
8
9 static void print_usage(void)
10 {
11 printf(
12 "Usage: nl-qdisc-add [...] ingress\n"
13 "\n"
14 "OPTIONS\n"
15 " --help Show this help text.\n"
16 "\n"
17 "EXAMPLE"
18 " # Attach ingress to eth1\n"
19 " nl-qdisc-add --dev=eth1 --parent=root ingress\n");
20 }
21
22 static void ingress_parse_argv(struct rtnl_tc *tc, int argc, char **argv)
23 {
24 for (;;) {
25 int c, optidx = 0;
26 static struct option long_opts[] = {
27 { "help", 0, 0, 'h' },
28 { 0, 0, 0, 0 }
29 };
30
31 c = getopt_long(argc, argv, "h", long_opts, &optidx);
32 if (c == -1)
33 break;
34
35 switch (c) {
36 case 'h':
37 print_usage();
38 return;
39 }
40 }
41 }
42
43 static struct nl_cli_tc_module ingress_module =
44 {
45 .tm_name = "ingress",
46 .tm_type = RTNL_TC_TYPE_QDISC,
47 .tm_parse_argv = ingress_parse_argv,
48 };
49
50 static void __init ingress_init(void)
51 {
52 nl_cli_tc_register(&ingress_module);
53 }
54
55 static void __exit ingress_exit(void)
56 {
57 nl_cli_tc_unregister(&ingress_module);
58 }
nl_cli_tc_module
Definition: tc.h:27