diff options
author | David S. Miller <davem@davemloft.net> | 2012-06-10 09:36:36 +0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-11 13:08:47 +0400 |
commit | 97bab73f987e2781129cd6f4b6379bf44d808cc6 (patch) | |
tree | 40b10c4c021c8b5524c19f79fcfe4b0799b59952 /net/ipv4/xfrm4_policy.c | |
parent | c0efc887dcadbdbfe171f028acfab9c7c00e9dde (diff) | |
download | linux-97bab73f987e2781129cd6f4b6379bf44d808cc6.tar.xz |
inet: Hide route peer accesses behind helpers.
We encode the pointer(s) into an unsigned long with one state bit.
The state bit is used so we can store the inetpeer tree root to use
when resolving the peer later.
Later the peer roots will be per-FIB table, and this change works to
facilitate that.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/xfrm4_policy.c')
-rw-r--r-- | net/ipv4/xfrm4_policy.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index 0d3426cb5c4f..8855d8268552 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c @@ -90,9 +90,7 @@ static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev, xdst->u.dst.dev = dev; dev_hold(dev); - xdst->u.rt.peer = rt->peer; - if (rt->peer) - atomic_inc(&rt->peer->refcnt); + rt_transfer_peer(&xdst->u.rt, rt); /* Sheit... I remember I did this right. Apparently, * it was magically lost, so this code needs audit */ @@ -212,8 +210,10 @@ static void xfrm4_dst_destroy(struct dst_entry *dst) dst_destroy_metrics_generic(dst); - if (likely(xdst->u.rt.peer)) - inet_putpeer(xdst->u.rt.peer); + if (rt_has_peer(&xdst->u.rt)) { + struct inet_peer *peer = rt_peer_ptr(&xdst->u.rt); + inet_putpeer(peer); + } xfrm_dst_destroy(xdst); } |