[netfilter-cvslog] r3314 - in trunk/nfsim: . core core/ipv4 kernelenv/include netfilter tools

rusty at netfilter.org rusty at netfilter.org
Fri Dec 10 06:25:23 CET 2004


Author: rusty at netfilter.org
Date: 2004-12-10 06:25:22 +0100 (Fri, 10 Dec 2004)
New Revision: 3314

Modified:
   trunk/nfsim/.links
   trunk/nfsim/Makefile
   trunk/nfsim/core/core.h
   trunk/nfsim/core/ipv4/ipv4.c
   trunk/nfsim/core/ipv4/ipv4.h
   trunk/nfsim/kernelenv/include/kernelenv.h
   trunk/nfsim/netfilter/Makefile.kbuild
   trunk/nfsim/tools/module.c
Log:
More recent kernel support (2.6.10-rc3).
GCOV stuff.


Modified: trunk/nfsim/.links
===================================================================
--- trunk/nfsim/.links	2004-12-10 05:22:13 UTC (rev 3313)
+++ trunk/nfsim/.links	2004-12-10 05:25:22 UTC (rev 3314)
@@ -51,6 +51,7 @@
 ./asm/hardirq.h
 ./asm/softirq.h
 ./asm/statfs.h
+./asm/page.h
 ./net/tcp.h
 ./net/checksum.h
 ./net/route.h
@@ -59,3 +60,4 @@
 ./net/udp.h
 ./net/protocol.h
 ./net/ip.h
+./net/dst.h

Modified: trunk/nfsim/Makefile
===================================================================
--- trunk/nfsim/Makefile	2004-12-10 05:22:13 UTC (rev 3313)
+++ trunk/nfsim/Makefile	2004-12-10 05:25:22 UTC (rev 3314)
@@ -2,12 +2,13 @@
 CC = gcc
 KERNELDIR ?= /lib/modules/$(shell uname -r)/build
 
-CFLAGS   = -Wstrict-prototypes -Wunused -Wall -g -ggdb -Wa,-W
+CFLAGS   = -Wstrict-prototypes -Wunused -Wall -g -Wa,-W
 CPPFLAGS = -I. -I$(shell pwd)/core -I$(shell pwd)/kernelenv/include \
 	   -I$(shell pwd)/netfilter/include
 
 #MAKEFLAGS += --no-print-directory
 
+#GCOVFLAGS = -fprofile-arcs -ftest-coverage
 
 #CPPFLAGS+=-nostdinc
 
@@ -35,7 +36,7 @@
 OBJS += netfilter/netfilter.o
 
 simulator: kernelenv/include/linux/config.h$(HELP_OBJS) $(OBJS) 
-	$(CC) $(CFLAGS) $(LDFLAGS) -lreadline -lcurses -o $@ \
+	$(CC) $(GCOVFLAGS) $(CFLAGS) $(LDFLAGS) -lreadline -lcurses -o $@ \
 		$(HELP_OBJS) $(OBJS)
 
 kernelenv/include/linux/config.h: .config
@@ -69,17 +70,22 @@
 	cp .config.sample .config
 	cd doc && $(MAKE) links
 
+gcov:
+	set -e; for f in `find netfilter/ -name '*.c'`; do (cd `dirname $$f` && gcov `basename $$f`); done
+
+gcov-clean:
+	find . \( -name '*.da' -o -name '*.bb' -o -name '*.bbg' -o -name '*.gcov' \) -exec rm \{\} \;
 importclean: distclean
 
 .PHONY:	clean
-clean:
+clean: gcov-clean
 	cd doc && $(MAKE) $@
 	find . -name '*.o' -exec rm \{\} \;
 	rm -f kernelenv/include/linux/config.h
 	rm -f simulator core/fakesockopt.so.1.0 fakesockopt.so.1.0
 
 .PHONY:	distclean
-distclean:
+distclean: clean
 	cd doc && $(MAKE) $@
 	rm -rf netfilter/$(TYPE)
 	rm -rf netfilter/core/* netfilter/include/linux/*

Modified: trunk/nfsim/core/core.h
===================================================================
--- trunk/nfsim/core/core.h	2004-12-10 05:22:13 UTC (rev 3313)
+++ trunk/nfsim/core/core.h	2004-12-10 05:25:22 UTC (rev 3314)
@@ -251,7 +251,7 @@
 {
 	unsigned int ret = ops->hook(hooknum, skb, in, out, okfn);
 	nfsim_log(LOG_HOOK, "hook:%s %s %s%s",
-		   nf_hooknames[PF_INET][hooknum], ops->owner,
+		   nf_hooknames[PF_INET][hooknum], ops->owner->name,
 		   nf_retval(ret), describe_packet(*skb));
 	return ret;
 }

Modified: trunk/nfsim/core/ipv4/ipv4.c
===================================================================
--- trunk/nfsim/core/ipv4/ipv4.c	2004-12-10 05:22:13 UTC (rev 3313)
+++ trunk/nfsim/core/ipv4/ipv4.c	2004-12-10 05:25:22 UTC (rev 3314)
@@ -317,6 +317,15 @@
 }
 #endif
 
+/* 2.6.10-rc3 added this. */
+int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl,
+		struct sock *sk, int flags)
+{
+	struct rtable **rp = (void *)dst_p;
+
+	return __ip_route_output_key(rp, fl);
+}
+
 int ip_forward(struct sk_buff *skb)
 {
 	u32 check;

Modified: trunk/nfsim/core/ipv4/ipv4.h
===================================================================
--- trunk/nfsim/core/ipv4/ipv4.h	2004-12-10 05:22:13 UTC (rev 3313)
+++ trunk/nfsim/core/ipv4/ipv4.h	2004-12-10 05:25:22 UTC (rev 3314)
@@ -355,10 +355,30 @@
 			__u32			saddr;
 			__u32			fwmark;
 			__u8			tos;
-			/*__u8			scope;*/
+			__u8			scope;
 		} ip4_u;
-		
+
+#if 0		
+		struct {
+			struct in6_addr		daddr;
+			struct in6_addr		saddr;
+			__u32			flowlabel;
+		} ip6_u;
+#endif
+		struct {
+			__u16			daddr;
+			__u16			saddr;
+			__u32			fwmark;
+			__u8			scope;
+		} dn_u;
 	} nl_u;
+#define fld_dst		nl_u.dn_u.daddr
+#define fld_src		nl_u.dn_u.saddr
+#define fld_fwmark	nl_u.dn_u.fwmark
+#define fld_scope	nl_u.dn_u.scope
+#define fl6_dst		nl_u.ip6_u.daddr
+#define fl6_src		nl_u.ip6_u.saddr
+#define fl6_flowlabel	nl_u.ip6_u.flowlabel
 #define fl4_dst		nl_u.ip4_u.daddr
 #define fl4_src		nl_u.ip4_u.saddr
 #define fl4_fwmark	nl_u.ip4_u.fwmark
@@ -367,7 +387,6 @@
 
 	__u8	proto;
 	__u8	flags;
-#if 0
 	union {
 		struct {
 			__u16	sport;
@@ -394,11 +413,12 @@
 #define fl_icmp_type	uli_u.icmpt.type
 #define fl_icmp_code	uli_u.icmpt.code
 #define fl_ipsec_spi	uli_u.spi
-#endif
-};
+} __attribute__((__aligned__(BITS_PER_LONG/8)));
 
+#define FLOW_DIR_IN	0
+#define FLOW_DIR_OUT	1
+#define FLOW_DIR_FWD	2
 
-
 /* rtable.h */
 struct rtable
 {
@@ -601,6 +621,9 @@
 int ip_route_output_key(struct rtable **rp, struct flowi *flp);
 #endif
 
+int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl,
+		struct sock *sk, int flags);
+
 int ip_route_input(struct sk_buff *skb, u32 daddr, u32 saddr,
 		   u8 tos, struct net_device *dev);
 

Modified: trunk/nfsim/kernelenv/include/kernelenv.h
===================================================================
--- trunk/nfsim/kernelenv/include/kernelenv.h	2004-12-10 05:22:13 UTC (rev 3313)
+++ trunk/nfsim/kernelenv/include/kernelenv.h	2004-12-10 05:25:22 UTC (rev 3314)
@@ -1100,7 +1100,30 @@
 void *kmem_cache_alloc(kmem_cache_t *, int);
 void kmem_cache_free(kmem_cache_t *, void *);
 
+static inline unsigned long
+__get_free_pages(unsigned int gfp_mask, unsigned int order)
+{
+	return (unsigned long)(kmalloc(PAGE_SIZE << order, gfp_mask));
+}
+static inline void free_pages(unsigned long addr, unsigned int order)
+{
+	memset((void *)addr, 0, PAGE_SIZE << order);
+	kfree((void *)addr);
+}
 
+static inline int get_order(unsigned long size)
+{
+	int order;
+
+	size = (size-1) >> (PAGE_SHIFT-1);
+	order = -1;
+	do {
+		size >>= 1;
+		order++;
+	} while (size);
+	return order;
+}
+
 /* wait.h */
 struct __wait_queue_head {
 	spinlock_t lock;

Modified: trunk/nfsim/netfilter/Makefile.kbuild
===================================================================
--- trunk/nfsim/netfilter/Makefile.kbuild	2004-12-10 05:22:13 UTC (rev 3313)
+++ trunk/nfsim/netfilter/Makefile.kbuild	2004-12-10 05:25:22 UTC (rev 3314)
@@ -9,7 +9,7 @@
 	$(LD) $(LDFLAGS) -r -o $(@) $^
 
 %.o:%.c
-	 $(COMPILE.c) -DKBUILD_MODNAME=$(@:.o=) $(OUTPUT_OPTION) $<
+	$(COMPILE.c) $(GCOVFLAGS) -DKBUILD_MODNAME=$(@:.o=) $(OUTPUT_OPTION) $<
 
 %.o:	
 	@$(MAKE) CFLAGS="$(CFLAGS) -DKBUILD_MODNAME=$(@:.o=)" $($(@:.o=-objs))

Modified: trunk/nfsim/tools/module.c
===================================================================
--- trunk/nfsim/tools/module.c	2004-12-10 05:22:13 UTC (rev 3313)
+++ trunk/nfsim/tools/module.c	2004-12-10 05:25:22 UTC (rev 3314)
@@ -219,7 +219,7 @@
 {
 	struct module *mod;
 
-	list_for_each_entry(mod, &modules, list) {
+	list_for_each_entry_reverse(mod, &modules, list) {
 		if (!mod->state)
 			continue;
 		mod->exit();




More information about the netfilter-cvslog mailing list