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>
This commit is contained in:
parent
c0efc887dc
commit
97bab73f98
8 changed files with 193 additions and 59 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue