2 * src/cls/cgroup.c Control Groups Classifier
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation version 2 of the License.
8 * Copyright (c) 2009 Thomas Graf <tgraf@suug.ch>
12 #include <netlink/route/cls/cgroup.h>
13 #include <netlink/route/cls/ematch.h>
15 static void print_usage(void)
18 "Usage: ... cgroup [OPTIONS]...\n"
21 " -h, --help Show this help.\n"
22 " -e, --ematch=MATCH Extended match (See --ematch help).\n"
23 " -c, --classid=HANDLE Target class to classify matching packets to.\n"
28 static void basic_parse_argv(struct rtnl_cls *cls, int argc, char **argv)
32 static struct option long_opts[] = {
33 { "help", 0, 0, 'h' },
34 { "ematch", 1, 0, 'e' },
35 { "classid", 1, 0, 'c' },
39 c = getopt_long(argc, argv, "he:c:", long_opts, &optidx);
52 if ((err = parse_ematch_syntax(optarg, &tree)) < 0)
53 fatal(err, "Error while parsing ematch: %s",
56 if ((err = rtnl_basic_set_ematch(cls, tree)) < 0)
57 fatal(err, "Unable to set ematch: %s",
65 static struct cls_module cgroup_module = {
67 .parse_argv = basic_parse_argv,
70 static void __init cgroup_init(void)
72 register_cls_module(&cgroup_module);
75 static void __exit cgroup_exit(void)
77 unregister_cls_module(&cgroup_module);