diff options
author | David S. Miller <davem@davemloft.net> | 2008-01-13 00:49:01 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:02:01 -0500 |
commit | 88ebc72f68974965b41ad7e8e441df57a530e386 (patch) | |
tree | ea6b62d2de45f8b6f950fcc36eb080a3b9f4e82f /net/ipv4/fib_semantics.c | |
parent | 3f4afb6443aaa1d69b2d8f0461c8191e40d54c3c (diff) |
[IPV4] FIB: Include nexthop device indexes in fib_info hashfn.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/fib_semantics.c')
-rw-r--r-- | net/ipv4/fib_semantics.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 3ed920b92fb6..0e08df4d6f9a 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c | |||
@@ -194,6 +194,15 @@ static __inline__ int nh_comp(const struct fib_info *fi, const struct fib_info * | |||
194 | return 0; | 194 | return 0; |
195 | } | 195 | } |
196 | 196 | ||
197 | static inline unsigned int fib_devindex_hashfn(unsigned int val) | ||
198 | { | ||
199 | unsigned int mask = DEVINDEX_HASHSIZE - 1; | ||
200 | |||
201 | return (val ^ | ||
202 | (val >> DEVINDEX_HASHBITS) ^ | ||
203 | (val >> (DEVINDEX_HASHBITS * 2))) & mask; | ||
204 | } | ||
205 | |||
197 | static inline unsigned int fib_info_hashfn(const struct fib_info *fi) | 206 | static inline unsigned int fib_info_hashfn(const struct fib_info *fi) |
198 | { | 207 | { |
199 | unsigned int mask = (fib_hash_size - 1); | 208 | unsigned int mask = (fib_hash_size - 1); |
@@ -202,6 +211,9 @@ static inline unsigned int fib_info_hashfn(const struct fib_info *fi) | |||
202 | val ^= fi->fib_protocol; | 211 | val ^= fi->fib_protocol; |
203 | val ^= (__force u32)fi->fib_prefsrc; | 212 | val ^= (__force u32)fi->fib_prefsrc; |
204 | val ^= fi->fib_priority; | 213 | val ^= fi->fib_priority; |
214 | for_nexthops(fi) { | ||
215 | val ^= fib_devindex_hashfn(nh->nh_oif); | ||
216 | } endfor_nexthops(fi) | ||
205 | 217 | ||
206 | return (val ^ (val >> 7) ^ (val >> 12)) & mask; | 218 | return (val ^ (val >> 7) ^ (val >> 12)) & mask; |
207 | } | 219 | } |
@@ -232,15 +244,6 @@ static struct fib_info *fib_find_info(const struct fib_info *nfi) | |||
232 | return NULL; | 244 | return NULL; |
233 | } | 245 | } |
234 | 246 | ||
235 | static inline unsigned int fib_devindex_hashfn(unsigned int val) | ||
236 | { | ||
237 | unsigned int mask = DEVINDEX_HASHSIZE - 1; | ||
238 | |||
239 | return (val ^ | ||
240 | (val >> DEVINDEX_HASHBITS) ^ | ||
241 | (val >> (DEVINDEX_HASHBITS * 2))) & mask; | ||
242 | } | ||
243 | |||
244 | /* Check, that the gateway is already configured. | 247 | /* Check, that the gateway is already configured. |
245 | Used only by redirect accept routine. | 248 | Used only by redirect accept routine. |
246 | */ | 249 | */ |