aboutsummaryrefslogtreecommitdiffstats
path: root/net/xfrm
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2008-12-03 18:38:07 -0500
committerDavid S. Miller <davem@davemloft.net>2008-12-03 18:38:07 -0500
commitd81d228567f55af517796638075dbbce9b40d7af (patch)
tree1c904a111ca0a494151b83cdb51792f70fe39835 /net/xfrm
parent29fa0b301bc823016d1a3bed41c36a8977ef9947 (diff)
xfrm: Accept XFRM_STATE_AF_UNSPEC SAs on IPv4/IPv6 only hosts
Installing SAs using the XFRM_STATE_AF_UNSPEC fails on hosts with support for one address family only. This patch accepts such SAs, even if the processing of not supported packets will fail. Signed-off-by: Martin Willi <martin@strongswan.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xfrm')
-rw-r--r--net/xfrm/xfrm_state.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 2fd57f8f77c1..e25ff62ab2a6 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -2022,8 +2022,9 @@ int xfrm_init_state(struct xfrm_state *x)
2022 x->inner_mode = inner_mode; 2022 x->inner_mode = inner_mode;
2023 } else { 2023 } else {
2024 struct xfrm_mode *inner_mode_iaf; 2024 struct xfrm_mode *inner_mode_iaf;
2025 int iafamily = AF_INET;
2025 2026
2026 inner_mode = xfrm_get_mode(x->props.mode, AF_INET); 2027 inner_mode = xfrm_get_mode(x->props.mode, x->props.family);
2027 if (inner_mode == NULL) 2028 if (inner_mode == NULL)
2028 goto error; 2029 goto error;
2029 2030
@@ -2031,22 +2032,17 @@ int xfrm_init_state(struct xfrm_state *x)
2031 xfrm_put_mode(inner_mode); 2032 xfrm_put_mode(inner_mode);
2032 goto error; 2033 goto error;
2033 } 2034 }
2035 x->inner_mode = inner_mode;
2034 2036
2035 inner_mode_iaf = xfrm_get_mode(x->props.mode, AF_INET6); 2037 if (x->props.family == AF_INET)
2036 if (inner_mode_iaf == NULL) 2038 iafamily = AF_INET6;
2037 goto error;
2038 2039
2039 if (!(inner_mode_iaf->flags & XFRM_MODE_FLAG_TUNNEL)) { 2040 inner_mode_iaf = xfrm_get_mode(x->props.mode, iafamily);
2040 xfrm_put_mode(inner_mode_iaf); 2041 if (inner_mode_iaf) {
2041 goto error; 2042 if (inner_mode_iaf->flags & XFRM_MODE_FLAG_TUNNEL)
2042 } 2043 x->inner_mode_iaf = inner_mode_iaf;
2043 2044 else
2044 if (x->props.family == AF_INET) { 2045 xfrm_put_mode(inner_mode_iaf);
2045 x->inner_mode = inner_mode;
2046 x->inner_mode_iaf = inner_mode_iaf;
2047 } else {
2048 x->inner_mode = inner_mode_iaf;
2049 x->inner_mode_iaf = inner_mode;
2050 } 2046 }
2051 } 2047 }
2052 2048