rt2x00 fixes (thanks to sn9):
[openwrt.git] / package / ipset / patches / 000-ipset_2.6.22.patch
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
4 @@ -28,7 +28,7 @@
5 #include <asm/types.h>
6
7 #include <linux/netfilter_ipv4/ip_set_iphash.h>
8 -#include <linux/netfilter_ipv4/ip_set_jhash.h>
9 +#include "ip_set_jhash.h"
10
11 #include "ipset.h"
12
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
16 @@ -28,7 +28,7 @@
17 #include <asm/types.h>
18
19 #include <linux/netfilter_ipv4/ip_set_ipporthash.h>
20 -#include <linux/netfilter_ipv4/ip_set_jhash.h>
21 +#include "ip_set_jhash.h"
22
23 #include "ipset.h"
24
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
28 @@ -0,0 +1,148 @@
29 +#ifndef _LINUX_IPSET_JHASH_H
30 +#define _LINUX_IPSET_JHASH_H
31 +
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)
35 + */
36 +
37 +/* jhash.h: Jenkins hash support.
38 + *
39 + * Copyright (C) 1996 Bob Jenkins (bob_jenkins@burtleburtle.net)
40 + *
41 + * http://burtleburtle.net/bob/hash/
42 + *
43 + * These are the credits from Bob's sources:
44 + *
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.
49 + *
50 + * Copyright (C) 2003 David S. Miller (davem@redhat.com)
51 + *
52 + * I've modified Bob's hash to be useful in the Linux kernel, and
53 + * any bugs present are surely my fault. -DaveM
54 + */
55 +
56 +/* NOTE: Arguments are modified. */
57 +#define __jhash_mix(a, b, c) \
58 +{ \
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); \
68 +}
69 +
70 +/* The golden ration: an arbitrary value */
71 +#define JHASH_GOLDEN_RATIO 0x9e3779b9
72 +
73 +/* The most generic version, hashes an arbitrary sequence
74 + * of bytes. No alignment or length assumptions are made about
75 + * the input key.
76 + */
77 +static inline __u32 jhash(void *key, __u32 length, __u32 initval)
78 +{
79 + __u32 a, b, c, len;
80 + __u8 *k = key;
81 +
82 + len = length;
83 + a = b = JHASH_GOLDEN_RATIO;
84 + c = initval;
85 +
86 + while (len >= 12) {
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));
90 +
91 + __jhash_mix(a,b,c);
92 +
93 + k += 12;
94 + len -= 12;
95 + }
96 +
97 + c += length;
98 + switch (len) {
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];
110 + };
111 +
112 + __jhash_mix(a,b,c);
113 +
114 + return c;
115 +}
116 +
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.
119 + */
120 +static inline __u32 jhash2(__u32 *k, __u32 length, __u32 initval)
121 +{
122 + __u32 a, b, c, len;
123 +
124 + a = b = JHASH_GOLDEN_RATIO;
125 + c = initval;
126 + len = length;
127 +
128 + while (len >= 3) {
129 + a += k[0];
130 + b += k[1];
131 + c += k[2];
132 + __jhash_mix(a, b, c);
133 + k += 3; len -= 3;
134 + }
135 +
136 + c += length * 4;
137 +
138 + switch (len) {
139 + case 2 : b += k[1];
140 + case 1 : a += k[0];
141 + };
142 +
143 + __jhash_mix(a,b,c);
144 +
145 + return c;
146 +}
147 +
148 +
149 +/* A special ultra-optimized versions that knows they are hashing exactly
150 + * 3, 2 or 1 word(s).
151 + *
152 + * NOTE: In partilar the "c += length; __jhash_mix(a,b,c);" normally
153 + * done at the end is not done here.
154 + */
155 +static inline __u32 jhash_3words(__u32 a, __u32 b, __u32 c, __u32 initval)
156 +{
157 + a += JHASH_GOLDEN_RATIO;
158 + b += JHASH_GOLDEN_RATIO;
159 + c += initval;
160 +
161 + __jhash_mix(a, b, c);
162 +
163 + return c;
164 +}
165 +
166 +static inline __u32 jhash_2words(__u32 a, __u32 b, __u32 initval)
167 +{
168 + return jhash_3words(a, b, 0, initval);
169 +}
170 +
171 +static inline __u32 jhash_1word(__u32 a, __u32 initval)
172 +{
173 + return jhash_3words(a, 0, 0, initval);
174 +}
175 +
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
180 @@ -28,7 +28,7 @@
181 #include <asm/types.h>
182
183 #include <linux/netfilter_ipv4/ip_set_nethash.h>
184 -#include <linux/netfilter_ipv4/ip_set_jhash.h>
185 +#include "ip_set_jhash.h"
186
187 #include "ipset.h"
188
This page took 0.057196 seconds and 5 git commands to generate.