diff options
author | 2007-10-08 17:25:08 -0700 | |
---|---|---|
committer | 2007-10-10 16:54:54 -0700 | |
commit | 83815dea47cf3e98ccbb6aecda08cba1ba91208f (patch) | |
tree | 6d728f3b26dc02685ec6c8eb5c08605adf9d2688 /net/xfrm/xfrm_output.c | |
parent | [IPSEC]: Move common output code to xfrm_output (diff) | |
download | linux-83815dea47cf3e98ccbb6aecda08cba1ba91208f.tar.gz linux-83815dea47cf3e98ccbb6aecda08cba1ba91208f.tar.bz2 linux-83815dea47cf3e98ccbb6aecda08cba1ba91208f.zip |
[IPSEC]: Move xfrm_state_check into xfrm_output.c
The functions xfrm_state_check and xfrm_state_check_space are only used by
the output code in xfrm_output.c so we can move them over.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xfrm/xfrm_output.c')
-rw-r--r-- | net/xfrm/xfrm_output.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c index 75f289b488a7..5b1c978a323c 100644 --- a/net/xfrm/xfrm_output.c +++ b/net/xfrm/xfrm_output.c @@ -18,6 +18,28 @@ #include <net/dst.h> #include <net/xfrm.h> +static int xfrm_state_check_space(struct xfrm_state *x, struct sk_buff *skb) +{ + int nhead = x->props.header_len + LL_RESERVED_SPACE(skb->dst->dev) + - skb_headroom(skb); + + if (nhead > 0) + return pskb_expand_head(skb, nhead, 0, GFP_ATOMIC); + + /* Check tail too... */ + return 0; +} + +static int xfrm_state_check(struct xfrm_state *x, struct sk_buff *skb) +{ + int err = xfrm_state_check_expire(x); + if (err < 0) + goto err; + err = xfrm_state_check_space(x, skb); +err: + return err; +} + int xfrm_output(struct sk_buff *skb) { struct dst_entry *dst = skb->dst; |