aboutsummaryrefslogtreecommitdiffstats
path: root/net/xfrm
diff options
context:
space:
mode:
authorMasahide NAKAMURA <nakam@linux-ipv6.org>2006-08-23 22:12:01 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-22 18:06:44 -0400
commite53820de0f81da1429048634cadc6ef5f50c2f8b (patch)
tree7a63689f564c0719a0d4fea2cc5d3b84ea00fbbd /net/xfrm
parent9afaca057980c02771f4657c455cc7592fcd7373 (diff)
[XFRM] IPV6: Restrict bundle reusing
For outbound transformation, bundle is checked whether it is suitable for current flow to be reused or not. In such IPv6 case as below, transformation may apply incorrect bundle for the flow instead of creating another bundle: - The policy selector has destination prefix length < 128 (Two or more addresses can be matched it) - Its bundle holds dst entry of default route whose prefix length < 128 (Previous traffic was used such route as next hop) - The policy and the bundle were used a transport mode state and this time flow address is not matched the bundled state. This issue is found by Mobile IPv6 usage to protect mobility signaling by IPsec, but it is not a Mobile IPv6 specific. This patch adds strict check to xfrm_bundle_ok() for each state mode and address when prefix length is less than 128. Signed-off-by: Masahide NAKAMURA <nakam@linux-ipv6.org> Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xfrm')
-rw-r--r--net/xfrm/xfrm_policy.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 56abb5c057d4..ad2a5cba1f5b 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1167,7 +1167,7 @@ static struct dst_entry *xfrm_dst_check(struct dst_entry *dst, u32 cookie)
1167 1167
1168static int stale_bundle(struct dst_entry *dst) 1168static int stale_bundle(struct dst_entry *dst)
1169{ 1169{
1170 return !xfrm_bundle_ok((struct xfrm_dst *)dst, NULL, AF_UNSPEC); 1170 return !xfrm_bundle_ok((struct xfrm_dst *)dst, NULL, AF_UNSPEC, 0);
1171} 1171}
1172 1172
1173void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev) 1173void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev)
@@ -1282,7 +1282,7 @@ EXPORT_SYMBOL(xfrm_init_pmtu);
1282 * still valid. 1282 * still valid.
1283 */ 1283 */
1284 1284
1285int xfrm_bundle_ok(struct xfrm_dst *first, struct flowi *fl, int family) 1285int xfrm_bundle_ok(struct xfrm_dst *first, struct flowi *fl, int family, int strict)
1286{ 1286{
1287 struct dst_entry *dst = &first->u.dst; 1287 struct dst_entry *dst = &first->u.dst;
1288 struct xfrm_dst *last; 1288 struct xfrm_dst *last;
@@ -1304,6 +1304,10 @@ int xfrm_bundle_ok(struct xfrm_dst *first, struct flowi *fl, int family)
1304 if (dst->xfrm->km.state != XFRM_STATE_VALID) 1304 if (dst->xfrm->km.state != XFRM_STATE_VALID)
1305 return 0; 1305 return 0;
1306 1306
1307 if (strict && fl && dst->xfrm->props.mode != XFRM_MODE_TUNNEL &&
1308 !xfrm_state_addr_flow_check(dst->xfrm, fl, family))
1309 return 0;
1310
1307 mtu = dst_mtu(dst->child); 1311 mtu = dst_mtu(dst->child);
1308 if (xdst->child_mtu_cached != mtu) { 1312 if (xdst->child_mtu_cached != mtu) {
1309 last = xdst; 1313 last = xdst;