[netfilter-cvslog] r3274 - in trunk/nfsim: . core kernelenv kernelenv/include kernelenv/include/net

rusty at netfilter.org rusty at netfilter.org
Thu Nov 11 04:38:55 CET 2004


Author: rusty at netfilter.org
Date: 2004-11-11 04:38:54 +0100 (Thu, 11 Nov 2004)
New Revision: 3274

Removed:
   trunk/nfsim/kernelenv/include/net/ip.h
Modified:
   trunk/nfsim/.links
   trunk/nfsim/Makefile
   trunk/nfsim/core/core.h
   trunk/nfsim/core/proc.c
   trunk/nfsim/core/proc.h
   trunk/nfsim/kernelenv/include/kernelenv.h
   trunk/nfsim/kernelenv/kernelenv.c
Log:
Update for more recent kernels (2.6.10-rc1-bk17).
Add ip.h to .links (try "make restorelinks").


Modified: trunk/nfsim/.links
===================================================================
--- trunk/nfsim/.links	2004-11-11 02:31:14 UTC (rev 3273)
+++ trunk/nfsim/.links	2004-11-11 03:38:54 UTC (rev 3274)
@@ -52,3 +52,4 @@
 ./net/sock.h
 ./net/udp.h
 ./net/protocol.h
+./net/ip.h

Modified: trunk/nfsim/Makefile
===================================================================
--- trunk/nfsim/Makefile	2004-11-11 02:31:14 UTC (rev 3273)
+++ trunk/nfsim/Makefile	2004-11-11 03:38:54 UTC (rev 3274)
@@ -76,7 +76,6 @@
 	cd doc && $(MAKE) $@
 	find . -name '*.o' -exec rm \{\} \;
 	rm -f kernelenv/include/linux/config.h
-	rm -f netfilter/include/linux/version.h
 	rm -f simulator core/fakesockopt.so.1.0 fakesockopt.so.1.0
 
 .PHONY:	distclean

Modified: trunk/nfsim/core/core.h
===================================================================
--- trunk/nfsim/core/core.h	2004-11-11 02:31:14 UTC (rev 3273)
+++ trunk/nfsim/core/core.h	2004-11-11 03:38:54 UTC (rev 3274)
@@ -207,11 +207,13 @@
 			struct nf_info *info,
 			unsigned int verdict);
 
-extern void (*ip_ct_attach)(struct sk_buff *, struct nf_ct_info *);
-
 #include <ipv4/ipv4.h>
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
 void (*ip_ct_attach)(struct sk_buff *, struct nf_ct_info *);
+#else
+void (*ip_ct_attach)(struct sk_buff *, struct sk_buff *);
+#endif
 
 void stop(void);
 

Modified: trunk/nfsim/core/proc.c
===================================================================
--- trunk/nfsim/core/proc.c	2004-11-11 02:31:14 UTC (rev 3273)
+++ trunk/nfsim/core/proc.c	2004-11-11 03:38:54 UTC (rev 3274)
@@ -22,7 +22,7 @@
 #include "proc.h"
 #include <kernelenv.h>
 
-struct proc_dir_entry proc_root, *proc_net;
+struct proc_dir_entry proc_root, *proc_net, *proc_net_stat;
 
 
 int proc_match(int len, const char *name, struct proc_dir_entry *de)
@@ -152,6 +152,7 @@
 	proc_root.owner = THIS_MODULE;
 
 	proc_net = proc_mkdir("net", 0);
+	proc_net_stat = proc_mkdir("stat", proc_net);
 
 	return 0;
 }

Modified: trunk/nfsim/core/proc.h
===================================================================
--- trunk/nfsim/core/proc.h	2004-11-11 02:31:14 UTC (rev 3273)
+++ trunk/nfsim/core/proc.h	2004-11-11 03:38:54 UTC (rev 3274)
@@ -41,7 +41,7 @@
 	mode_t mode;
 };
 
-extern struct proc_dir_entry proc_root, *proc_net;
+extern struct proc_dir_entry proc_root, *proc_net, *proc_net_stat;
 
 
 int proc_match(int len, const char *name, struct proc_dir_entry *de);

Modified: trunk/nfsim/kernelenv/include/kernelenv.h
===================================================================
--- trunk/nfsim/kernelenv/include/kernelenv.h	2004-11-11 02:31:14 UTC (rev 3273)
+++ trunk/nfsim/kernelenv/include/kernelenv.h	2004-11-11 03:38:54 UTC (rev 3274)
@@ -421,7 +421,12 @@
 	unsigned long		nfmark;
 	__u32			nfcache;
 	
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
 	struct nf_ct_info	*nfct;
+#else
+	struct nf_conntrack	*nfct;
+	__u32			nfctinfo;
+#endif
 
 #ifdef CONFIG_NETFILTER_DEBUG
         unsigned int		nf_debug;
@@ -461,6 +466,7 @@
 	struct nf_conntrack *master;
 };
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
 static inline void nf_conntrack_put(struct nf_ct_info *nfct)
 {
 	if (nfct && atomic_dec_and_test(&nfct->master->use))
@@ -471,9 +477,35 @@
 	if (nfct)
 		atomic_inc(&nfct->master->use);
 }
+#else
+static inline void nf_conntrack_put(struct nf_conntrack *nfct)
+{
+	if (nfct && atomic_dec_and_test(&nfct->use))
+		nfct->destroy(nfct);
+}
+static inline void nf_conntrack_get(struct nf_conntrack *nfct)
+{
+	if (nfct)
+		atomic_inc(&nfct->use);
+}
+static inline void nf_reset(struct sk_buff *skb)
+{
+	nf_conntrack_put(skb->nfct);
+	skb->nfct = NULL;
+#ifdef CONFIG_NETFILTER_DEBUG
+	skb->nf_debug = 0;
+#endif
+}
+static inline void nf_reset_debug(struct sk_buff *skb)
+{
+#ifdef CONFIG_NETFILTER_DEBUG
+	skb->nf_debug = 0;
+#endif
+}
+#endif /* 2.6.9 */
 
 struct sk_buff *alloc_skb(unsigned int size, int gfp_mask);
-inline void kfree_skb(struct sk_buff *skb);
+void kfree_skb(struct sk_buff *skb);
 
 #define dev_alloc_skb(s) alloc_skb(s,0)
 
@@ -529,16 +561,14 @@
 #define skb_copy(skb, gfp) \
 	skb_copy_expand(skb, skb_headroom(skb), skb_tailroom(skb), gfp)
 
-int skb_checksum_help(struct sk_buff **skb, int inward);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
+extern int skb_checksum_help(struct sk_buff **pskb, int inward)
+#else
+extern int skb_checksum_help(struct sk_buff *skb, int inward);
+#endif
 
 #define skb_shinfo(SKB)		((struct skb_shared_info *)((SKB)->end))
 
-static inline void nf_reset(struct sk_buff *skb)
-{
-	nf_conntrack_put(skb->nfct);
-	skb->nfct = NULL;
-}
-
 static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
 				       int len, void *buffer)
 {
@@ -877,6 +907,10 @@
 #define rcu_read_unlock()
 
 #define rcu_dereference(p) (p)
+#define rcu_assign_pointer(p, v)	({ \
+						smp_wmb(); \
+						(p) = (v); \
+					})
 
 void __generic_read_lock(spinlock_t *lock, const char *file, unsigned int line);
 void __generic_read_unlock(spinlock_t *lock, const char *file, unsigned int line);
@@ -1026,6 +1060,7 @@
 
 /* cache. simple. */
 #define GFP_ATOMIC 0x01
+#define GFP_KERNEL 0x02
 
 typedef struct kmem_cache_s kmem_cache_t;
 
@@ -1212,4 +1247,13 @@
 int single_open(struct file *, int (*)(struct seq_file *, void *), void *);
 int single_release(struct inode *, struct file *);
 int seq_release_private(struct inode *, struct file *);
+
+#define SEQ_START_TOKEN ((void *)1)
+
+/* if_ether.h */
+static inline struct ethhdr *eth_hdr(const struct sk_buff *skb)
+{
+	return (struct ethhdr *)skb->mac.raw;
+}
+
 #endif /* __HAVE_SIMULATOR_H */

Deleted: trunk/nfsim/kernelenv/include/net/ip.h
===================================================================

Modified: trunk/nfsim/kernelenv/kernelenv.c
===================================================================
--- trunk/nfsim/kernelenv/kernelenv.c	2004-11-11 02:31:14 UTC (rev 3273)
+++ trunk/nfsim/kernelenv/kernelenv.c	2004-11-11 03:38:54 UTC (rev 3274)
@@ -173,6 +173,9 @@
 	__copy(nfmark);
 	__copy(nfcache);
 	__copy(nfct);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,9)
+	__copy(nfctinfo);
+#endif
 	nf_conntrack_get(new->nfct);
 	
 
@@ -210,44 +213,56 @@
 	return (len <= skb_headroom(skb));
 }
 
-int skb_checksum_help(struct sk_buff **pskb, int inward)
+static int __skb_checksum_help(struct sk_buff *skb, int inward)
 {
 	unsigned int csum;
-	int ret = 0, offset = (*pskb)->h.raw - (*pskb)->data;
+	int ret = 0, offset = skb->h.raw - skb->data;
 
 	if (inward) {
-		(*pskb)->ip_summed = CHECKSUM_NONE;
+		skb->ip_summed = CHECKSUM_NONE;
 		goto out;
 	}
 
-	if (skb_shared(*pskb)  || skb_cloned(*pskb)) {
-		struct sk_buff *newskb = skb_copy(*pskb, GFP_ATOMIC);
+	if (skb_shared(skb)  || skb_cloned(skb)) {
+		struct sk_buff *newskb = skb_copy(skb, GFP_ATOMIC);
 		if (!newskb) {
 			ret = -ENOMEM;
 			goto out;
 		}
-		if ((*pskb)->sk)
-			skb_set_owner_w(newskb, (*pskb)->sk);
-		kfree_skb(*pskb);
-		*pskb = newskb;
+		if (skb->sk)
+			skb_set_owner_w(newskb, skb->sk);
+		kfree_skb(skb);
+		skb = newskb;
 	}
 
-	if (offset > (int)(*pskb)->len)
+	if (offset > (int)skb->len)
 		BUG();
-	csum = skb_checksum(*pskb, offset, (*pskb)->len-offset, 0);
+	csum = skb_checksum(skb, offset, skb->len-offset, 0);
 
-	offset = (*pskb)->tail - (*pskb)->h.raw;
+	offset = skb->tail - skb->h.raw;
 	if (offset <= 0)
 		BUG();
-	if ((*pskb)->csum + 2 > offset)
+	if (skb->csum + 2 > offset)
 		BUG();
 
-	*(u16*)((*pskb)->h.raw + (*pskb)->csum) = csum_fold(csum);
-	(*pskb)->ip_summed = CHECKSUM_NONE;
+	*(u16*)(skb->h.raw + skb->csum) = csum_fold(csum);
+	skb->ip_summed = CHECKSUM_NONE;
 out:	
 	return ret;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10)
+int skb_checksum_help(struct sk_buff **pskb, int inward)
+{
+	return __skb_checksum_help(*pskb, inward);
+}
+#else
+int skb_checksum_help(struct sk_buff *skb, int inward)
+{
+	return __skb_checksum_help(skb, inward);
+}
+#endif
+
 /*
 {
 	unsigned int csum;




More information about the netfilter-cvslog mailing list