basic: add action removal API
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
This commit is contained in:
parent
507897a53e
commit
efdde42fcc
2 changed files with 20 additions and 0 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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 = {
|
||||
|
|
Loading…
Add table
Reference in a new issue