SOURCES (LINUX_2_6): linux-2.6-nf-TRACE.patch (NEW) - [extra] TRAC...

cieciwa cieciwa at pld-linux.org
Fri Sep 16 15:11:32 CEST 2005


Author: cieciwa                      Date: Fri Sep 16 13:11:32 2005 GMT
Module: SOURCES                       Tag: LINUX_2_6
---- Log message:
- [extra] TRACE - kernel patch.

---- Files affected:
SOURCES:
   linux-2.6-nf-TRACE.patch (NONE -> 1.1.2.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/linux-2.6-nf-TRACE.patch
diff -u /dev/null SOURCES/linux-2.6-nf-TRACE.patch:1.1.2.1
--- /dev/null	Fri Sep 16 15:11:32 2005
+++ SOURCES/linux-2.6-nf-TRACE.patch	Fri Sep 16 15:11:27 2005
@@ -0,0 +1,199 @@
+ ipv4/netfilter/Kconfig      |   13 ++++++++
+ ipv4/netfilter/Makefile     |    1 
+ ipv4/netfilter/ipt_TRACE.c  |   64 +++++++++++++++++++++++++++++++++++++++++++
+ ipv6/netfilter/Kconfig      |   13 ++++++++
+ ipv6/netfilter/Makefile     |    1 
+ ipv6/netfilter/ip6t_TRACE.c |   65 ++++++++++++++++++++++++++++++++++++++++++++
+ 6 files changed, 157 insertions(+)
+
+diff -Nur --exclude '*.orig' linux-2.6.13.1.org/net/ipv4/netfilter/Kconfig linux-2.6.13.1/net/ipv4/netfilter/Kconfig
+--- linux-2.6.13.1.org/net/ipv4/netfilter/Kconfig	2005-09-10 04:42:58.000000000 +0200
++++ linux-2.6.13.1/net/ipv4/netfilter/Kconfig	2005-09-16 15:03:00.000000000 +0200
+@@ -692,5 +692,18 @@
+ 	  Allows altering the ARP packet payload: source and destination
+ 	  hardware and network addresses.
+ 
++config IP_NF_TARGET_TRACE
++	tristate  'TRACE target support'
++	depends on IP_NF_RAW
++	help
++	  The TRACE target allows packets to be traced as those
++	  matches any subsequent rule in any table/rule. The matched
++	  rule and the packet is logged with the prefix
++	
++	  TRACE: tablename/chainname/rulenum  
++	
++	  If you want to compile it as a module, say M here and read
++	  <file:Documentation/modules.txt>.  If unsure, say `N'.
++
+ endmenu
+ 
+diff -Nur --exclude '*.orig' linux-2.6.13.1.org/net/ipv4/netfilter/Makefile linux-2.6.13.1/net/ipv4/netfilter/Makefile
+--- linux-2.6.13.1.org/net/ipv4/netfilter/Makefile	2005-09-10 04:42:58.000000000 +0200
++++ linux-2.6.13.1/net/ipv4/netfilter/Makefile	2005-09-16 15:03:00.000000000 +0200
+@@ -0,0 +0,1 @@
++obj-$(CONFIG_IP_NF_TARGET_TRACE) += ipt_TRACE.o
+diff -Nur --exclude '*.orig' linux-2.6.13.1.org/net/ipv4/netfilter/ipt_TRACE.c linux-2.6.13.1/net/ipv4/netfilter/ipt_TRACE.c
+--- linux-2.6.13.1.org/net/ipv4/netfilter/ipt_TRACE.c	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.13.1/net/ipv4/netfilter/ipt_TRACE.c	2005-09-16 15:03:00.000000000 +0200
+@@ -0,0 +1,64 @@
++/* This is a module which is used for setting 
++ * the NFC_TRACE flag in the nfcache field of an skb. 
++ */
++#include <linux/module.h>
++#include <linux/skbuff.h>
++
++#include <linux/netfilter_ipv4/ip_tables.h>
++
++static unsigned int
++target(struct sk_buff **pskb,
++       const struct net_device *in,
++       const struct net_device *out,
++       unsigned int hooknum,
++       const void *targinfo,
++       void *userinfo)
++{
++	(*pskb)->nfcache |= NFC_TRACE;
++	return IPT_CONTINUE;
++}
++
++static int
++checkentry(const char *tablename,
++	   const struct ipt_entry *e,
++           void *targinfo,
++           unsigned int targinfosize,
++           unsigned int hook_mask)
++{
++	if (targinfosize != 0) {
++		printk(KERN_WARNING "TRACE: targinfosize %u != 0\n",
++		       targinfosize);
++		return 0;
++	}
++
++	if (strcmp(tablename, "raw") != 0) {
++		printk(KERN_WARNING "TRACE: can only be called from \"raw\" table, not \"%s\"\n", tablename);
++		return 0;
++	}
++
++	return 1;
++}
++
++static struct ipt_target ipt_trace_reg = { 
++	.name = "TRACE", 
++	.target = target, 
++	.checkentry = checkentry, 
++	.me = THIS_MODULE
++};
++
++static int __init init(void)
++{
++	if (ipt_register_target(&ipt_trace_reg))
++		return -EINVAL;
++
++	return 0;
++}
++
++static void __exit fini(void)
++{
++	ipt_unregister_target(&ipt_trace_reg);
++}
++
++module_init(init);
++module_exit(fini);
++MODULE_LICENSE("GPL");
+diff -Nur --exclude '*.orig' linux-2.6.13.1.org/net/ipv6/netfilter/Kconfig linux-2.6.13.1/net/ipv6/netfilter/Kconfig
+--- linux-2.6.13.1.org/net/ipv6/netfilter/Kconfig	2005-09-10 04:42:58.000000000 +0200
++++ linux-2.6.13.1/net/ipv6/netfilter/Kconfig	2005-09-16 15:03:00.000000000 +0200
+@@ -238,5 +238,18 @@
+ 	  If you want to compile it as a module, say M here and read
+ 	  <file:Documentation/modules.txt>.  If unsure, say `N'.
+ 
++config IP6_NF_TARGET_TRACE
++	tristate  'TRACE target support'
++	depends on IP6_NF_RAW
++	help
++	  The TRACE target allows packets to be traced as those
++	  matches any subsequent rule in any table/rule. The matched
++	  rule and the packet is logged with the prefix
++	
++	  TRACE: tablename/chainname/rulenum  
++	
++	  If you want to compile it as a module, say M here and read
++	  <file:Documentation/modules.txt>.  If unsure, say `N'.
++
+ endmenu
+ 
+diff -Nur --exclude '*.orig' linux-2.6.13.1.org/net/ipv6/netfilter/Makefile linux-2.6.13.1/net/ipv6/netfilter/Makefile
+--- linux-2.6.13.1.org/net/ipv6/netfilter/Makefile	2005-09-10 04:42:58.000000000 +0200
++++ linux-2.6.13.1/net/ipv6/netfilter/Makefile	2005-09-16 15:03:00.000000000 +0200
+@@ -0,0 +0,1 @@
++obj-$(CONFIG_IP6_NF_TARGET_TRACE) += ip6t_TRACE.o
+diff -Nur --exclude '*.orig' linux-2.6.13.1.org/net/ipv6/netfilter/ip6t_TRACE.c linux-2.6.13.1/net/ipv6/netfilter/ip6t_TRACE.c
+--- linux-2.6.13.1.org/net/ipv6/netfilter/ip6t_TRACE.c	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.13.1/net/ipv6/netfilter/ip6t_TRACE.c	2005-09-16 15:03:00.000000000 +0200
+@@ -0,0 +1,65 @@
++/* This is a module which is used for setting
++ * the NFC_TRACE flag in the nfcache field of an skb. 
++ */
++#include <linux/module.h>
++#include <linux/skbuff.h>
++
++#include <linux/netfilter_ipv6/ip6_tables.h>
++
++MODULE_LICENSE("GPL");
++
++static unsigned int
++target(struct sk_buff **pskb,
++	unsigned int hooknum,
++	const struct net_device *in,
++	const struct net_device *out,
++	const void *targinfo,
++	void *userinfo)
++{
++	(*pskb)->nfcache |= NFC_TRACE;
++	return IP6T_CONTINUE;
++}
++
++static int 
++checkentry(const char *tablename,
++       	   const struct ip6t_entry *e,
++           void *targinfo,
++           unsigned int targinfosize,
++           unsigned int hook_mask)
++{
++	if (targinfosize != 0) {
++		printk(KERN_WARNING "TRACE: targinfosize %u != 0\n",
++		       targinfosize);
++		return 0;
++	}
++
++	if (strcmp(tablename, "raw") != 0) {
++		printk(KERN_WARNING "TRACE: can only be called from \"raw\" table, not \"%s\"\n", tablename);
++		return 0;
++	}
++
++	return 1;
++}
++
++static struct ip6t_target ip6t_trace_reg = { 
++	.name = "TRACE",
++	.target = target, 
++	.checkentry = checkentry, 
++	.me = THIS_MODULE
++};
++
++static int __init init(void)
++{
++	if (ip6t_register_target(&ip6t_trace_reg))
++		return -EINVAL;
++
++	return 0;
++}
++
++static void __exit fini(void)
++{
++	ip6t_unregister_target(&ip6t_trace_reg);
++}
++
++module_init(init);
++module_exit(fini);
================================================================



More information about the pld-cvs-commit mailing list