aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/xfrm/xfrm_state.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 1845b73d69f..9d206c282cf 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -1058,10 +1058,26 @@ EXPORT_SYMBOL(xfrm_state_mtu);
int xfrm_init_state(struct xfrm_state *x)
{
+ struct xfrm_state_afinfo *afinfo;
+ int family = x->props.family;
int err;
- err = -ENOENT;
- x->type = xfrm_get_type(x->id.proto, x->props.family);
+ err = -EAFNOSUPPORT;
+ afinfo = xfrm_state_get_afinfo(family);
+ if (!afinfo)
+ goto error;
+
+ err = 0;
+ if (afinfo->init_flags)
+ err = afinfo->init_flags(x);
+
+ xfrm_state_put_afinfo(afinfo);
+
+ if (err)
+ goto error;
+
+ err = -EPROTONOSUPPORT;
+ x->type = xfrm_get_type(x->id.proto, family);
if (x->type == NULL)
goto error;