diff options
author | Thomas Graf <tgraf@suug.ch> | 2010-10-28 22:20:42 (GMT) |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2010-10-28 22:20:42 (GMT) |
commit | d7a561a1372f819efc8cede30dc550d8e3afcc28 (patch) | |
tree | da9fefa62f5ffdca82fa374ebe0b207202719410 /src/lib/cls.c | |
parent | e1eacd6b16b014eb42bcf6683ebe2334c3a35c68 (diff) | |
download | libnl-d7a561a1372f819efc8cede30dc550d8e3afcc28.zip libnl-d7a561a1372f819efc8cede30dc550d8e3afcc28.tar.gz libnl-d7a561a1372f819efc8cede30dc550d8e3afcc28.tar.bz2 |
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 'src/lib/cls.c')
-rw-r--r-- | src/lib/cls.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/lib/cls.c b/src/lib/cls.c index 95997f5..7ada3d6 100644 --- a/src/lib/cls.c +++ b/src/lib/cls.c @@ -17,6 +17,7 @@ #include <netlink/cli/utils.h> #include <netlink/cli/cls.h> +#include <netlink/route/cls/ematch.h> struct rtnl_cls *nl_cli_cls_alloc(void) { @@ -57,6 +58,22 @@ void nl_cli_cls_parse_proto(struct rtnl_cls *cls, char *arg) rtnl_cls_set_protocol(cls, proto); } +struct rtnl_ematch_tree *nl_cli_cls_parse_ematch(struct rtnl_cls *cls, char *arg) +{ + struct rtnl_ematch_tree *tree; + char *errstr = NULL; + int err; + + if ((err = rtnl_ematch_parse_expr(arg, &errstr, &tree)) < 0) + nl_cli_fatal(err, "Unable to parse ematch expression: %s", + errstr); + + if (errstr) + free(errstr); + + return tree; +} + static NL_LIST_HEAD(cls_modules); struct nl_cli_cls_module *__nl_cli_cls_lookup(struct rtnl_cls_ops *ops) |