aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/route.c
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2006-11-27 12:27:07 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:30:44 -0500
commite3703b3de1f049b38733ba520e5038f23063068e (patch)
tree3566516bc8b87c8c8d78b0c3287761c8e2f49a2b /net/ipv6/route.c
parent4e9b82693542003b028c8494e9e3c49615b91ce7 (diff)
[RTNETLINK]: Add rtnl_put_cacheinfo() to unify some code
IPv4, IPv6, and DECNet all use struct rta_cacheinfo in a similiar way, therefore rtnl_put_cacheinfo() is added to reuse code. Signed-off-by: Thomas Graf <tgraf@suug.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/route.c')
-rw-r--r--net/ipv6/route.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 0bf17a3cf085..9f80518aacbd 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -2027,7 +2027,7 @@ static int rt6_fill_node(struct sk_buff *skb, struct rt6_info *rt,
2027{ 2027{
2028 struct rtmsg *rtm; 2028 struct rtmsg *rtm;
2029 struct nlmsghdr *nlh; 2029 struct nlmsghdr *nlh;
2030 struct rta_cacheinfo ci; 2030 long expires;
2031 u32 table; 2031 u32 table;
2032 2032
2033 if (prefix) { /* user wants prefix routes only */ 2033 if (prefix) { /* user wants prefix routes only */
@@ -2101,18 +2101,11 @@ static int rt6_fill_node(struct sk_buff *skb, struct rt6_info *rt,
2101 NLA_PUT_U32(skb, RTA_OIF, rt->rt6i_dev->ifindex); 2101 NLA_PUT_U32(skb, RTA_OIF, rt->rt6i_dev->ifindex);
2102 2102
2103 NLA_PUT_U32(skb, RTA_PRIORITY, rt->rt6i_metric); 2103 NLA_PUT_U32(skb, RTA_PRIORITY, rt->rt6i_metric);
2104 ci.rta_lastuse = jiffies_to_clock_t(jiffies - rt->u.dst.lastuse); 2104
2105 if (rt->rt6i_expires) 2105 expires = rt->rt6i_expires ? rt->rt6i_expires - jiffies : 0;
2106 ci.rta_expires = jiffies_to_clock_t(rt->rt6i_expires - jiffies); 2106 if (rtnl_put_cacheinfo(skb, &rt->u.dst, 0, 0, 0,
2107 else 2107 expires, rt->u.dst.error) < 0)
2108 ci.rta_expires = 0; 2108 goto nla_put_failure;
2109 ci.rta_used = rt->u.dst.__use;
2110 ci.rta_clntref = atomic_read(&rt->u.dst.__refcnt);
2111 ci.rta_error = rt->u.dst.error;
2112 ci.rta_id = 0;
2113 ci.rta_ts = 0;
2114 ci.rta_tsage = 0;
2115 NLA_PUT(skb, RTA_CACHEINFO, sizeof(ci), &ci);
2116 2109
2117 return nlmsg_end(skb, nlh); 2110 return nlmsg_end(skb, nlh);
2118 2111