Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 16291
b: refs/heads/master
c: 1f1e030
h: refs/heads/master
i:
  16289: 441c921
  16287: 97a6b7e
v: v3
  • Loading branch information
NeilBrown authored and Linus Torvalds committed Jan 6, 2006
1 parent ed1d1b7 commit 37c0878
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4b2f0260c74324abca76ccaa42d426af163125e7
refs/heads/master: 1f1e030bf75774b6a283518e1534d598e14147d4
14 changes: 13 additions & 1 deletion trunk/net/sunrpc/svcauth_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,22 @@ static void ip_map_put(struct cache_head *item, struct cache_detail *cd)
}
}

#if IP_HASHBITS == 8
/* hash_long on a 64 bit machine is currently REALLY BAD for
* IP addresses in reverse-endian (i.e. on a little-endian machine).
* So use a trivial but reliable hash instead
*/
static inline int hash_ip(unsigned long ip)
{
int hash = ip ^ (ip>>16);
return (hash ^ (hash>>8)) & 0xff;
}
#endif

static inline int ip_map_hash(struct ip_map *item)
{
return hash_str(item->m_class, IP_HASHBITS) ^
hash_long((unsigned long)item->m_addr.s_addr, IP_HASHBITS);
hash_ip((unsigned long)item->m_addr.s_addr);
}
static inline int ip_map_match(struct ip_map *item, struct ip_map *tmp)
{
Expand Down

0 comments on commit 37c0878

Please sign in to comment.