[netfilter-cvslog] r6662 - in trunk/nfsim: . core core/ipv4 core/ipv6 kernelenv/include netfilter

kaber at netfilter.org kaber at netfilter.org
Mon Aug 14 15:41:31 CEST 2006


Author: kaber at netfilter.org
Date: 2006-08-14 15:41:31 +0200 (Mon, 14 Aug 2006)
New Revision: 6662

Modified:
   trunk/nfsim/.config.sample
   trunk/nfsim/.links
   trunk/nfsim/UNSUPPORTED
   trunk/nfsim/core/core.c
   trunk/nfsim/core/core.h
   trunk/nfsim/core/ipv4/ipv4.c
   trunk/nfsim/core/ipv4/ipv4.h
   trunk/nfsim/core/ipv6/ipv6.c
   trunk/nfsim/core/ipv6/ipv6.h
   trunk/nfsim/core/tui.c
   trunk/nfsim/kernelenv/include/kernelenv.h
   trunk/nfsim/netfilter.c.sed
   trunk/nfsim/netfilter/Makefile.kbuild.in
Log:
Update nfsim for 2.6.17


Modified: trunk/nfsim/.config.sample
===================================================================
--- trunk/nfsim/.config.sample	2006-08-14 13:40:02 UTC (rev 6661)
+++ trunk/nfsim/.config.sample	2006-08-14 13:41:31 UTC (rev 6662)
@@ -14,7 +14,6 @@
 CONFIG_IP_NF_CONNTRACK=m
 CONFIG_IP_NF_CT_ACCT=y
 CONFIG_IP_NF_CONNTRACK_MARK=y
-CONFIG_IP_NF_CONNTRACK_EVENTS=y
 CONFIG_IP_NF_CT_PROTO_SCTP=m
 CONFIG_IP_NF_FTP=m
 CONFIG_IP_NF_IRC=m

Modified: trunk/nfsim/.links
===================================================================
--- trunk/nfsim/.links	2006-08-14 13:40:02 UTC (rev 6661)
+++ trunk/nfsim/.links	2006-08-14 13:41:31 UTC (rev 6662)
@@ -14,6 +14,7 @@
 ./linux/icmp.h
 ./linux/kernel.h
 ./linux/spinlock.h
+./linux/spinlock_types.h
 ./linux/netfilter.h
 ./linux/interrupt.h
 ./linux/stddef.h
@@ -58,6 +59,9 @@
 ./linux/kmalloc_sizes.h
 ./linux/ipv6.h
 ./linux/in6.h
+./linux/capability.h
+./linux/rcupdate.h
+./linux/mutex.h
 ./asm/uaccess.h
 ./asm/semaphore.h
 ./asm/system.h
@@ -83,3 +87,5 @@
 ./net/if_inet6.h
 ./net/ip6_route.h
 ./net/xfrm.h
+./net/compat.h
+./net/ip6_checksum.h

Modified: trunk/nfsim/UNSUPPORTED
===================================================================
--- trunk/nfsim/UNSUPPORTED	2006-08-14 13:40:02 UTC (rev 6661)
+++ trunk/nfsim/UNSUPPORTED	2006-08-14 13:41:31 UTC (rev 6662)
@@ -11,6 +11,7 @@
 CONFIG_NETFILTER_NETLINK_QUEUE
 CONFIG_IP_NF_TARGET_ULOG
 CONFIG_NETFILTER_NETLINK_LOG
+CONFIG_IP_NF_CONNTRACK_EVENTS
 CONFIG_IP_NF_CONNTRACK_NETLINK
 
 # No arptables

Modified: trunk/nfsim/core/core.c
===================================================================
--- trunk/nfsim/core/core.c	2006-08-14 13:40:02 UTC (rev 6661)
+++ trunk/nfsim/core/core.c	2006-08-14 13:41:31 UTC (rev 6662)
@@ -585,25 +585,39 @@
 }
 
 /* Don't do should_i_fail() here: it doesn't actually ever fail. */
-int __nf_register_hook_wrapper(struct nf_hook_ops *reg, struct module *owner,
-			       const char *location)
+int __nf_register_hook_wrapper(struct nf_hook_ops *reg, unsigned int n,
+			       struct module *owner, const char *location)
 {
+	unsigned int i;
 	int ret;
-	if (reg->owner && !streq(reg->owner->name, owner->name))
-		barf("nf_register_hook at %u: owner %s != %s\n",
-		     reg->owner->name, reg->owner);
-	reg->owner = owner;
 
-	ret = __nf_register_hook(reg);
-	if (ret == 0)
-		field_attach_static(reg, location, NULL);
+	for (i = 0; i < n; i++) {
+		if (reg->owner && !streq(reg[i].owner->name, owner->name))
+			barf("nf_register_hook at %u: owner %s != %s\n",
+			     reg[i].owner->name, reg[i].owner);
+		reg[i].owner = owner;
+
+		ret = __nf_register_hook(&reg[i]);
+		if (ret == 0)
+			field_attach_static(&reg[i], location, NULL);
+		else
+			goto err;
+	}
 	return ret;
+err:
+	if (i > 0)
+		__nf_unregister_hook_wrapper(reg, i);
+	return ret;
 }
 
-void __nf_unregister_hook_wrapper(struct nf_hook_ops *reg)
+void __nf_unregister_hook_wrapper(struct nf_hook_ops *reg, unsigned int n)
 {
-	field_detach_all(reg);
-	__nf_unregister_hook(reg);
+	unsigned int i;
+
+	for (i = 0; i < n; i++) {
+		field_detach_all(&reg[i]);
+		__nf_unregister_hook(&reg[i]);
+	}
 }
 
 int __nf_register_sockopt_wrapper(struct nf_sockopt_ops *reg,

Modified: trunk/nfsim/core/core.h
===================================================================
--- trunk/nfsim/core/core.h	2006-08-14 13:40:02 UTC (rev 6661)
+++ trunk/nfsim/core/core.h	2006-08-14 13:41:31 UTC (rev 6662)
@@ -159,14 +159,20 @@
 
 /* Function to register/unregister hook points. */
 #define nf_register_hook(reg) \
-	__nf_register_hook_wrapper(reg, THIS_MODULE, __location__)
-int __nf_register_hook_wrapper(struct nf_hook_ops *reg, struct module *owner,
-			     const char *location);
+	__nf_register_hook_wrapper(reg, 1, THIS_MODULE, __location__)
+#define nf_register_hooks(reg, n) \
+	__nf_register_hook_wrapper(reg, n, THIS_MODULE, __location__)
+int __nf_register_hook_wrapper(struct nf_hook_ops *reg, unsigned int n,
+			       struct module *owner, const char *location);
 #define nf_unregister_hook(reg) \
-	__nf_unregister_hook_wrapper(reg)
-void __nf_unregister_hook_wrapper(struct nf_hook_ops *reg);
+	__nf_unregister_hook_wrapper(reg, 1)
+#define nf_unregister_hooks(reg, n) \
+	__nf_unregister_hook_wrapper(reg, n)
+void __nf_unregister_hook_wrapper(struct nf_hook_ops *reg, unsigned int n);
 int __nf_register_hook(struct nf_hook_ops *reg);
 void __nf_unregister_hook(struct nf_hook_ops *reg);
+int __nf_register_hooks(struct nf_hook_ops *reg, unsigned int n);
+void __nf_unregister_hooks(struct nf_hook_ops *reg, unsigned int n);
 
 /* Functions to register get/setsockopt ranges (non-inclusive).  You
    need to check permissions yourself! */

Modified: trunk/nfsim/core/ipv4/ipv4.c
===================================================================
--- trunk/nfsim/core/ipv4/ipv4.c	2006-08-14 13:40:02 UTC (rev 6661)
+++ trunk/nfsim/core/ipv4/ipv4.c	2006-08-14 13:41:31 UTC (rev 6662)
@@ -858,7 +858,17 @@
 	return csum_tcpudp_magic(saddr,daddr,len,IPPROTO_TCP,base);
 }
 
+unsigned int csum_add(unsigned int csum, unsigned int addend)
+{
+	csum += addend;
+	return csum + (csum < addend);
+}
 
+unsigned int csum_sub(unsigned int csum, unsigned int addend)        
+{
+	return csum_add(csum, ~addend);
+}
+
 unsigned inet_addr_type(u32 addr)
 {
 	struct net_device *dev;

Modified: trunk/nfsim/core/ipv4/ipv4.h
===================================================================
--- trunk/nfsim/core/ipv4/ipv4.h	2006-08-14 13:40:02 UTC (rev 6661)
+++ trunk/nfsim/core/ipv4/ipv4.h	2006-08-14 13:41:31 UTC (rev 6662)
@@ -747,6 +747,9 @@
 
 unsigned int csum_fold(unsigned int sum);
 
+unsigned int csum_add(unsigned int csum, unsigned int addend);
+unsigned int csum_sub(unsigned int csum, unsigned int addend);
+
 unsigned int csum_partial(const void * buff, int len, unsigned int sum);
 /* unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum); */
 

Modified: trunk/nfsim/core/ipv6/ipv6.c
===================================================================
--- trunk/nfsim/core/ipv6/ipv6.c	2006-08-14 13:40:02 UTC (rev 6661)
+++ trunk/nfsim/core/ipv6/ipv6.c	2006-08-14 13:41:31 UTC (rev 6662)
@@ -75,3 +75,14 @@
 {
 	/* FIXME */
 }
+
+unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
+				   struct in6_addr *daddr,
+				   __u16 len,
+			           unsigned short proto,
+			           unsigned int csum) 
+{
+	/* FIXME */
+	return 0;
+}
+

Modified: trunk/nfsim/core/ipv6/ipv6.h
===================================================================
--- trunk/nfsim/core/ipv6/ipv6.h	2006-08-14 13:40:02 UTC (rev 6661)
+++ trunk/nfsim/core/ipv6/ipv6.h	2006-08-14 13:41:31 UTC (rev 6662)
@@ -58,4 +58,10 @@
 struct dst_entry *ip6_route_output(struct sock *sk, struct flowi *fl);
 void ip6_route_input(struct sk_buff *skb);
 
+unsigned short int csum_ipv6_magic(struct in6_addr *saddr,
+                                   struct in6_addr *daddr,
+                                   __u16 len,
+                                   unsigned short proto,
+                                   unsigned int csum);
+
 #endif /* __HAVE_IPV6_H */

Modified: trunk/nfsim/core/tui.c
===================================================================
--- trunk/nfsim/core/tui.c	2006-08-14 13:40:02 UTC (rev 6661)
+++ trunk/nfsim/core/tui.c	2006-08-14 13:41:31 UTC (rev 6662)
@@ -288,7 +288,7 @@
 
 	len = end - (line + *off);
 	cmdstr = talloc_asprintf(line, "PATH=%s; %.*s",
-				 extension_path, len, line + *off);
+				 extension_path, (int)len, line + *off);
 	cmdfile = popen(cmdstr, "r");
 	if (!cmdfile)
 		script_fail("failed to popen '%s': %s\n",

Modified: trunk/nfsim/kernelenv/include/kernelenv.h
===================================================================
--- trunk/nfsim/kernelenv/include/kernelenv.h	2006-08-14 13:40:02 UTC (rev 6661)
+++ trunk/nfsim/kernelenv/include/kernelenv.h	2006-08-14 13:41:31 UTC (rev 6662)
@@ -184,6 +184,7 @@
 #define kfree(p)   talloc_free(p)
 
 #define synchronize_net() 
+#define synchronize_rcu()
 
 #define dump_stack()
 
@@ -191,6 +192,7 @@
 
 #define BUG_ON(x) do { if (x) barf("%s:%u", __FILE__, __LINE__); } while(0)
 #define BUG() BUG_ON(1)
+#define BUILD_BUG_ON(x)
 
 #define cli()
 #define sti()
@@ -199,6 +201,7 @@
 #define NR_CPUS 1
 #define num_possible_cpus() 1
 #define for_each_cpu(cpu) for ((cpu) = 0; (cpu) < 1; (cpu)++)
+#define for_each_possible_cpu	for_each_cpu
 #define  SMP_CACHE_BYTES (1<<7)
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
 #define cpu_possible(cpu)	((cpu) == 0)
@@ -932,16 +935,40 @@
                                      struct nf_queue_handler *qh);
 extern void nf_unregister_queue_handlers(struct nf_queue_handler *qh);
 
+#define nf_info_reroute(x) ((void *)x + sizeof(struct nf_info))
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,17)
 struct nf_queue_rerouter {
 	void (*save)(const struct sk_buff *skb, struct nf_info *info);
 	int (*reroute)(struct sk_buff **skb, const struct nf_info *info);
 	int rer_size;
 };
 
-#define nf_info_reroute(x) ((void *)x + sizeof(struct nf_info))
 extern int nf_register_queue_rerouter(int pf, struct nf_queue_rerouter *rer);
 extern int nf_unregister_queue_rerouter(int pf);
+#else /* < 2.6.17 */
 
+struct nf_afinfo {
+	unsigned short	family;
+	unsigned int	(*checksum)(struct sk_buff *skb, unsigned int hook,
+				    unsigned int dataoff, u_int8_t protocol);
+	void		(*saveroute)(const struct sk_buff *skb,
+				     struct nf_info *info);
+	int		(*reroute)(struct sk_buff **skb,
+				   const struct nf_info *info);
+	int		route_key_size;
+};
+
+extern struct nf_afinfo *nf_afinfo[];
+static inline struct nf_afinfo *nf_get_afinfo(unsigned short family)
+{
+	return nf_afinfo[family];
+}
+
+extern int nf_register_afinfo(struct nf_afinfo *afinfo);
+extern void nf_unregister_afinfo(struct nf_afinfo *afinfo);
+
+#endif /* >= 2.6.17 */
 /* we overload the higher bits for encoding auxiliary data such as the queue
  * number. Not nice, but better than additional function arguments. */
 #define NF_VERDICT_MASK 0x0000ffff
@@ -1009,6 +1036,7 @@
   unsigned char		__pad[__SOCK_SIZE__ - sizeof(short int) -
 			sizeof(unsigned short int) - sizeof(struct in_addr)];
 };
+#define sin_zero	__pad
 
 /* route.h */
 #define RTO_CONN	0
@@ -1027,7 +1055,13 @@
 int notifier_chain_unregister(struct notifier_block **nl, struct notifier_block *n);
 int notifier_call_chain(struct notifier_block **n, unsigned long val, void *v);
 
+#define atomic_notifier_head notifier_block
+int atomic_notifier_chain_register(struct atomic_notifier_head **list, struct notifier_block *n);
+int atomic_notifier_chain_unregister(struct atomic_notifier_head **nl, struct notifier_block *n);
 
+#define ATOMIC_NOTIFIER_HEAD(name)	struct notifier_block name
+
+
 #define NOTIFY_DONE		0x0000		/* Don't care */
 #define NOTIFY_OK		0x0001		/* Suits me */
 #define NOTIFY_STOP_MASK	0x8000		/* Don't call further */
@@ -1222,6 +1256,15 @@
 	sema_init(sem, 1);
 }
 
+/* mutex.h */
+
+#define mutex				semaphore
+#define DEFINE_MUTEX			DECLARE_MUTEX
+#define mutex_init			init_MUTEX
+#define mutex_lock			down
+#define mutex_lock_interruptible	down_interruptible
+#define mutex_unlock			up
+
 /* sched.h */
 
 #define capable(x) 1
@@ -1541,6 +1584,7 @@
 #define simple_strtol(x, y, z)		strtol(x, y, z)
 
 /* xfrm.h */
+struct flowi;
 extern int xfrm_decode_session(struct sk_buff *skb, struct flowi *fl, unsigned short family);
 
 #endif /* __HAVE_SIMULATOR_H */

Modified: trunk/nfsim/netfilter/Makefile.kbuild.in
===================================================================
--- trunk/nfsim/netfilter/Makefile.kbuild.in	2006-08-14 13:40:02 UTC (rev 6661)
+++ trunk/nfsim/netfilter/Makefile.kbuild.in	2006-08-14 13:41:31 UTC (rev 6662)
@@ -21,10 +21,10 @@
 	$(LD) $(LDFLAGS) -g -r -o $(@) $($(@:.o=-objs))
 
 %.so:%.c
-	$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) $(GCOVFLAGS) -fPIC -shared -DMODULE -DKBUILD_MODNAME="\"$(@:.so=)\"" $(OUTPUT_OPTION) %LIBGCOV% $<
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) $(GCOVFLAGS) -fPIC -shared -DMODULE -DKBUILD_MODNAME=\"$(@:.so=)\" $(OUTPUT_OPTION)  $<
 
 %.so:
-	$(MAKE) CFLAGS="$(CFLAGS) -fPIC $(GCOVFLAGS) -DMODULE -DKBUILD_MODNAME=\"\"$(@:.so=)\"\"" $($(@:.so=-objs))
-	$(CC) -shared -o $(@) $($(@:.so=-objs)) %LIBGCOV%
+	$(MAKE) CFLAGS="$(CFLAGS) -fPIC $(GCOVFLAGS) -DMODULE -DKBUILD_MODNAME=\\\"$(@:.so=)\\\"" $($(@:.so=-objs))
+	$(CC) -shared -o $(@) $($(@:.so=-objs)) 
 
 

Modified: trunk/nfsim/netfilter.c.sed
===================================================================
--- trunk/nfsim/netfilter.c.sed	2006-08-14 13:40:02 UTC (rev 6661)
+++ trunk/nfsim/netfilter.c.sed	2006-08-14 13:41:31 UTC (rev 6662)
@@ -2,7 +2,9 @@
 s/^static LIST_HEAD(nf_sockopts);/LIST_HEAD(nf_sockopts);/
 s/^int nf_register_sockopt(/int __nf_register_sockopt(/
 s/^int nf_register_hook(/int __nf_register_hook(/
+s/^int nf_register_hooks(/int __nf_register_hooks(/
 s/^void nf_unregister_sockopt(/void __nf_unregister_sockopt(/
 s/^void nf_unregister_hook(/void __nf_unregister_hook(/
+s/^void nf_unregister_hooks(/void __nf_unregister_hooks(/
 s/^int skb_ip_make_writable(/int __unused_skb_ip_make_writable(/
 s/^int skb_make_writable/int __unused_skb_make_writable/




More information about the netfilter-cvslog mailing list