diff options
author | Cong Wang <xiyou.wangcong@gmail.com> | 2013-12-05 23:48:28 (GMT) |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2013-12-09 14:33:34 (GMT) |
commit | ffbfe92d74e8e7617cd4d04f09a05edabd4c2139 (patch) | |
tree | 0a9532f137c23c600e23f98d7142fc8e8e72e2d6 | |
parent | 017c9711427ad3169f248e9fc41972cf87f858b0 (diff) | |
download | libnl-ffbfe92d74e8e7617cd4d04f09a05edabd4c2139.zip libnl-ffbfe92d74e8e7617cd4d04f09a05edabd4c2139.tar.gz libnl-ffbfe92d74e8e7617cd4d04f09a05edabd4c2139.tar.bz2 |
add rtnl_mirred_get* functions
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
-rw-r--r-- | include/netlink/route/act/mirred.h | 3 | ||||
-rw-r--r-- | lib/route/act/mirred.c | 28 |
2 files changed, 31 insertions, 0 deletions
diff --git a/include/netlink/route/act/mirred.h b/include/netlink/route/act/mirred.h index 87da30c..d65ed37 100644 --- a/include/netlink/route/act/mirred.h +++ b/include/netlink/route/act/mirred.h @@ -22,8 +22,11 @@ extern "C" { #endif extern int rtnl_mirred_set_action(struct rtnl_act *, int); +extern int rtnl_mirred_get_action(struct rtnl_act *); extern int rtnl_mirred_set_ifindex(struct rtnl_act *, uint32_t); +extern uint32_t rtnl_mirred_get_ifindex(struct rtnl_act *); extern int rtnl_mirred_set_policy(struct rtnl_act *, int); +extern int rtnl_mirred_get_policy(struct rtnl_act *); #ifdef __cplusplus } diff --git a/lib/route/act/mirred.c b/lib/route/act/mirred.c index 37deada..2668048 100644 --- a/lib/route/act/mirred.c +++ b/lib/route/act/mirred.c @@ -151,6 +151,15 @@ int rtnl_mirred_set_action(struct rtnl_act *act, int action) return 0; } +int rtnl_mirred_get_action(struct rtnl_act *act) +{ + struct rtnl_mirred *u; + + if (!(u = (struct rtnl_mirred *) rtnl_tc_data(TC_CAST(act)))) + return -NLE_NOMEM; + return u->m_parm.eaction; +} + int rtnl_mirred_set_ifindex(struct rtnl_act *act, uint32_t ifindex) { struct rtnl_mirred *u; @@ -162,6 +171,15 @@ int rtnl_mirred_set_ifindex(struct rtnl_act *act, uint32_t ifindex) return 0; } +uint32_t rtnl_mirred_get_ifindex(struct rtnl_act *act) +{ + struct rtnl_mirred *u; + + if ((u = (struct rtnl_mirred *) rtnl_tc_data(TC_CAST(act)))) + return u->m_parm.ifindex; + return 0; +} + int rtnl_mirred_set_policy(struct rtnl_act *act, int policy) { struct rtnl_mirred *u; @@ -184,6 +202,16 @@ int rtnl_mirred_set_policy(struct rtnl_act *act, int policy) } return 0; } + +int rtnl_mirred_get_policy(struct rtnl_act *act) +{ + struct rtnl_mirred *u; + + if (!(u = (struct rtnl_mirred *) rtnl_tc_data(TC_CAST(act)))) + return -NLE_NOMEM; + return u->m_parm.action; +} + /** @} */ static struct rtnl_tc_ops mirred_ops = { |