Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

basic: add action removal API

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
  • Loading branch information...
commit efdde42fcc063d725af0a92d24966c499998a8c0 1 parent 507897a
@congwang congwang authored tgraf committed
Showing with 20 additions and 0 deletions.
  1. +1 −0  include/netlink/route/cls/basic.h
  2. +19 −0 lib/route/cls/basic.c
View
1  include/netlink/route/cls/basic.h
@@ -25,6 +25,7 @@ extern uint32_t rtnl_basic_get_target(struct rtnl_cls *);
extern void rtnl_basic_set_ematch(struct rtnl_cls *,
struct rtnl_ematch_tree *);
extern struct rtnl_ematch_tree *rtnl_basic_get_ematch(struct rtnl_cls *);
+extern int rtnl_basic_del_action(struct rtnl_cls *, struct rtnl_act *);
#ifdef __cplusplus
}
View
19 lib/route/cls/basic.c
@@ -232,6 +232,25 @@ int rtnl_basic_add_action(struct rtnl_cls *cls, struct rtnl_act *act)
b->b_mask |= BASIC_ATTR_ACTION;
return rtnl_act_append(&b->b_act, act);
}
+
+int rtnl_basic_del_action(struct rtnl_cls *cls, struct rtnl_act *act)
+{
+ struct rtnl_basic *b;
+ int ret;
+
+ if (!act)
+ return 0;
+
+ if (!(b = rtnl_tc_data(TC_CAST(cls))))
+ return -NLE_NOMEM;
+
+ if (!(b->b_mask & BASIC_ATTR_ACTION))
+ return -NLE_INVAL;
+ ret = rtnl_act_remove(&b->b_act, act);
+ if (!b->b_act)
+ b->b_mask &= ~BASIC_ATTR_ACTION;
+ return ret;
+}
/** @} */
static struct rtnl_tc_ops basic_ops = {
Please sign in to comment.
Something went wrong with that request. Please try again.