aboutsummaryrefslogtreecommitdiffstats
path: root/src/libhydra/plugins
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2012-09-28 18:30:16 +0200
committerTobias Brunner <tobias@strongswan.org>2012-09-28 18:30:16 +0200
commit6ffb8f8634a768db93669067c39ceb3b601cb902 (patch)
tree1fc6e1c17cc6aebf527a061d110e8b421fde0e1e /src/libhydra/plugins
parent8b0dce08f2e0f3097915e4aedc597497fa5a211d (diff)
downloadstrongswan-6ffb8f8634a768db93669067c39ceb3b601cb902.tar.bz2
strongswan-6ffb8f8634a768db93669067c39ceb3b601cb902.tar.xz
Clarified code when hashing/comparing cached policies in kernel-netlink
Diffstat (limited to 'src/libhydra/plugins')
-rw-r--r--src/libhydra/plugins/kernel_netlink/kernel_netlink_ipsec.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/libhydra/plugins/kernel_netlink/kernel_netlink_ipsec.c b/src/libhydra/plugins/kernel_netlink/kernel_netlink_ipsec.c
index 677b6557e..ed7a622b5 100644
--- a/src/libhydra/plugins/kernel_netlink/kernel_netlink_ipsec.c
+++ b/src/libhydra/plugins/kernel_netlink/kernel_netlink_ipsec.c
@@ -590,9 +590,8 @@ static void policy_entry_destroy(private_kernel_netlink_ipsec_t *this,
*/
static u_int policy_hash(policy_entry_t *key)
{
- chunk_t chunk = chunk_create((void*)&key->sel,
- sizeof(struct xfrm_selector) + sizeof(u_int32_t));
- return chunk_hash(chunk);
+ chunk_t chunk = chunk_from_thing(key->sel);
+ return chunk_hash_inc(chunk, chunk_hash(chunk_from_thing(key->mark)));
}
/**
@@ -600,8 +599,8 @@ static u_int policy_hash(policy_entry_t *key)
*/
static bool policy_equals(policy_entry_t *key, policy_entry_t *other_key)
{
- return memeq(&key->sel, &other_key->sel,
- sizeof(struct xfrm_selector) + sizeof(u_int32_t)) &&
+ return memeq(&key->sel, &other_key->sel, sizeof(struct xfrm_selector)) &&
+ key->mark == other_key->mark &&
key->direction == other_key->direction;
}