12 #include <netlink/cli/utils.h>
13 #include <netlink/cli/tc.h>
14 #include <netlink/cli/cls.h>
15 #include <netlink/route/cls/cgroup.h>
17 static void print_usage(
void)
20 "Usage: nl-cls-add [...] cgroup [OPTIONS]...\n"
23 " -h, --help Show this help text.\n"
24 " -e, --ematch=EXPR Ematch expression\n"
27 " nl-cls-add --dev=eth0 --parent=q_root cgroup\n");
30 static void parse_argv(
struct rtnl_tc *tc,
int argc,
char **argv)
32 struct rtnl_cls *cls = (
struct rtnl_cls *) tc;
33 struct rtnl_ematch_tree *tree;
37 static struct option long_opts[] = {
38 {
"help", 0, 0,
'h' },
39 {
"ematch", 1, 0,
'e' },
43 c = getopt_long(argc, argv,
"he:", long_opts, &optidx);
53 tree = nl_cli_cls_parse_ematch(cls, optarg);
54 rtnl_cgroup_set_ematch(cls, tree);
63 .tm_type = RTNL_TC_TYPE_CLS,
64 .tm_parse_argv = parse_argv,
67 static void __init cgroup_init(
void)
69 nl_cli_tc_register(&cgroup_module);
72 static void __exit cgroup_exit(
void)
74 nl_cli_tc_unregister(&cgroup_module);