aboutsummaryrefslogtreecommitdiffstats
path: root/net/key/af_key.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2005-06-20 16:18:08 -0400
committerDavid S. Miller <davem@davemloft.net>2005-06-20 16:18:08 -0400
commit72cb6962a91f2af9eef69a06198e1949c10259ae (patch)
tree3ae65d1c4e7d7cb7ac05bfc6f457312df45f6996 /net/key/af_key.c
parent3f7a87d2fa9b42f7aade43914f060df68cc89cc7 (diff)
[IPSEC]: Add xfrm_init_state
This patch adds xfrm_init_state which is simply a wrapper that calls xfrm_get_type and subsequently x->type->init_state. It also gets rid of the unused args argument. Abstracting it out allows us to add common initialisation code, e.g., to set family-specific flags. The add_time setting in xfrm_user.c was deleted because it's already set by xfrm_state_alloc. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Acked-by: James Morris <jmorris@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/key/af_key.c')
-rw-r--r--net/key/af_key.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 98b72f2024ff..652dd09ccd3a 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -1096,17 +1096,11 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct sadb_msg *hdr,
1096 } 1096 }
1097 } 1097 }
1098 1098
1099 x->type = xfrm_get_type(proto, x->props.family); 1099 err = xfrm_init_state(x);
1100 if (x->type == NULL) { 1100 if (err)
1101 err = -ENOPROTOOPT;
1102 goto out;
1103 }
1104 if (x->type->init_state(x, NULL)) {
1105 err = -EINVAL;
1106 goto out; 1101 goto out;
1107 } 1102
1108 x->km.seq = hdr->sadb_msg_seq; 1103 x->km.seq = hdr->sadb_msg_seq;
1109 x->km.state = XFRM_STATE_VALID;
1110 return x; 1104 return x;
1111 1105
1112out: 1106out: