diff options
-rw-r--r-- | include/net/xfrm.h | 1 | ||||
-rw-r--r-- | net/xfrm/xfrm_state.c | 20 |
2 files changed, 19 insertions, 2 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 77bfdde440f8..029522a4ceda 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -204,6 +204,7 @@ struct xfrm_state_afinfo { | |||
204 | rwlock_t lock; | 204 | rwlock_t lock; |
205 | struct list_head *state_bydst; | 205 | struct list_head *state_bydst; |
206 | struct list_head *state_byspi; | 206 | struct list_head *state_byspi; |
207 | int (*init_flags)(struct xfrm_state *x); | ||
207 | void (*init_tempsel)(struct xfrm_state *x, struct flowi *fl, | 208 | void (*init_tempsel)(struct xfrm_state *x, struct flowi *fl, |
208 | struct xfrm_tmpl *tmpl, | 209 | struct xfrm_tmpl *tmpl, |
209 | xfrm_address_t *daddr, xfrm_address_t *saddr); | 210 | xfrm_address_t *daddr, xfrm_address_t *saddr); |
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 1845b73d69f9..9d206c282cf1 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -1058,10 +1058,26 @@ EXPORT_SYMBOL(xfrm_state_mtu); | |||
1058 | 1058 | ||
1059 | int xfrm_init_state(struct xfrm_state *x) | 1059 | int xfrm_init_state(struct xfrm_state *x) |
1060 | { | 1060 | { |
1061 | struct xfrm_state_afinfo *afinfo; | ||
1062 | int family = x->props.family; | ||
1061 | int err; | 1063 | int err; |
1062 | 1064 | ||
1063 | err = -ENOENT; | 1065 | err = -EAFNOSUPPORT; |
1064 | x->type = xfrm_get_type(x->id.proto, x->props.family); | 1066 | afinfo = xfrm_state_get_afinfo(family); |
1067 | if (!afinfo) | ||
1068 | goto error; | ||
1069 | |||
1070 | err = 0; | ||
1071 | if (afinfo->init_flags) | ||
1072 | err = afinfo->init_flags(x); | ||
1073 | |||
1074 | xfrm_state_put_afinfo(afinfo); | ||
1075 | |||
1076 | if (err) | ||
1077 | goto error; | ||
1078 | |||
1079 | err = -EPROTONOSUPPORT; | ||
1080 | x->type = xfrm_get_type(x->id.proto, family); | ||
1065 | if (x->type == NULL) | 1081 | if (x->type == NULL) |
1066 | goto error; | 1082 | goto error; |
1067 | 1083 | ||