SOURCES (LINUX_2_6): kernel-pom-ng-set.patch - up to 20070921 snap...

zbyniu zbyniu at pld-linux.org
Sat Sep 22 23:42:14 CEST 2007


Author: zbyniu                       Date: Sat Sep 22 21:42:14 2007 GMT
Module: SOURCES                       Tag: LINUX_2_6
---- Log message:
- up to 20070921 snapshot

---- Files affected:
SOURCES:
   kernel-pom-ng-set.patch (1.1.2.8 -> 1.1.2.9) 

---- Diffs:

================================================================
Index: SOURCES/kernel-pom-ng-set.patch
diff -u SOURCES/kernel-pom-ng-set.patch:1.1.2.8 SOURCES/kernel-pom-ng-set.patch:1.1.2.9
--- SOURCES/kernel-pom-ng-set.patch:1.1.2.8	Mon Aug 13 16:31:28 2007
+++ SOURCES/kernel-pom-ng-set.patch	Sat Sep 22 23:42:08 2007
@@ -1,6 +1,6 @@
-diff -Nru linux-2.6.22/include/linux/netfilter_ipv4/ip_set.h linux-2.6.22-pom2patch/include/linux/netfilter_ipv4/ip_set.h
---- linux-2.6.22/include/linux/netfilter_ipv4/ip_set.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.22-pom2patch/include/linux/netfilter_ipv4/ip_set.h	2007-08-07 18:39:55.000000000 +0200
+diff -uNrp linux-2.6./include/linux/netfilter_ipv4/ip_set.h linux-2.6/include/linux/netfilter_ipv4/ip_set.h
+--- linux-2.6./include/linux/netfilter_ipv4/ip_set.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/include/linux/netfilter_ipv4/ip_set.h	2005-10-13 10:53:58.000000000 +0200
 @@ -0,0 +1,498 @@
 +#ifndef _IP_SET_H
 +#define _IP_SET_H
@@ -500,9 +500,9 @@
 +#endif				/* __KERNEL__ */
 +
 +#endif /*_IP_SET_H*/
-diff -Nru linux-2.6.22/include/linux/netfilter_ipv4/ip_set_iphash.h linux-2.6.22-pom2patch/include/linux/netfilter_ipv4/ip_set_iphash.h
---- linux-2.6.22/include/linux/netfilter_ipv4/ip_set_iphash.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.22-pom2patch/include/linux/netfilter_ipv4/ip_set_iphash.h	2007-08-07 18:39:55.000000000 +0200
+diff -uNrp linux-2.6./include/linux/netfilter_ipv4/ip_set_iphash.h linux-2.6/include/linux/netfilter_ipv4/ip_set_iphash.h
+--- linux-2.6./include/linux/netfilter_ipv4/ip_set_iphash.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/include/linux/netfilter_ipv4/ip_set_iphash.h	2006-05-08 11:52:48.000000000 +0200
 @@ -0,0 +1,30 @@
 +#ifndef __IP_SET_IPHASH_H
 +#define __IP_SET_IPHASH_H
@@ -534,9 +534,9 @@
 +};
 +
 +#endif	/* __IP_SET_IPHASH_H */
-diff -Nru linux-2.6.22/include/linux/netfilter_ipv4/ip_set_ipmap.h linux-2.6.22-pom2patch/include/linux/netfilter_ipv4/ip_set_ipmap.h
---- linux-2.6.22/include/linux/netfilter_ipv4/ip_set_ipmap.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.22-pom2patch/include/linux/netfilter_ipv4/ip_set_ipmap.h	2007-08-07 18:39:55.000000000 +0200
+diff -uNrp linux-2.6./include/linux/netfilter_ipv4/ip_set_ipmap.h linux-2.6/include/linux/netfilter_ipv4/ip_set_ipmap.h
+--- linux-2.6./include/linux/netfilter_ipv4/ip_set_ipmap.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/include/linux/netfilter_ipv4/ip_set_ipmap.h	2005-09-30 18:44:08.000000000 +0200
 @@ -0,0 +1,56 @@
 +#ifndef __IP_SET_IPMAP_H
 +#define __IP_SET_IPMAP_H
@@ -594,9 +594,9 @@
 +}
 +	
 +#endif /* __IP_SET_IPMAP_H */
-diff -Nru linux-2.6.22/include/linux/netfilter_ipv4/ip_set_ipporthash.h linux-2.6.22-pom2patch/include/linux/netfilter_ipv4/ip_set_ipporthash.h
---- linux-2.6.22/include/linux/netfilter_ipv4/ip_set_ipporthash.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.22-pom2patch/include/linux/netfilter_ipv4/ip_set_ipporthash.h	2007-08-07 18:39:55.000000000 +0200
+diff -uNrp linux-2.6./include/linux/netfilter_ipv4/ip_set_ipporthash.h linux-2.6/include/linux/netfilter_ipv4/ip_set_ipporthash.h
+--- linux-2.6./include/linux/netfilter_ipv4/ip_set_ipporthash.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/include/linux/netfilter_ipv4/ip_set_ipporthash.h	2006-05-08 11:52:48.000000000 +0200
 @@ -0,0 +1,34 @@
 +#ifndef __IP_SET_IPPORTHASH_H
 +#define __IP_SET_IPPORTHASH_H
@@ -632,9 +632,9 @@
 +};
 +
 +#endif	/* __IP_SET_IPPORTHASH_H */
-diff -Nru linux-2.6.22/include/linux/netfilter_ipv4/ip_set_iptree.h linux-2.6.22-pom2patch/include/linux/netfilter_ipv4/ip_set_iptree.h
---- linux-2.6.22/include/linux/netfilter_ipv4/ip_set_iptree.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.22-pom2patch/include/linux/netfilter_ipv4/ip_set_iptree.h	2007-08-07 18:39:55.000000000 +0200
+diff -uNrp linux-2.6./include/linux/netfilter_ipv4/ip_set_iptree.h linux-2.6/include/linux/netfilter_ipv4/ip_set_iptree.h
+--- linux-2.6./include/linux/netfilter_ipv4/ip_set_iptree.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/include/linux/netfilter_ipv4/ip_set_iptree.h	2006-05-08 11:52:48.000000000 +0200
 @@ -0,0 +1,40 @@
 +#ifndef __IP_SET_IPTREE_H
 +#define __IP_SET_IPTREE_H
@@ -676,9 +676,53 @@
 +};
 +
 +#endif	/* __IP_SET_IPTREE_H */
-diff -Nru linux-2.6.22/include/linux/netfilter_ipv4/ip_set_jhash.h linux-2.6.22-pom2patch/include/linux/netfilter_ipv4/ip_set_jhash.h
---- linux-2.6.22/include/linux/netfilter_ipv4/ip_set_jhash.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.22-pom2patch/include/linux/netfilter_ipv4/ip_set_jhash.h	2007-08-07 18:39:55.000000000 +0200
+diff -uNrp linux-2.6./include/linux/netfilter_ipv4/ip_set_iptreemap.h linux-2.6/include/linux/netfilter_ipv4/ip_set_iptreemap.h
+--- linux-2.6./include/linux/netfilter_ipv4/ip_set_iptreemap.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/include/linux/netfilter_ipv4/ip_set_iptreemap.h	2007-08-28 13:29:12.000000000 +0200
+@@ -0,0 +1,40 @@
++#ifndef __IP_SET_IPTREEMAP_H
++#define __IP_SET_IPTREEMAP_H
++
++#include <linux/netfilter_ipv4/ip_set.h>
++
++#define SETTYPE_NAME "iptreemap"
++
++#ifdef __KERNEL__
++struct ip_set_iptreemap_d {
++	unsigned char bitmap[32]; /* x.x.x.y */
++};
++
++struct ip_set_iptreemap_c {
++	struct ip_set_iptreemap_d *tree[256]; /* x.x.y.x */
++};
++
++struct ip_set_iptreemap_b {
++	struct ip_set_iptreemap_c *tree[256]; /* x.y.x.x */
++	unsigned char dirty[32];
++};
++#endif
++
++struct ip_set_iptreemap {
++	unsigned int gc_interval;
++#ifdef __KERNEL__
++	struct timer_list gc;
++	struct ip_set_iptreemap_b *tree[256]; /* y.x.x.x */
++#endif
++};
++
++struct ip_set_req_iptreemap_create {
++	unsigned int gc_interval;
++};
++
++struct ip_set_req_iptreemap {
++	ip_set_ip_t start;
++	ip_set_ip_t end;
++};
++
++#endif /* __IP_SET_IPTREEMAP_H */
+diff -uNrp linux-2.6./include/linux/netfilter_ipv4/ip_set_jhash.h linux-2.6/include/linux/netfilter_ipv4/ip_set_jhash.h
+--- linux-2.6./include/linux/netfilter_ipv4/ip_set_jhash.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/include/linux/netfilter_ipv4/ip_set_jhash.h	2004-12-01 10:49:36.000000000 +0100
 @@ -0,0 +1,148 @@
 +#ifndef _LINUX_IPSET_JHASH_H
 +#define _LINUX_IPSET_JHASH_H
@@ -828,9 +872,9 @@
 +}
 +
 +#endif /* _LINUX_IPSET_JHASH_H */
-diff -Nru linux-2.6.22/include/linux/netfilter_ipv4/ip_set_macipmap.h linux-2.6.22-pom2patch/include/linux/netfilter_ipv4/ip_set_macipmap.h
---- linux-2.6.22/include/linux/netfilter_ipv4/ip_set_macipmap.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.22-pom2patch/include/linux/netfilter_ipv4/ip_set_macipmap.h	2007-08-07 18:39:55.000000000 +0200
+diff -uNrp linux-2.6./include/linux/netfilter_ipv4/ip_set_macipmap.h linux-2.6/include/linux/netfilter_ipv4/ip_set_macipmap.h
+--- linux-2.6./include/linux/netfilter_ipv4/ip_set_macipmap.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/include/linux/netfilter_ipv4/ip_set_macipmap.h	2004-12-01 10:49:36.000000000 +0100
 @@ -0,0 +1,38 @@
 +#ifndef __IP_SET_MACIPMAP_H
 +#define __IP_SET_MACIPMAP_H
@@ -870,9 +914,9 @@
 +};
 +
 +#endif	/* __IP_SET_MACIPMAP_H */
-diff -Nru linux-2.6.22/include/linux/netfilter_ipv4/ip_set_malloc.h linux-2.6.22-pom2patch/include/linux/netfilter_ipv4/ip_set_malloc.h
---- linux-2.6.22/include/linux/netfilter_ipv4/ip_set_malloc.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.22-pom2patch/include/linux/netfilter_ipv4/ip_set_malloc.h	2007-08-07 18:39:55.000000000 +0200
+diff -uNrp linux-2.6./include/linux/netfilter_ipv4/ip_set_malloc.h linux-2.6/include/linux/netfilter_ipv4/ip_set_malloc.h
+--- linux-2.6./include/linux/netfilter_ipv4/ip_set_malloc.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/include/linux/netfilter_ipv4/ip_set_malloc.h	2005-10-13 10:53:58.000000000 +0200
 @@ -0,0 +1,116 @@
 +#ifndef _IP_SET_MALLOC_H
 +#define _IP_SET_MALLOC_H
@@ -990,9 +1034,9 @@
 +#endif				/* __KERNEL__ */
 +
 +#endif /*_IP_SET_MALLOC_H*/
-diff -Nru linux-2.6.22/include/linux/netfilter_ipv4/ip_set_nethash.h linux-2.6.22-pom2patch/include/linux/netfilter_ipv4/ip_set_nethash.h
---- linux-2.6.22/include/linux/netfilter_ipv4/ip_set_nethash.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.22-pom2patch/include/linux/netfilter_ipv4/ip_set_nethash.h	2007-08-07 18:39:55.000000000 +0200
+diff -uNrp linux-2.6./include/linux/netfilter_ipv4/ip_set_nethash.h linux-2.6/include/linux/netfilter_ipv4/ip_set_nethash.h
+--- linux-2.6./include/linux/netfilter_ipv4/ip_set_nethash.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/include/linux/netfilter_ipv4/ip_set_nethash.h	2006-05-08 11:52:48.000000000 +0200
 @@ -0,0 +1,55 @@
 +#ifndef __IP_SET_NETHASH_H
 +#define __IP_SET_NETHASH_H
@@ -1049,9 +1093,9 @@
 +}
 +
 +#endif	/* __IP_SET_NETHASH_H */
-diff -Nru linux-2.6.22/include/linux/netfilter_ipv4/ip_set_portmap.h linux-2.6.22-pom2patch/include/linux/netfilter_ipv4/ip_set_portmap.h
---- linux-2.6.22/include/linux/netfilter_ipv4/ip_set_portmap.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.22-pom2patch/include/linux/netfilter_ipv4/ip_set_portmap.h	2007-08-07 18:39:55.000000000 +0200
+diff -uNrp linux-2.6./include/linux/netfilter_ipv4/ip_set_portmap.h linux-2.6/include/linux/netfilter_ipv4/ip_set_portmap.h
+--- linux-2.6./include/linux/netfilter_ipv4/ip_set_portmap.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/include/linux/netfilter_ipv4/ip_set_portmap.h	2004-12-01 10:49:36.000000000 +0100
 @@ -0,0 +1,25 @@
 +#ifndef __IP_SET_PORTMAP_H
 +#define __IP_SET_PORTMAP_H
@@ -1078,9 +1122,9 @@
 +};
 +
 +#endif /* __IP_SET_PORTMAP_H */
-diff -Nru linux-2.6.22/include/linux/netfilter_ipv4/ipt_set.h linux-2.6.22-pom2patch/include/linux/netfilter_ipv4/ipt_set.h
---- linux-2.6.22/include/linux/netfilter_ipv4/ipt_set.h	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.22-pom2patch/include/linux/netfilter_ipv4/ipt_set.h	2007-08-07 18:39:55.000000000 +0200
+diff -uNrp linux-2.6./include/linux/netfilter_ipv4/ipt_set.h linux-2.6/include/linux/netfilter_ipv4/ipt_set.h
+--- linux-2.6./include/linux/netfilter_ipv4/ipt_set.h	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/include/linux/netfilter_ipv4/ipt_set.h	2004-12-06 10:32:59.000000000 +0100
 @@ -0,0 +1,21 @@
 +#ifndef _IPT_SET_H
 +#define _IPT_SET_H
@@ -1103,9 +1147,9 @@
 +};
 +
 +#endif /*_IPT_SET_H*/
-diff -Nru linux-2.6.22/net/ipv4/netfilter/ip_set.c linux-2.6.22-pom2patch/net/ipv4/netfilter/ip_set.c
---- linux-2.6.22/net/ipv4/netfilter/ip_set.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.22-pom2patch/net/ipv4/netfilter/ip_set.c	2007-08-07 18:39:55.000000000 +0200
+diff -uNrp linux-2.6./net/ipv4/netfilter/ip_set.c linux-2.6/net/ipv4/netfilter/ip_set.c
+--- linux-2.6./net/ipv4/netfilter/ip_set.c	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/net/ipv4/netfilter/ip_set.c	2007-08-28 13:29:12.000000000 +0200
 @@ -0,0 +1,2001 @@
 +/* Copyright (C) 2000-2002 Joakim Axelsson <gozem at linux.nu>
 + *                         Patrick Schaaf <bof at bof.de>
@@ -1128,7 +1172,7 @@
 +#include <linux/ip.h>
 +#include <linux/skbuff.h>
 +#include <linux/random.h>
-+#include <linux/netfilter_ipv4/ip_set_jhash.h>
++#include <linux/jhash.h>
 +#include <linux/netfilter_ipv4/ip_tables.h>
 +#include <linux/errno.h>
 +#include <asm/uaccess.h>
@@ -3049,7 +3093,7 @@
 +MODULE_AUTHOR("Jozsef Kadlecsik <kadlec at blackhole.kfki.hu>");
 +MODULE_DESCRIPTION("module implementing core IP set support");
 +
-+static int __init init(void)
++static int __init ip_set_init(void)
 +{
 +	int res;
 +	ip_set_id_t i;
@@ -3086,7 +3130,7 @@
 +	return 0;
 +}
 +
-+static void __exit fini(void)
++static void __exit ip_set_fini(void)
 +{
 +	/* There can't be any existing set or binding */
 +	nf_unregister_sockopt(&so_set);
@@ -3106,12 +3150,12 @@
 +EXPORT_SYMBOL(ip_set_delip_kernel);
 +EXPORT_SYMBOL(ip_set_testip_kernel);
 +
-+module_init(init);
-+module_exit(fini);
-diff -Nru linux-2.6.22/net/ipv4/netfilter/ip_set_iphash.c linux-2.6.22-pom2patch/net/ipv4/netfilter/ip_set_iphash.c
---- linux-2.6.22/net/ipv4/netfilter/ip_set_iphash.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.22-pom2patch/net/ipv4/netfilter/ip_set_iphash.c	2007-08-07 18:39:55.000000000 +0200
-@@ -0,0 +1,413 @@
++module_init(ip_set_init);
++module_exit(ip_set_fini);
+diff -uNrp linux-2.6./net/ipv4/netfilter/ip_set_iphash.c linux-2.6/net/ipv4/netfilter/ip_set_iphash.c
+--- linux-2.6./net/ipv4/netfilter/ip_set_iphash.c	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/net/ipv4/netfilter/ip_set_iphash.c	2007-08-28 13:29:12.000000000 +0200
+@@ -0,0 +1,429 @@
 +/* Copyright (C) 2003-2004 Jozsef Kadlecsik <kadlec at blackhole.kfki.hu>
 + *
 + * This program is free software; you can redistribute it and/or modify
@@ -3124,6 +3168,8 @@
 +#include <linux/module.h>
 +#include <linux/ip.h>
 +#include <linux/skbuff.h>
++#include <linux/version.h>
++#include <linux/jhash.h>
 +#include <linux/netfilter_ipv4/ip_tables.h>
 +#include <linux/netfilter_ipv4/ip_set.h>
 +#include <linux/errno.h>
@@ -3137,7 +3183,6 @@
 +
 +#include <linux/netfilter_ipv4/ip_set_malloc.h>
 +#include <linux/netfilter_ipv4/ip_set_iphash.h>
-+#include <linux/netfilter_ipv4/ip_set_jhash.h>
 +
 +static int limit = MAX_RANGE;
 +
@@ -3202,8 +3247,13 @@
 +{
 +	return __testip(set,
 +			ntohl(flags[index] & IPSET_SRC 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
 +				? ip_hdr(skb)->saddr 
 +				: ip_hdr(skb)->daddr),
++#else
++				? skb->nh.iph->saddr 
++				: skb->nh.iph->daddr),
++#endif
 +			hash_ip);
 +}
 +
@@ -3214,7 +3264,7 @@
 +	u_int16_t i;
 +	ip_set_ip_t *elem;
 +	
-+	if (!ip || map->elements > limit)
++	if (!ip || map->elements >= limit)
 +		return -ERANGE;
 +
 +	*hash_ip = ip & map->netmask;
@@ -3259,8 +3309,13 @@
 +{
 +	return __addip((struct ip_set_iphash *) set->data,
 +		       ntohl(flags[index] & IPSET_SRC 
-+		       		? ip_hdr(skb)->saddr 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
++				? ip_hdr(skb)->saddr 
 +				: ip_hdr(skb)->daddr),
++#else
++		       		? skb->nh.iph->saddr 
++				: skb->nh.iph->daddr),
++#endif
 +		       hash_ip);
 +}
 +
@@ -3382,8 +3437,13 @@
 +{
 +	return __delip(set,
 +		       ntohl(flags[index] & IPSET_SRC 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
 +				? ip_hdr(skb)->saddr 
 +				: ip_hdr(skb)->daddr),
++#else
++				? skb->nh.iph->saddr 
++				: skb->nh.iph->daddr),
++#endif
 +		       hash_ip);
 +}
 +
@@ -3512,23 +3572,23 @@
 +module_param(limit, int, 0600);
 +MODULE_PARM_DESC(limit, "maximal number of elements stored in the sets");
 +
-+static int __init init(void)
++static int __init ip_set_iphash_init(void)
 +{
 +	return ip_set_register_set_type(&ip_set_iphash);
 +}
 +
-+static void __exit fini(void)
++static void __exit ip_set_iphash_fini(void)
 +{
 +	/* FIXME: possible race with ip_set_create() */
 +	ip_set_unregister_set_type(&ip_set_iphash);
 +}
 +
-+module_init(init);
-+module_exit(fini);
-diff -Nru linux-2.6.22/net/ipv4/netfilter/ip_set_ipmap.c linux-2.6.22-pom2patch/net/ipv4/netfilter/ip_set_ipmap.c
---- linux-2.6.22/net/ipv4/netfilter/ip_set_ipmap.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.22-pom2patch/net/ipv4/netfilter/ip_set_ipmap.c	2007-08-07 18:39:55.000000000 +0200
-@@ -0,0 +1,327 @@
++module_init(ip_set_iphash_init);
++module_exit(ip_set_iphash_fini);
+diff -uNrp linux-2.6./net/ipv4/netfilter/ip_set_ipmap.c linux-2.6/net/ipv4/netfilter/ip_set_ipmap.c
+--- linux-2.6./net/ipv4/netfilter/ip_set_ipmap.c	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/net/ipv4/netfilter/ip_set_ipmap.c	2007-08-28 13:29:12.000000000 +0200
+@@ -0,0 +1,336 @@
 +/* Copyright (C) 2000-2002 Joakim Axelsson <gozem at linux.nu>
 + *                         Patrick Schaaf <bof at bof.de>
 + * Copyright (C) 2003-2004 Jozsef Kadlecsik <kadlec at blackhole.kfki.hu>
@@ -3543,6 +3603,7 @@
 +#include <linux/module.h>
 +#include <linux/ip.h>
 +#include <linux/skbuff.h>
++#include <linux/version.h>
 +#include <linux/netfilter_ipv4/ip_tables.h>
 +#include <linux/netfilter_ipv4/ip_set.h>
 +#include <linux/errno.h>
@@ -3595,17 +3656,15 @@
 +	      const u_int32_t *flags,
 +	      unsigned char index)
 +{
-+	int res;
-+	
-+	DP("flag: %s src: %u.%u.%u.%u dst: %u.%u.%u.%u",
-+	   flags[index] & IPSET_SRC ? "SRC" : "DST",
-+	   NIPQUAD(ip_hdr(skb)->saddr),
-+	   NIPQUAD(ip_hdr(skb)->daddr));
-+
-+	res =  __testip(set,
-+			ntohl(flags[index] & IPSET_SRC 
++	int res =  __testip(set,
++			ntohl(flags[index] & IPSET_SRC
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
 +				? ip_hdr(skb)->saddr 
 +				: ip_hdr(skb)->daddr),
++#else
++				? skb->nh.iph->saddr 
++				: skb->nh.iph->daddr),
++#endif
 +			hash_ip);
 +	return (res < 0 ? 0 : res);
 +}
@@ -3652,8 +3711,13 @@
 +{
 +	return __addip(set,
 +		       ntohl(flags[index] & IPSET_SRC 
-+		       		? ip_hdr(skb)->saddr 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
++				? ip_hdr(skb)->saddr 
 +				: ip_hdr(skb)->daddr),
++#else
++		       		? skb->nh.iph->saddr 
++				: skb->nh.iph->daddr),
++#endif
 +		       hash_ip);
 +}
 +
@@ -3698,8 +3762,13 @@
 +{
 +	return __delip(set,
 +		       ntohl(flags[index] & IPSET_SRC 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
 +				? ip_hdr(skb)->saddr 
 +				: ip_hdr(skb)->daddr),
++#else
++				? skb->nh.iph->saddr 
++				: skb->nh.iph->daddr),
++#endif
 +		       hash_ip);
 +}
 +
@@ -3843,23 +3912,23 @@
 +MODULE_AUTHOR("Jozsef Kadlecsik <kadlec at blackhole.kfki.hu>");
 +MODULE_DESCRIPTION("ipmap type of IP sets");
 +
-+static int __init init(void)
++static int __init ip_set_ipmap_init(void)
 +{
 +	return ip_set_register_set_type(&ip_set_ipmap);
 +}
 +
-+static void __exit fini(void)
++static void __exit ip_set_ipmap_fini(void)
 +{
 +	/* FIXME: possible race with ip_set_create() */
 +	ip_set_unregister_set_type(&ip_set_ipmap);
 +}
 +
-+module_init(init);
-+module_exit(fini);
-diff -Nru linux-2.6.22/net/ipv4/netfilter/ip_set_ipporthash.c linux-2.6.22-pom2patch/net/ipv4/netfilter/ip_set_ipporthash.c
---- linux-2.6.22/net/ipv4/netfilter/ip_set_ipporthash.c	1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.22-pom2patch/net/ipv4/netfilter/ip_set_ipporthash.c	2007-08-07 18:39:55.000000000 +0200
-@@ -0,0 +1,535 @@
++module_init(ip_set_ipmap_init);
++module_exit(ip_set_ipmap_fini);
+diff -uNrp linux-2.6./net/ipv4/netfilter/ip_set_ipporthash.c linux-2.6/net/ipv4/netfilter/ip_set_ipporthash.c
+--- linux-2.6./net/ipv4/netfilter/ip_set_ipporthash.c	1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6/net/ipv4/netfilter/ip_set_ipporthash.c	2007-09-05 13:41:12.000000000 +0200
+@@ -0,0 +1,581 @@
 +/* Copyright (C) 2003-2004 Jozsef Kadlecsik <kadlec at blackhole.kfki.hu>
 + *
 + * This program is free software; you can redistribute it and/or modify
@@ -3874,6 +3943,8 @@
 +#include <linux/tcp.h>
 +#include <linux/udp.h>
 +#include <linux/skbuff.h>
++#include <linux/version.h>
++#include <linux/jhash.h>
 +#include <linux/netfilter_ipv4/ip_tables.h>
 +#include <linux/netfilter_ipv4/ip_set.h>
 +#include <linux/errno.h>
@@ -3887,7 +3958,6 @@
 +
 +#include <linux/netfilter_ipv4/ip_set_malloc.h>
 +#include <linux/netfilter_ipv4/ip_set_ipporthash.h>
-+#include <linux/netfilter_ipv4/ip_set_jhash.h>
 +
 +static int limit = MAX_RANGE;
 +
@@ -3895,7 +3965,11 @@
 +static inline ip_set_ip_t
 +get_port(const struct sk_buff *skb, u_int32_t flags)
 +{
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
 +	struct iphdr *iph = ip_hdr(skb);
++#else
++	struct iphdr *iph = skb->nh.iph;
++#endif
 +	u_int16_t offset = ntohs(iph->frag_off) & IP_OFFSET;
 +
 +	switch (iph->protocol) {
@@ -3906,7 +3980,11 @@
 +		if (offset)
 +			return INVALID_PORT;
 +
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
 +		if (skb_copy_bits(skb, ip_hdr(skb)->ihl*4, &tcph, sizeof(tcph)) < 0)
++#else
++		if (skb_copy_bits(skb, skb->nh.iph->ihl*4, &tcph, sizeof(tcph)) < 0)
++#endif
 +			/* No choice either */
 +			return INVALID_PORT;
 +	     	
@@ -3919,7 +3997,11 @@
 +		if (offset)
 +			return INVALID_PORT;
 +
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
 +		if (skb_copy_bits(skb, ip_hdr(skb)->ihl*4, &udph, sizeof(udph)) < 0)
++#else
++		if (skb_copy_bits(skb, skb->nh.iph->ihl*4, &udph, sizeof(udph)) < 0)
++#endif
 +			/* No choice either */
 +			return INVALID_PORT;
 +	     	
@@ -4001,28 +4083,41 @@
 +	      unsigned char index)
 +{
 +	ip_set_ip_t port;
++	int res;
 +
 +	if (flags[index+1] == 0)
-+		return -EINVAL;
++		return 0;
 +		
 +	port = get_port(skb, flags[index+1]);
 +
 +	DP("flag: %s src: %u.%u.%u.%u dst: %u.%u.%u.%u",
 +	   flags[index] & IPSET_SRC ? "SRC" : "DST",
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
 +	   NIPQUAD(ip_hdr(skb)->saddr),
 +	   NIPQUAD(ip_hdr(skb)->daddr));
++#else
++	   NIPQUAD(skb->nh.iph->saddr),
++	   NIPQUAD(skb->nh.iph->daddr));
++#endif
 +	DP("flag %s port %u",
 +	   flags[index+1] & IPSET_SRC ? "SRC" : "DST", 
 +	   port);	
 +	if (port == INVALID_PORT)
 +		return 0;	
 +
-+	return __testip(set,
++	res =  __testip(set,
 +			ntohl(flags[index] & IPSET_SRC 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
 +					? ip_hdr(skb)->saddr 
 +					: ip_hdr(skb)->daddr),
++#else
++					? skb->nh.iph->saddr 
++					: skb->nh.iph->daddr),
++#endif
 +			port,
 +			hash_ip);
++	return (res < 0 ? 0 : res);
++	
 +}
 +
 +static inline int
@@ -4094,8 +4189,13 @@
 +
 +	DP("flag: %s src: %u.%u.%u.%u dst: %u.%u.%u.%u",
 +	   flags[index] & IPSET_SRC ? "SRC" : "DST",
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
 +	   NIPQUAD(ip_hdr(skb)->saddr),
 +	   NIPQUAD(ip_hdr(skb)->daddr));
++#else
++	   NIPQUAD(skb->nh.iph->saddr),
++	   NIPQUAD(skb->nh.iph->daddr));
++#endif
 +	DP("flag %s port %u", 
 +	   flags[index+1] & IPSET_SRC ? "SRC" : "DST", 
 +	   port);	
@@ -4104,8 +4204,13 @@
 +
 +	return __addip((struct ip_set_ipporthash *) set->data,
 +		       ntohl(flags[index] & IPSET_SRC 
-+		       		? ip_hdr(skb)->saddr 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
++				? ip_hdr(skb)->saddr 
 +				: ip_hdr(skb)->daddr),
++#else
++		       		? skb->nh.iph->saddr 
++				: skb->nh.iph->daddr),
++#endif
 +		       port,
 +		       hash_ip);
 +}
@@ -4239,8 +4344,13 @@
 +
 +	DP("flag: %s src: %u.%u.%u.%u dst: %u.%u.%u.%u",
 +	   flags[index] & IPSET_SRC ? "SRC" : "DST",
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
 +	   NIPQUAD(ip_hdr(skb)->saddr),
 +	   NIPQUAD(ip_hdr(skb)->daddr));
++#else
++	   NIPQUAD(skb->nh.iph->saddr),
++	   NIPQUAD(skb->nh.iph->daddr));
++#endif
 +	DP("flag %s port %u",
 +	   flags[index+1] & IPSET_SRC ? "SRC" : "DST", 
 +	   port);	
@@ -4249,8 +4359,13 @@
 +
 +	return __delip(set,
 +		       ntohl(flags[index] & IPSET_SRC 
-+		       		? ip_hdr(skb)->saddr 
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
++				? ip_hdr(skb)->saddr 
 +				: ip_hdr(skb)->daddr),
++#else
++		       		? skb->nh.iph->saddr 
++				: skb->nh.iph->daddr),
++#endif
 +		       port,
 +		       hash_ip);
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/kernel-pom-ng-set.patch?r1=1.1.2.8&r2=1.1.2.9&f=u



More information about the pld-cvs-commit mailing list