diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2007-10-08 20:25:08 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:54:54 -0400 |
commit | 83815dea47cf3e98ccbb6aecda08cba1ba91208f (patch) | |
tree | 6d728f3b26dc02685ec6c8eb5c08605adf9d2688 /net/xfrm | |
parent | 406ef77c893ebd882209be4e393d64b01fe72054 (diff) |
[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')
-rw-r--r-- | net/xfrm/xfrm_output.c | 22 | ||||
-rw-r--r-- | net/xfrm/xfrm_state.c | 23 |
2 files changed, 22 insertions, 23 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 @@ | |||
18 | #include <net/dst.h> | 18 | #include <net/dst.h> |
19 | #include <net/xfrm.h> | 19 | #include <net/xfrm.h> |
20 | 20 | ||
21 | static int xfrm_state_check_space(struct xfrm_state *x, struct sk_buff *skb) | ||
22 | { | ||
23 | int nhead = x->props.header_len + LL_RESERVED_SPACE(skb->dst->dev) | ||
24 | - skb_headroom(skb); | ||
25 | |||
26 | if (nhead > 0) | ||
27 | return pskb_expand_head(skb, nhead, 0, GFP_ATOMIC); | ||
28 | |||
29 | /* Check tail too... */ | ||
30 | return 0; | ||
31 | } | ||
32 | |||
33 | static int xfrm_state_check(struct xfrm_state *x, struct sk_buff *skb) | ||
34 | { | ||
35 | int err = xfrm_state_check_expire(x); | ||
36 | if (err < 0) | ||
37 | goto err; | ||
38 | err = xfrm_state_check_space(x, skb); | ||
39 | err: | ||
40 | return err; | ||
41 | } | ||
42 | |||
21 | int xfrm_output(struct sk_buff *skb) | 43 | int xfrm_output(struct sk_buff *skb) |
22 | { | 44 | { |
23 | struct dst_entry *dst = skb->dst; | 45 | struct dst_entry *dst = skb->dst; |
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 15734adc9367..0ecec34d265a 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -1152,29 +1152,6 @@ int xfrm_state_check_expire(struct xfrm_state *x) | |||
1152 | } | 1152 | } |
1153 | EXPORT_SYMBOL(xfrm_state_check_expire); | 1153 | EXPORT_SYMBOL(xfrm_state_check_expire); |
1154 | 1154 | ||
1155 | static int xfrm_state_check_space(struct xfrm_state *x, struct sk_buff *skb) | ||
1156 | { | ||
1157 | int nhead = x->props.header_len + LL_RESERVED_SPACE(skb->dst->dev) | ||
1158 | - skb_headroom(skb); | ||
1159 | |||
1160 | if (nhead > 0) | ||
1161 | return pskb_expand_head(skb, nhead, 0, GFP_ATOMIC); | ||
1162 | |||
1163 | /* Check tail too... */ | ||
1164 | return 0; | ||
1165 | } | ||
1166 | |||
1167 | int xfrm_state_check(struct xfrm_state *x, struct sk_buff *skb) | ||
1168 | { | ||
1169 | int err = xfrm_state_check_expire(x); | ||
1170 | if (err < 0) | ||
1171 | goto err; | ||
1172 | err = xfrm_state_check_space(x, skb); | ||
1173 | err: | ||
1174 | return err; | ||
1175 | } | ||
1176 | EXPORT_SYMBOL(xfrm_state_check); | ||
1177 | |||
1178 | struct xfrm_state * | 1155 | struct xfrm_state * |
1179 | xfrm_state_lookup(xfrm_address_t *daddr, __be32 spi, u8 proto, | 1156 | xfrm_state_lookup(xfrm_address_t *daddr, __be32 spi, u8 proto, |
1180 | unsigned short family) | 1157 | unsigned short family) |