1 diff -ruN ipset-2.2.9a.orig/ipset_iphash.c ipset-2.2.9a/ipset_iphash.c
2 --- ipset-2.2.9a.orig/ipset_iphash.c 2006-10-06 03:41:17.000000000 -0500
3 +++ ipset-2.2.9a/ipset_iphash.c 2007-07-11 10:10:54.349001865 -0500
7 #include <linux/netfilter_ipv4/ip_set_iphash.h>
8 -#include <linux/netfilter_ipv4/ip_set_jhash.h>
9 +#include "ip_set_jhash.h"
13 diff -ruN ipset-2.2.9a.orig/ipset_ipporthash.c ipset-2.2.9a/ipset_ipporthash.c
14 --- ipset-2.2.9a.orig/ipset_ipporthash.c 2006-10-06 03:41:26.000000000 -0500
15 +++ ipset-2.2.9a/ipset_ipporthash.c 2007-07-11 10:10:54.345001638 -0500
17 #include <asm/types.h>
19 #include <linux/netfilter_ipv4/ip_set_ipporthash.h>
20 -#include <linux/netfilter_ipv4/ip_set_jhash.h>
21 +#include "ip_set_jhash.h"
25 diff -ruN ipset-2.2.9a.orig/ip_set_jhash.h ipset-2.2.9a/ip_set_jhash.h
26 --- ipset-2.2.9a.orig/ip_set_jhash.h 1969-12-31 18:00:00.000000000 -0600
27 +++ ipset-2.2.9a/ip_set_jhash.h 2007-07-11 10:10:33.711825818 -0500
29 +#ifndef _LINUX_IPSET_JHASH_H
30 +#define _LINUX_IPSET_JHASH_H
32 +/* This is a copy of linux/jhash.h but the types u32/u8 are changed
33 + * to __u32/__u8 so that the header file can be included into
34 + * userspace code as well. Jozsef Kadlecsik (kadlec@blackhole.kfki.hu)
37 +/* jhash.h: Jenkins hash support.
39 + * Copyright (C) 1996 Bob Jenkins (bob_jenkins@burtleburtle.net)
41 + * http://burtleburtle.net/bob/hash/
43 + * These are the credits from Bob's sources:
45 + * lookup2.c, by Bob Jenkins, December 1996, Public Domain.
46 + * hash(), hash2(), hash3, and mix() are externally useful functions.
47 + * Routines to test the hash are included if SELF_TEST is defined.
48 + * You can use this free for any purpose. It has no warranty.
50 + * Copyright (C) 2003 David S. Miller (davem@redhat.com)
52 + * I've modified Bob's hash to be useful in the Linux kernel, and
53 + * any bugs present are surely my fault. -DaveM
56 +/* NOTE: Arguments are modified. */
57 +#define __jhash_mix(a, b, c) \
59 + a -= b; a -= c; a ^= (c>>13); \
60 + b -= c; b -= a; b ^= (a<<8); \
61 + c -= a; c -= b; c ^= (b>>13); \
62 + a -= b; a -= c; a ^= (c>>12); \
63 + b -= c; b -= a; b ^= (a<<16); \
64 + c -= a; c -= b; c ^= (b>>5); \
65 + a -= b; a -= c; a ^= (c>>3); \
66 + b -= c; b -= a; b ^= (a<<10); \
67 + c -= a; c -= b; c ^= (b>>15); \
70 +/* The golden ration: an arbitrary value */
71 +#define JHASH_GOLDEN_RATIO 0x9e3779b9
73 +/* The most generic version, hashes an arbitrary sequence
74 + * of bytes. No alignment or length assumptions are made about
77 +static inline __u32 jhash(void *key, __u32 length, __u32 initval)
83 + a = b = JHASH_GOLDEN_RATIO;
87 + a += (k[0] +((__u32)k[1]<<8) +((__u32)k[2]<<16) +((__u32)k[3]<<24));
88 + b += (k[4] +((__u32)k[5]<<8) +((__u32)k[6]<<16) +((__u32)k[7]<<24));
89 + c += (k[8] +((__u32)k[9]<<8) +((__u32)k[10]<<16)+((__u32)k[11]<<24));
99 + case 11: c += ((__u32)k[10]<<24);
100 + case 10: c += ((__u32)k[9]<<16);
101 + case 9 : c += ((__u32)k[8]<<8);
102 + case 8 : b += ((__u32)k[7]<<24);
103 + case 7 : b += ((__u32)k[6]<<16);
104 + case 6 : b += ((__u32)k[5]<<8);
105 + case 5 : b += k[4];
106 + case 4 : a += ((__u32)k[3]<<24);
107 + case 3 : a += ((__u32)k[2]<<16);
108 + case 2 : a += ((__u32)k[1]<<8);
109 + case 1 : a += k[0];
112 + __jhash_mix(a,b,c);
117 +/* A special optimized version that handles 1 or more of __u32s.
118 + * The length parameter here is the number of __u32s in the key.
120 +static inline __u32 jhash2(__u32 *k, __u32 length, __u32 initval)
122 + __u32 a, b, c, len;
124 + a = b = JHASH_GOLDEN_RATIO;
132 + __jhash_mix(a, b, c);
139 + case 2 : b += k[1];
140 + case 1 : a += k[0];
143 + __jhash_mix(a,b,c);
149 +/* A special ultra-optimized versions that knows they are hashing exactly
150 + * 3, 2 or 1 word(s).
152 + * NOTE: In partilar the "c += length; __jhash_mix(a,b,c);" normally
153 + * done at the end is not done here.
155 +static inline __u32 jhash_3words(__u32 a, __u32 b, __u32 c, __u32 initval)
157 + a += JHASH_GOLDEN_RATIO;
158 + b += JHASH_GOLDEN_RATIO;
161 + __jhash_mix(a, b, c);
166 +static inline __u32 jhash_2words(__u32 a, __u32 b, __u32 initval)
168 + return jhash_3words(a, b, 0, initval);
171 +static inline __u32 jhash_1word(__u32 a, __u32 initval)
173 + return jhash_3words(a, 0, 0, initval);
176 +#endif /* _LINUX_IPSET_JHASH_H */
177 diff -ruN ipset-2.2.9a.orig/ipset_nethash.c ipset-2.2.9a/ipset_nethash.c
178 --- ipset-2.2.9a.orig/ipset_nethash.c 2006-10-06 03:41:46.000000000 -0500
179 +++ ipset-2.2.9a/ipset_nethash.c 2007-07-11 10:10:54.369003006 -0500
181 #include <asm/types.h>
183 #include <linux/netfilter_ipv4/ip_set_nethash.h>
184 -#include <linux/netfilter_ipv4/ip_set_jhash.h>
185 +#include "ip_set_jhash.h"