Skip to content

Commit 7cc2edb

Browse files
committed
xfrm6: Don't forget to propagate peer into ipsec route.
Like ipv4, we have to propagate the ipv6 route peer into the ipsec top-level route during instantiation. Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 34c9204 commit 7cc2edb

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

net/ipv6/xfrm6_policy.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
9898
if (!xdst->u.rt6.rt6i_idev)
9999
return -ENODEV;
100100

101+
xdst->u.rt6.rt6i_peer = rt->rt6i_peer;
102+
if (rt->rt6i_peer)
103+
atomic_inc(&rt->rt6i_peer->refcnt);
104+
101105
/* Sheit... I remember I did this right. Apparently,
102106
* it was magically lost, so this code needs audit */
103107
xdst->u.rt6.rt6i_flags = rt->rt6i_flags & (RTF_ANYCAST |
@@ -216,6 +220,8 @@ static void xfrm6_dst_destroy(struct dst_entry *dst)
216220

217221
if (likely(xdst->u.rt6.rt6i_idev))
218222
in6_dev_put(xdst->u.rt6.rt6i_idev);
223+
if (likely(xdst->u.rt6.rt6i_peer))
224+
inet_putpeer(xdst->u.rt6.rt6i_peer);
219225
xfrm_dst_destroy(xdst);
220226
}
221227

0 commit comments

Comments
 (0)