18 #include <netlink/cli/utils.h> 19 #include <netlink/cli/cls.h> 20 #include <netlink/route/cls/ematch.h> 22 struct rtnl_cls *nl_cli_cls_alloc(
void)
26 if (!(cls = rtnl_cls_alloc()))
27 nl_cli_fatal(ENOMEM,
"Unable to allocate classifier object");
32 struct nl_cache *nl_cli_cls_alloc_cache(
struct nl_sock *sock,
int ifindex,
35 struct nl_cache *cache;
39 nl_cli_fatal(err,
"Unable to allocate classifier cache: %s",
45 void nl_cli_cls_parse_proto(
struct rtnl_cls *cls,
char *arg)
49 if ((proto = nl_str2ether_proto(arg)) < 0)
52 rtnl_cls_set_protocol(cls, proto);
55 struct rtnl_ematch_tree *nl_cli_cls_parse_ematch(
struct rtnl_cls *cls,
char *arg)
57 struct rtnl_ematch_tree *tree;
61 if ((err = rtnl_ematch_parse_expr(arg, &errstr, &tree)) < 0)
62 nl_cli_fatal(err,
"Unable to parse ematch expression: %s",
int rtnl_cls_alloc_cache(struct nl_sock *sk, int ifindex, uint32_t parent, struct nl_cache **result)
Allocate a cache and fill it with all configured classifiers.
void nl_cli_fatal(int err, const char *fmt,...)
Print error message and quit application.