On Thu, Sep 27, 2007 at 06:29:16PM +0800, Herbert Xu ([EMAIL PROTECTED]) wrote: > On Thu, Sep 27, 2007 at 02:07:53PM +0400, Evgeniy Polyakov wrote: > > > > It forces all inpuit/pre/post/forward hooks to be enbled not as a direct > > function call, but as additional lookups. And unability to remove > > netfilter from config. And just because of couple of checksum helpers... > > I'm certainly not against patches moving that code out of > netfilter.
I've attached simple patch which moves checksum helpers out of CONFIG_NETFILTER option but still in the same linux/netfilter.h header. This should be enough for removing 'select NETFILTER' in your patch. diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 1dd075e..6c3fb10 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h @@ -40,6 +40,29 @@ #endif #ifdef __KERNEL__ + +static inline void nf_csum_replace4(__sum16 *sum, __be32 from, __be32 to) +{ + __be32 diff[] = { ~from, to }; + + *sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum))); +} + +static inline void nf_csum_replace2(__sum16 *sum, __be16 from, __be16 to) +{ + nf_csum_replace4(sum, (__force __be32)from, (__force __be32)to); +} + +extern void nf_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb, + __be32 from, __be32 to, int pseudohdr); + +static inline void nf_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb, + __be16 from, __be16 to, int pseudohdr) +{ + nf_proto_csum_replace4(sum, skb, (__force __be32)from, + (__force __be32)to, pseudohdr); +} + #ifdef CONFIG_NETFILTER extern void netfilter_init(void); @@ -289,28 +312,6 @@ extern void nf_invalidate_cache(int pf); Returns true or false. */ extern int skb_make_writable(struct sk_buff **pskb, unsigned int writable_len); -static inline void nf_csum_replace4(__sum16 *sum, __be32 from, __be32 to) -{ - __be32 diff[] = { ~from, to }; - - *sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum))); -} - -static inline void nf_csum_replace2(__sum16 *sum, __be16 from, __be16 to) -{ - nf_csum_replace4(sum, (__force __be32)from, (__force __be32)to); -} - -extern void nf_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb, - __be32 from, __be32 to, int pseudohdr); - -static inline void nf_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb, - __be16 from, __be16 to, int pseudohdr) -{ - nf_proto_csum_replace4(sum, skb, (__force __be32)from, - (__force __be32)to, pseudohdr); -} - struct nf_afinfo { unsigned short family; __sum16 (*checksum)(struct sk_buff *skb, unsigned int hook, -- Evgeniy Polyakov - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html