diff options
author | Thomas Graf <tgraf@suug.ch> | 2006-11-27 12:27:07 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:30:44 -0500 |
commit | e3703b3de1f049b38733ba520e5038f23063068e (patch) | |
tree | 3566516bc8b87c8c8d78b0c3287761c8e2f49a2b /net/decnet | |
parent | 4e9b82693542003b028c8494e9e3c49615b91ce7 (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/decnet')
-rw-r--r-- | net/decnet/dn_route.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c index 4eb985236aee..9881933167bd 100644 --- a/net/decnet/dn_route.c +++ b/net/decnet/dn_route.c | |||
@@ -1469,7 +1469,7 @@ static int dn_rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, | |||
1469 | struct rtmsg *r; | 1469 | struct rtmsg *r; |
1470 | struct nlmsghdr *nlh; | 1470 | struct nlmsghdr *nlh; |
1471 | unsigned char *b = skb->tail; | 1471 | unsigned char *b = skb->tail; |
1472 | struct rta_cacheinfo ci; | 1472 | long expires; |
1473 | 1473 | ||
1474 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*r), flags); | 1474 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*r), flags); |
1475 | r = NLMSG_DATA(nlh); | 1475 | r = NLMSG_DATA(nlh); |
@@ -1502,16 +1502,10 @@ static int dn_rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, | |||
1502 | RTA_PUT(skb, RTA_GATEWAY, 2, &rt->rt_gateway); | 1502 | RTA_PUT(skb, RTA_GATEWAY, 2, &rt->rt_gateway); |
1503 | if (rtnetlink_put_metrics(skb, rt->u.dst.metrics) < 0) | 1503 | if (rtnetlink_put_metrics(skb, rt->u.dst.metrics) < 0) |
1504 | goto rtattr_failure; | 1504 | goto rtattr_failure; |
1505 | ci.rta_lastuse = jiffies_to_clock_t(jiffies - rt->u.dst.lastuse); | 1505 | expires = rt->u.dst.expires ? rt->u.dst.expires - jiffies : 0; |
1506 | ci.rta_used = rt->u.dst.__use; | 1506 | if (rtnl_put_cacheinfo(skb, &rt->u.dst, 0, 0, 0, expires, |
1507 | ci.rta_clntref = atomic_read(&rt->u.dst.__refcnt); | 1507 | rt->u.dst.error) < 0) |
1508 | if (rt->u.dst.expires) | 1508 | goto rtattr_failure; |
1509 | ci.rta_expires = jiffies_to_clock_t(rt->u.dst.expires - jiffies); | ||
1510 | else | ||
1511 | ci.rta_expires = 0; | ||
1512 | ci.rta_error = rt->u.dst.error; | ||
1513 | ci.rta_id = ci.rta_ts = ci.rta_tsage = 0; | ||
1514 | RTA_PUT(skb, RTA_CACHEINFO, sizeof(ci), &ci); | ||
1515 | if (rt->fl.iif) | 1509 | if (rt->fl.iif) |
1516 | RTA_PUT(skb, RTA_IIF, sizeof(int), &rt->fl.iif); | 1510 | RTA_PUT(skb, RTA_IIF, sizeof(int), &rt->fl.iif); |
1517 | 1511 | ||