diff options
author | Masahide NAKAMURA <nakam@linux-ipv6.org> | 2006-10-03 18:56:09 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-10-04 03:31:02 -0400 |
commit | 667bbcb6c099d1b74f95c6963ddf37a32e7afc29 (patch) | |
tree | a4deb7718b21098bb9fbdeacfd55b78a1eb32bb4 /net/xfrm/xfrm_hash.h | |
parent | c5e29460f5f9eb189cab5d9fdaa137e64f7734b6 (diff) |
[XFRM] STATE: Use destination address for src hash.
Src hash is introduced for Mobile IPv6 route optimization usage.
On current kenrel code it is calculated with source address only.
It results we uses the same hash value for outbound state (when
the node has only one address for Mobile IPv6).
This patch use also destination address as peer information for
src hash to be dispersed.
Signed-off-by: Masahide NAKAMURA <nakam@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xfrm/xfrm_hash.h')
-rw-r--r-- | net/xfrm/xfrm_hash.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/net/xfrm/xfrm_hash.h b/net/xfrm/xfrm_hash.h index 6ac4e4f033ac..d401dc8f05ed 100644 --- a/net/xfrm/xfrm_hash.h +++ b/net/xfrm/xfrm_hash.h | |||
@@ -41,17 +41,18 @@ static inline unsigned int __xfrm_dst_hash(xfrm_address_t *daddr, xfrm_address_t | |||
41 | return (h ^ (h >> 16)) & hmask; | 41 | return (h ^ (h >> 16)) & hmask; |
42 | } | 42 | } |
43 | 43 | ||
44 | static inline unsigned __xfrm_src_hash(xfrm_address_t *saddr, | 44 | static inline unsigned __xfrm_src_hash(xfrm_address_t *daddr, |
45 | xfrm_address_t *saddr, | ||
45 | unsigned short family, | 46 | unsigned short family, |
46 | unsigned int hmask) | 47 | unsigned int hmask) |
47 | { | 48 | { |
48 | unsigned int h = family; | 49 | unsigned int h = family; |
49 | switch (family) { | 50 | switch (family) { |
50 | case AF_INET: | 51 | case AF_INET: |
51 | h ^= __xfrm4_addr_hash(saddr); | 52 | h ^= __xfrm4_daddr_saddr_hash(daddr, saddr); |
52 | break; | 53 | break; |
53 | case AF_INET6: | 54 | case AF_INET6: |
54 | h ^= __xfrm6_addr_hash(saddr); | 55 | h ^= __xfrm6_daddr_saddr_hash(daddr, saddr); |
55 | break; | 56 | break; |
56 | }; | 57 | }; |
57 | return (h ^ (h >> 16)) & hmask; | 58 | return (h ^ (h >> 16)) & hmask; |