diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2007-11-14 00:35:01 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:53:39 -0500 |
commit | 8ce68ceb55fb62d2c8e9a3e94c4ef6ff3e3064ce (patch) | |
tree | 4e226631c52d896d9a30120944a4d122874c3346 /net | |
parent | 274b3426db25b8d63cbf25475e728ce1ee6caebd (diff) |
[IPSEC]: Only set neighbour on top xfrm dst
The neighbour field is only used by dst_confirm which only ever happens on
the top-most xfrm dst. So it's a waste to duplicate for every other xfrm
dst. This patch moves its setting out of the loop so that only the top one
gets set.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/xfrm4_policy.c | 5 | ||||
-rw-r--r-- | net/ipv6/xfrm6_policy.c | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index 5ee3a2f9fb27..7d250a1bd2cf 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c | |||
@@ -144,6 +144,9 @@ __xfrm4_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int | |||
144 | dst_prev->child = &rt->u.dst; | 144 | dst_prev->child = &rt->u.dst; |
145 | dst->path = &rt->u.dst; | 145 | dst->path = &rt->u.dst; |
146 | 146 | ||
147 | /* Copy neighbout for reachability confirmation */ | ||
148 | dst->neighbour = neigh_clone(rt->u.dst.neighbour); | ||
149 | |||
147 | *dst_p = dst; | 150 | *dst_p = dst; |
148 | dst = dst_prev; | 151 | dst = dst_prev; |
149 | 152 | ||
@@ -164,8 +167,6 @@ __xfrm4_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int | |||
164 | dst_prev->trailer_len = trailer_len; | 167 | dst_prev->trailer_len = trailer_len; |
165 | memcpy(&dst_prev->metrics, &x->route->metrics, sizeof(dst_prev->metrics)); | 168 | memcpy(&dst_prev->metrics, &x->route->metrics, sizeof(dst_prev->metrics)); |
166 | 169 | ||
167 | /* Copy neighbout for reachability confirmation */ | ||
168 | dst_prev->neighbour = neigh_clone(rt->u.dst.neighbour); | ||
169 | dst_prev->input = rt->u.dst.input; | 170 | dst_prev->input = rt->u.dst.input; |
170 | dst_prev->output = dst_prev->xfrm->outer_mode->afinfo->output; | 171 | dst_prev->output = dst_prev->xfrm->outer_mode->afinfo->output; |
171 | if (rt0->peer) | 172 | if (rt0->peer) |
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index 5b02f0efd38e..bc508d0a87d5 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c | |||
@@ -188,6 +188,10 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int | |||
188 | 188 | ||
189 | dst_prev->child = &rt->u.dst; | 189 | dst_prev->child = &rt->u.dst; |
190 | dst->path = &rt->u.dst; | 190 | dst->path = &rt->u.dst; |
191 | |||
192 | /* Copy neighbour for reachability confirmation */ | ||
193 | dst->neighbour = neigh_clone(rt->u.dst.neighbour); | ||
194 | |||
191 | if (rt->rt6i_node) | 195 | if (rt->rt6i_node) |
192 | ((struct xfrm_dst *)dst)->path_cookie = rt->rt6i_node->fn_sernum; | 196 | ((struct xfrm_dst *)dst)->path_cookie = rt->rt6i_node->fn_sernum; |
193 | 197 | ||
@@ -210,8 +214,6 @@ __xfrm6_bundle_create(struct xfrm_policy *policy, struct xfrm_state **xfrm, int | |||
210 | dst_prev->trailer_len = trailer_len; | 214 | dst_prev->trailer_len = trailer_len; |
211 | memcpy(&dst_prev->metrics, &x->route->metrics, sizeof(dst_prev->metrics)); | 215 | memcpy(&dst_prev->metrics, &x->route->metrics, sizeof(dst_prev->metrics)); |
212 | 216 | ||
213 | /* Copy neighbour for reachability confirmation */ | ||
214 | dst_prev->neighbour = neigh_clone(rt->u.dst.neighbour); | ||
215 | dst_prev->input = rt->u.dst.input; | 217 | dst_prev->input = rt->u.dst.input; |
216 | dst_prev->output = dst_prev->xfrm->outer_mode->afinfo->output; | 218 | dst_prev->output = dst_prev->xfrm->outer_mode->afinfo->output; |
217 | /* Sheit... I remember I did this right. Apparently, | 219 | /* Sheit... I remember I did this right. Apparently, |