12#include <netlink/cli/utils.h>
13#include <netlink/cli/cls.h>
14#include <netlink/route/cls/ematch.h>
16struct rtnl_cls *nl_cli_cls_alloc(
void)
20 if (!(cls = rtnl_cls_alloc()))
21 nl_cli_fatal(ENOMEM,
"Unable to allocate classifier object");
26struct nl_cache *nl_cli_cls_alloc_cache(
struct nl_sock *sock,
int ifindex,
29 struct nl_cache *cache;
33 nl_cli_fatal(err,
"Unable to allocate classifier cache: %s",
39void nl_cli_cls_parse_proto(
struct rtnl_cls *cls,
char *arg)
43 if ((proto = nl_str2ether_proto(arg)) < 0)
46 rtnl_cls_set_protocol(cls, proto);
49struct rtnl_ematch_tree *nl_cli_cls_parse_ematch(
struct rtnl_cls *cls,
char *arg)
51 struct rtnl_ematch_tree *tree;
55 if ((err = rtnl_ematch_parse_expr(arg, &errstr, &tree)) < 0)
56 nl_cli_fatal(err,
"Unable to parse ematch expression: %s",
void nl_cli_fatal(int err, const char *fmt,...)
Print error message and quit application.
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.