aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2007-10-18 00:34:46 -0400
committerDavid S. Miller <davem@davemloft.net>2007-10-18 00:34:46 -0400
commited3e37ddb0b422120d3d2d5da718c44c40af30ba (patch)
tree63e54b342e197045106581fde1005aff38e2df33 /net/ipv4
parent17c2a42a24e1e8dd6aa7cea4f84e034ab1bfff31 (diff)
[IPSEC]: Use the top IPv4 route's peer instead of the bottom
For IPv4 we were using the bottom route's peer instead of the top one. This is wrong because the peer is only used by TCP to keep track of information about the TCP destination address which certainly does not live in the bottom route. This patch fixes that which allows us to get rid of the family check since the bottom route could be IPv6 while the top one must always be IPv4. I've also changed the other fields which are IPv4-specific to get the info from the top route instead of potentially bogus data from the bottom route. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/xfrm4_policy.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index c65b8e03c049..1f0ea0e0371b 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -169,16 +169,16 @@ __xfrm4_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int
169 dst_prev->neighbour = neigh_clone(rt->u.dst.neighbour); 169 dst_prev->neighbour = neigh_clone(rt->u.dst.neighbour);
170 dst_prev->input = rt->u.dst.input; 170 dst_prev->input = rt->u.dst.input;
171 dst_prev->output = dst_prev->xfrm->mode->afinfo->output; 171 dst_prev->output = dst_prev->xfrm->mode->afinfo->output;
172 if (dst_prev->xfrm->props.family == AF_INET && rt->peer) 172 if (rt0->peer)
173 atomic_inc(&rt->peer->refcnt); 173 atomic_inc(&rt0->peer->refcnt);
174 x->u.rt.peer = rt->peer; 174 x->u.rt.peer = rt0->peer;
175 /* Sheit... I remember I did this right. Apparently, 175 /* Sheit... I remember I did this right. Apparently,
176 * it was magically lost, so this code needs audit */ 176 * it was magically lost, so this code needs audit */
177 x->u.rt.rt_flags = rt0->rt_flags&(RTCF_BROADCAST|RTCF_MULTICAST|RTCF_LOCAL); 177 x->u.rt.rt_flags = rt0->rt_flags&(RTCF_BROADCAST|RTCF_MULTICAST|RTCF_LOCAL);
178 x->u.rt.rt_type = rt->rt_type; 178 x->u.rt.rt_type = rt0->rt_type;
179 x->u.rt.rt_src = rt0->rt_src; 179 x->u.rt.rt_src = rt0->rt_src;
180 x->u.rt.rt_dst = rt0->rt_dst; 180 x->u.rt.rt_dst = rt0->rt_dst;
181 x->u.rt.rt_gateway = rt->rt_gateway; 181 x->u.rt.rt_gateway = rt0->rt_gateway;
182 x->u.rt.rt_spec_dst = rt0->rt_spec_dst; 182 x->u.rt.rt_spec_dst = rt0->rt_spec_dst;
183 x->u.rt.idev = rt0->idev; 183 x->u.rt.idev = rt0->idev;
184 in_dev_hold(rt0->idev); 184 in_dev_hold(rt0->idev);
@@ -280,7 +280,7 @@ static void xfrm4_dst_destroy(struct dst_entry *dst)
280 280
281 if (likely(xdst->u.rt.idev)) 281 if (likely(xdst->u.rt.idev))
282 in_dev_put(xdst->u.rt.idev); 282 in_dev_put(xdst->u.rt.idev);
283 if (dst->xfrm && dst->xfrm->props.family == AF_INET && likely(xdst->u.rt.peer)) 283 if (likely(xdst->u.rt.peer))
284 inet_putpeer(xdst->u.rt.peer); 284 inet_putpeer(xdst->u.rt.peer);
285 xfrm_dst_destroy(xdst); 285 xfrm_dst_destroy(xdst);
286} 286}