19 #include <netlink/cli/utils.h> 20 #include <netlink/cli/cls.h> 21 #include <netlink/route/cls/ematch.h> 23 struct rtnl_cls *nl_cli_cls_alloc(
void)
27 if (!(cls = rtnl_cls_alloc()))
28 nl_cli_fatal(ENOMEM,
"Unable to allocate classifier object");
33 struct nl_cache *nl_cli_cls_alloc_cache(
struct nl_sock *sock,
int ifindex,
36 struct nl_cache *cache;
40 nl_cli_fatal(err,
"Unable to allocate classifier cache: %s",
46 void nl_cli_cls_parse_proto(
struct rtnl_cls *cls,
char *arg)
50 if ((proto = nl_str2ether_proto(arg)) < 0)
53 rtnl_cls_set_protocol(cls, proto);
56 struct rtnl_ematch_tree *nl_cli_cls_parse_ematch(
struct rtnl_cls *cls,
char *arg)
58 struct rtnl_ematch_tree *tree;
62 if ((err = rtnl_ematch_parse_expr(arg, &errstr, &tree)) < 0)
63 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.