]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/netfilter/core.c
Merge branch 'fixes-2.6.23' of git://git.kernel.org/pub/scm/linux/kernel/git/galak...
[linux-2.6-omap-h63xx.git] / net / netfilter / core.c
index c3ebdbd917e9276e125b7a9733519d9d327219db..381a77cf0c9eb83c5900fb775f6e38a5fcd4b7ad 100644 (file)
@@ -5,10 +5,6 @@
  * way.
  *
  * Rusty Russell (C)2000 -- This code is GPL.
- *
- * February 2000: Modified by James Morris to have 1 queue per protocol.
- * 15-Mar-2000:   Added NF_REPEAT --RR.
- * 08-May-2003:          Internal logging interface added by Jozsef Kadlecsik.
  */
 #include <linux/kernel.h>
 #include <linux/netfilter.h>
@@ -207,7 +203,9 @@ int skb_make_writable(struct sk_buff **pskb, unsigned int writable_len)
                return 0;
 
        /* Not exclusive use of packet?  Must copy. */
-       if (skb_shared(*pskb) || skb_cloned(*pskb))
+       if (skb_cloned(*pskb) && !skb_clone_writable(*pskb, writable_len))
+               goto copy_skb;
+       if (skb_shared(*pskb))
                goto copy_skb;
 
        return pskb_may_pull(*pskb, writable_len);
@@ -233,17 +231,18 @@ void nf_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb,
 {
        __be32 diff[] = { ~from, to };
        if (skb->ip_summed != CHECKSUM_PARTIAL) {
-               *sum = csum_fold(csum_partial((char *)diff, sizeof(diff),
+               *sum = csum_fold(csum_partial(diff, sizeof(diff),
                                ~csum_unfold(*sum)));
                if (skb->ip_summed == CHECKSUM_COMPLETE && pseudohdr)
-                       skb->csum = ~csum_partial((char *)diff, sizeof(diff),
+                       skb->csum = ~csum_partial(diff, sizeof(diff),
                                                ~skb->csum);
        } else if (pseudohdr)
-               *sum = ~csum_fold(csum_partial((char *)diff, sizeof(diff),
+               *sum = ~csum_fold(csum_partial(diff, sizeof(diff),
                                csum_unfold(*sum)));
 }
 EXPORT_SYMBOL(nf_proto_csum_replace4);
 
+#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
 /* This does not belong here, but locally generated errors need it if connection
    tracking in use: without this, connection may not be in hash table, and hence
    manufactured ICMP or RST packets will not be associated with it. */
@@ -264,6 +263,22 @@ void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb)
 }
 EXPORT_SYMBOL(nf_ct_attach);
 
+void (*nf_ct_destroy)(struct nf_conntrack *);
+EXPORT_SYMBOL(nf_ct_destroy);
+
+void nf_conntrack_destroy(struct nf_conntrack *nfct)
+{
+       void (*destroy)(struct nf_conntrack *);
+
+       rcu_read_lock();
+       destroy = rcu_dereference(nf_ct_destroy);
+       BUG_ON(destroy == NULL);
+       destroy(nfct);
+       rcu_read_unlock();
+}
+EXPORT_SYMBOL(nf_conntrack_destroy);
+#endif /* CONFIG_NF_CONNTRACK */
+
 #ifdef CONFIG_PROC_FS
 struct proc_dir_entry *proc_net_netfilter;
 EXPORT_SYMBOL(proc_net_netfilter);