]> git.ipfire.org Git - thirdparty/libnl.git/commitdiff
add rtnl_mirred_get* functions
authorCong Wang <xiyou.wangcong@gmail.com>
Thu, 5 Dec 2013 23:48:28 +0000 (15:48 -0800)
committerThomas Graf <tgraf@suug.ch>
Mon, 9 Dec 2013 14:33:34 +0000 (15:33 +0100)
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
include/netlink/route/act/mirred.h
lib/route/act/mirred.c

index 87da30c50b1a15983533d0edbac1c3c4a17684d2..d65ed3788be615ed44fb24d203ef2a03c44d0385 100644 (file)
@@ -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
 }
index 37deada11b72accef38ff21e3d6b61ffe682c60a..266804815c3a50230f97ea0aa14b1cbcd4657eeb 100644 (file)
@@ -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 = {