diff options
author | Santhosh Kumar <sshanmugham@twitter.com> | 2017-03-20 06:47:34 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-05-03 11:00:42 (GMT) |
commit | 7a26c7934b64816ebf66ad4b129271633fb38a9a (patch) | |
tree | 4f169f483e4c33f4da61763eeddf422268e0738a /lib/route | |
parent | b9a5a832330fd8cb28bddcc84840f445ad5da3c4 (diff) | |
download | libnl-7a26c7934b64816ebf66ad4b129271633fb38a9a.zip libnl-7a26c7934b64816ebf66ad4b129271633fb38a9a.tar.gz libnl-7a26c7934b64816ebf66ad4b129271633fb38a9a.tar.bz2 |
Provide accessors for actions (rtnl_act).
Add accessor functions to retrieve actions on a tc object
and provide additional function to navigate the collection
of actions.
Diffstat (limited to 'lib/route')
-rw-r--r-- | lib/route/act.c | 9 | ||||
-rw-r--r-- | lib/route/cls/basic.c | 15 | ||||
-rw-r--r-- | lib/route/cls/u32.c | 15 |
3 files changed, 39 insertions, 0 deletions
diff --git a/lib/route/act.c b/lib/route/act.c index e429e00..836219d 100644 --- a/lib/route/act.c +++ b/lib/route/act.c @@ -27,6 +27,15 @@ static struct nl_object_ops act_obj_ops; static struct nl_cache_ops rtnl_act_ops; +struct rtnl_act * rtnl_act_next(struct rtnl_act *act) +{ + if (act == NULL) { + return NULL; + } + + return act->a_next; +} + int rtnl_act_append(struct rtnl_act **head, struct rtnl_act *new) { struct rtnl_act *p_act; diff --git a/lib/route/cls/basic.c b/lib/route/cls/basic.c index 6af3844..d330a19 100644 --- a/lib/route/cls/basic.c +++ b/lib/route/cls/basic.c @@ -233,6 +233,21 @@ int rtnl_basic_add_action(struct rtnl_cls *cls, struct rtnl_act *act) return rtnl_act_append(&b->b_act, act); } +struct rtnl_act* rtnl_basic_get_action(struct rtnl_cls *cls) +{ + struct rtnl_basic *b; + + if (!(b = rtnl_tc_data_peek(TC_CAST(cls)))) + return NULL; + + if (!(b->b_mask & BASIC_ATTR_ACTION)) + return NULL; + + struct rtnl_act* act = b->b_act; + rtnl_act_get(act); + return act; +} + int rtnl_basic_del_action(struct rtnl_cls *cls, struct rtnl_act *act) { struct rtnl_basic *b; diff --git a/lib/route/cls/u32.c b/lib/route/cls/u32.c index e8561c1..a6047b4 100644 --- a/lib/route/cls/u32.c +++ b/lib/route/cls/u32.c @@ -560,6 +560,21 @@ int rtnl_u32_add_action(struct rtnl_cls *cls, struct rtnl_act *act) return rtnl_act_append(&u->cu_act, act); } +struct rtnl_act* rtnl_u32_get_action(struct rtnl_cls *cls) +{ + struct rtnl_u32 *u; + + if (!(u = rtnl_tc_data_peek(TC_CAST(cls)))) + return NULL; + + if (!(u->cu_mask & U32_ATTR_ACTION)) + return NULL; + + struct rtnl_act* act = u->cu_act; + rtnl_act_get(act); + return act; +} + int rtnl_u32_del_action(struct rtnl_cls *cls, struct rtnl_act *act) { struct rtnl_u32 *u; |