summaryrefslogtreecommitdiff
path: root/lib/cli
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2010-10-29 00:20:42 +0200
committerThomas Graf <tgraf@suug.ch>2010-10-29 00:20:42 +0200
commitd7a561a1372f819efc8cede30dc550d8e3afcc28 (patch)
treeda9fefa62f5ffdca82fa374ebe0b207202719410 /lib/cli
parente1eacd6b16b014eb42bcf6683ebe2334c3a35c68 (diff)
downloadlibnl-d7a561a1372f819efc8cede30dc550d8e3afcc28.tar.gz
Tons of ematch work
- Fixes a bunch of bugs related to ematches - Adds support for the nbyte ematch - Adds a bison/flex parser for ematch expressions, expressions may look like this: ip.length > 256 && pattern(ip6.src = 3ffe::/16) documenation on syntax follows - adds ematch support to the basic classifier (--ematch EXPR)
Diffstat (limited to 'lib/cli')
-rw-r--r--lib/cli/cls/basic.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/cli/cls/basic.c b/lib/cli/cls/basic.c
index fbe2173..9ec46ef 100644
--- a/lib/cli/cls/basic.c
+++ b/lib/cli/cls/basic.c
@@ -21,6 +21,7 @@ static void print_usage(void)
"OPTIONS\n"
" -h, --help Show this help text.\n"
" -t, --target=ID Target class to send matching packets to\n"
+" -e, --ematch=EXPR Ematch expression\n"
"\n"
"EXAMPLE"
" # Create a \"catch-all\" classifier, attached to \"q_root\", classyfing\n"
@@ -30,6 +31,7 @@ static void print_usage(void)
static int parse_argv(struct rtnl_cls *cls, int argc, char **argv)
{
+ struct rtnl_ematch_tree *tree;
uint32_t target;
int err;
@@ -42,10 +44,11 @@ static int parse_argv(struct rtnl_cls *cls, int argc, char **argv)
static struct option long_opts[] = {
{ "help", 0, 0, 'h' },
{ "target", 1, 0, 't' },
+ { "ematch", 1, 0, 'e' },
{ 0, 0, 0, 0 }
};
- c = getopt_long(argc, argv, "ht:", long_opts, &optidx);
+ c = getopt_long(argc, argv, "ht:e:", long_opts, &optidx);
if (c == -1)
break;
@@ -59,7 +62,12 @@ static int parse_argv(struct rtnl_cls *cls, int argc, char **argv)
nl_cli_fatal(err, "Unable to parse target \"%s\":",
optarg, nl_geterror(err));
- rtnl_basic_set_classid(cls, target);
+ rtnl_basic_set_target(cls, target);
+ break;
+
+ case 'e':
+ tree = nl_cli_cls_parse_ematch(cls, optarg);
+ rtnl_basic_set_ematch(cls, tree);
break;
}
}