mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-08 00:02:03 -04:00
kernel-pfkey: Make absolutely sure we always delete the right policy cache entry
This commit is contained in:
parent
33400876d4
commit
baff14d049
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2008-2012 Tobias Brunner
|
* Copyright (C) 2008-2015 Tobias Brunner
|
||||||
* Copyright (C) 2008 Andreas Steffen
|
* Copyright (C) 2008 Andreas Steffen
|
||||||
* Hochschule fuer Technik Rapperswil
|
* Hochschule fuer Technik Rapperswil
|
||||||
*
|
*
|
||||||
@ -2705,6 +2705,11 @@ METHOD(kernel_ipsec_t, del_policy, status_t,
|
|||||||
bool first = TRUE, is_installed = TRUE;
|
bool first = TRUE, is_installed = TRUE;
|
||||||
u_int32_t priority;
|
u_int32_t priority;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
ipsec_sa_t assigned_sa = {
|
||||||
|
.src = src,
|
||||||
|
.dst = dst,
|
||||||
|
.cfg = *sa,
|
||||||
|
};
|
||||||
|
|
||||||
if (dir2kernel(direction) == IPSEC_DIR_INVALID)
|
if (dir2kernel(direction) == IPSEC_DIR_INVALID)
|
||||||
{ /* FWD policies are not supported on all platforms */
|
{ /* FWD policies are not supported on all platforms */
|
||||||
@ -2738,8 +2743,8 @@ METHOD(kernel_ipsec_t, del_policy, status_t,
|
|||||||
enumerator = policy->used_by->create_enumerator(policy->used_by);
|
enumerator = policy->used_by->create_enumerator(policy->used_by);
|
||||||
while (enumerator->enumerate(enumerator, (void**)&mapping))
|
while (enumerator->enumerate(enumerator, (void**)&mapping))
|
||||||
{
|
{
|
||||||
if (sa->reqid == mapping->sa->cfg.reqid &&
|
if (priority == mapping->priority &&
|
||||||
priority == mapping->priority)
|
ipsec_sa_equals(mapping->sa, &assigned_sa))
|
||||||
{
|
{
|
||||||
to_remove = mapping;
|
to_remove = mapping;
|
||||||
is_installed = first;
|
is_installed = first;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user