libnl 3.10.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 "nl-default.h"
7
8#include <netlink/cli/utils.h>
9#include <netlink/cli/tc.h>
10
11static void print_usage(void)
12{
13 printf(
14"Usage: nl-qdisc-add [...] ingress\n"
15"\n"
16"OPTIONS\n"
17" --help Show this help text.\n"
18"\n"
19"EXAMPLE"
20" # Attach ingress to eth1\n"
21" nl-qdisc-add --dev=eth1 --parent=root ingress\n");
22}
23
24static void ingress_parse_argv(struct rtnl_tc *tc, int argc, char **argv)
25{
26 for (;;) {
27 int c, optidx = 0;
28 static struct option long_opts[] = {
29 { "help", 0, 0, 'h' },
30 { 0, 0, 0, 0 }
31 };
32
33 c = getopt_long(argc, argv, "h", long_opts, &optidx);
34 if (c == -1)
35 break;
36
37 switch (c) {
38 case 'h':
39 print_usage();
40 return;
41 }
42 }
43}
44
45static struct nl_cli_tc_module ingress_module =
46{
47 .tm_name = "ingress",
48 .tm_type = RTNL_TC_TYPE_QDISC,
49 .tm_parse_argv = ingress_parse_argv,
50};
51
52static void _nl_init ingress_init(void)
53{
54 nl_cli_tc_register(&ingress_module);
55}
56
57static void _nl_exit ingress_exit(void)
58{
59 nl_cli_tc_unregister(&ingress_module);
60}