diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2006-11-15 00:43:23 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:23:42 -0500 |
commit | 43bc0ca7eadc024e9e5b935fa5e0892df4fec9eb (patch) | |
tree | 8e25b4ab9050c3fa5d47b38fced544b5587bcdd8 /include | |
parent | f9214b2627fb8582af1986afc4aed5942086a535 (diff) |
[NET]: netfilter checksum annotations
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/netfilter.h | 26 | ||||
-rw-r--r-- | include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h | 4 |
2 files changed, 23 insertions, 7 deletions
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 707bb2e53c4e..6ab5e2d6133e 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h | |||
@@ -282,11 +282,27 @@ extern void nf_invalidate_cache(int pf); | |||
282 | Returns true or false. */ | 282 | Returns true or false. */ |
283 | extern int skb_make_writable(struct sk_buff **pskb, unsigned int writable_len); | 283 | extern int skb_make_writable(struct sk_buff **pskb, unsigned int writable_len); |
284 | 284 | ||
285 | extern u_int16_t nf_csum_update(u_int32_t oldval, u_int32_t newval, | 285 | static inline void nf_csum_replace4(__sum16 *sum, __be32 from, __be32 to) |
286 | u_int32_t csum); | 286 | { |
287 | extern u_int16_t nf_proto_csum_update(struct sk_buff *skb, | 287 | __be32 diff[] = { ~from, to }; |
288 | u_int32_t oldval, u_int32_t newval, | 288 | |
289 | u_int16_t csum, int pseudohdr); | 289 | *sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum))); |
290 | } | ||
291 | |||
292 | static inline void nf_csum_replace2(__sum16 *sum, __be16 from, __be16 to) | ||
293 | { | ||
294 | nf_csum_replace4(sum, (__force __be32)from, (__force __be32)to); | ||
295 | } | ||
296 | |||
297 | extern void nf_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb, | ||
298 | __be32 from, __be32 to, int pseudohdr); | ||
299 | |||
300 | static inline void nf_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb, | ||
301 | __be16 from, __be16 to, int pseudohdr) | ||
302 | { | ||
303 | nf_proto_csum_replace4(sum, skb, (__force __be32)from, | ||
304 | (__force __be32)to, pseudohdr); | ||
305 | } | ||
290 | 306 | ||
291 | struct nf_afinfo { | 307 | struct nf_afinfo { |
292 | unsigned short family; | 308 | unsigned short family; |
diff --git a/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h b/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h index 1d853aa873eb..e371e0fc1672 100644 --- a/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h +++ b/include/linux/netfilter_ipv4/ip_conntrack_proto_gre.h | |||
@@ -102,11 +102,11 @@ static inline __be32 *gre_key(struct gre_hdr *greh) | |||
102 | } | 102 | } |
103 | 103 | ||
104 | /* get pointer ot gre csum, if present */ | 104 | /* get pointer ot gre csum, if present */ |
105 | static inline u_int16_t *gre_csum(struct gre_hdr *greh) | 105 | static inline __sum16 *gre_csum(struct gre_hdr *greh) |
106 | { | 106 | { |
107 | if (!greh->csum) | 107 | if (!greh->csum) |
108 | return NULL; | 108 | return NULL; |
109 | return (u_int16_t *) (greh+sizeof(*greh)); | 109 | return (__sum16 *) (greh+sizeof(*greh)); |
110 | } | 110 | } |
111 | 111 | ||
112 | #endif /* __KERNEL__ */ | 112 | #endif /* __KERNEL__ */ |