mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
[IPSEC]: Add xfrm_state_afinfo->init_flags
This patch adds the xfrm_state_afinfo->init_flags hook which allows each address family to perform any common initialisation that does not require a corresponding destructor call. It will be used subsequently to set the XFRM_STATE_NOPMTUDISC flag in IPv4. It also fixes up the error codes returned by xfrm_init_state. Signed-off-by: Herbert Xu <[email protected]> Acked-by: James Morris <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
72cb6962a9
commit
d094cd83c0
2 changed files with 19 additions and 2 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue