diff options
Diffstat (limited to 'net/xfrm/xfrm_policy.c')
-rw-r--r-- | net/xfrm/xfrm_policy.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 00bcb88386c2..9bec2e8a838c 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -1407,6 +1407,7 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy, | |||
1407 | struct net *net = xp_net(policy); | 1407 | struct net *net = xp_net(policy); |
1408 | unsigned long now = jiffies; | 1408 | unsigned long now = jiffies; |
1409 | struct net_device *dev; | 1409 | struct net_device *dev; |
1410 | struct xfrm_mode *inner_mode; | ||
1410 | struct dst_entry *dst_prev = NULL; | 1411 | struct dst_entry *dst_prev = NULL; |
1411 | struct dst_entry *dst0 = NULL; | 1412 | struct dst_entry *dst0 = NULL; |
1412 | int i = 0; | 1413 | int i = 0; |
@@ -1437,6 +1438,17 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy, | |||
1437 | goto put_states; | 1438 | goto put_states; |
1438 | } | 1439 | } |
1439 | 1440 | ||
1441 | if (xfrm[i]->sel.family == AF_UNSPEC) { | ||
1442 | inner_mode = xfrm_ip2inner_mode(xfrm[i], | ||
1443 | xfrm_af2proto(family)); | ||
1444 | if (!inner_mode) { | ||
1445 | err = -EAFNOSUPPORT; | ||
1446 | dst_release(dst); | ||
1447 | goto put_states; | ||
1448 | } | ||
1449 | } else | ||
1450 | inner_mode = xfrm[i]->inner_mode; | ||
1451 | |||
1440 | if (!dst_prev) | 1452 | if (!dst_prev) |
1441 | dst0 = dst1; | 1453 | dst0 = dst1; |
1442 | else { | 1454 | else { |
@@ -1465,7 +1477,7 @@ static struct dst_entry *xfrm_bundle_create(struct xfrm_policy *policy, | |||
1465 | dst1->lastuse = now; | 1477 | dst1->lastuse = now; |
1466 | 1478 | ||
1467 | dst1->input = dst_discard; | 1479 | dst1->input = dst_discard; |
1468 | dst1->output = xfrm[i]->outer_mode->afinfo->output; | 1480 | dst1->output = inner_mode->afinfo->output; |
1469 | 1481 | ||
1470 | dst1->next = dst_prev; | 1482 | dst1->next = dst_prev; |
1471 | dst_prev = dst1; | 1483 | dst_prev = dst1; |