aboutsummaryrefslogtreecommitdiffstats
path: root/src/charon/plugins/kernel_netlink/kernel_netlink_ipsec.c
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2008-11-05 08:32:38 +0000
committerMartin Willi <martin@strongswan.org>2008-11-05 08:32:38 +0000
commite13389a7f7bab5d2cd14325b7bd77ddddcd8bd91 (patch)
tree8761d09b0a9dc90e3d93841e9e257c3f71eb1987 /src/charon/plugins/kernel_netlink/kernel_netlink_ipsec.c
parente10b0d0fc09d7528349433e7710aae7ab4384ae4 (diff)
downloadstrongswan-e13389a7f7bab5d2cd14325b7bd77ddddcd8bd91.tar.bz2
strongswan-e13389a7f7bab5d2cd14325b7bd77ddddcd8bd91.tar.xz
got rid of deprecated create_iterator_locked()
Diffstat (limited to 'src/charon/plugins/kernel_netlink/kernel_netlink_ipsec.c')
-rw-r--r--src/charon/plugins/kernel_netlink/kernel_netlink_ipsec.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/charon/plugins/kernel_netlink/kernel_netlink_ipsec.c b/src/charon/plugins/kernel_netlink/kernel_netlink_ipsec.c
index 4d6211b8b..c53ce3c75 100644
--- a/src/charon/plugins/kernel_netlink/kernel_netlink_ipsec.c
+++ b/src/charon/plugins/kernel_netlink/kernel_netlink_ipsec.c
@@ -1623,7 +1623,7 @@ static status_t del_policy(private_kernel_netlink_ipsec_t *this,
unsigned char request[NETLINK_BUFFER_SIZE];
struct nlmsghdr *hdr;
struct xfrm_userpolicy_id *policy_id;
- iterator_t *iterator;
+ enumerator_t *enumerator;
DBG2(DBG_KNL, "deleting policy %R === %R %N", src_ts, dst_ts,
policy_dir_names, direction);
@@ -1634,8 +1634,9 @@ static status_t del_policy(private_kernel_netlink_ipsec_t *this,
policy.direction = direction;
/* find the policy */
- iterator = this->policies->create_iterator_locked(this->policies, &this->mutex);
- while (iterator->iterate(iterator, (void**)&current))
+ pthread_mutex_lock(&this->mutex);
+ enumerator = this->policies->create_enumerator(this->policies);
+ while (enumerator->enumerate(enumerator, &current))
{
if (memeq(&current->sel, &policy.sel, sizeof(struct xfrm_selector)) &&
policy.direction == current->direction)
@@ -1645,15 +1646,17 @@ static status_t del_policy(private_kernel_netlink_ipsec_t *this,
{
/* is used by more SAs, keep in kernel */
DBG2(DBG_KNL, "policy still used by another CHILD_SA, not removed");
- iterator->destroy(iterator);
+ pthread_mutex_unlock(&this->mutex);
+ enumerator->destroy(enumerator);
return SUCCESS;
}
/* remove if last reference */
- iterator->remove(iterator);
+ this->policies->remove_at(this->policies, enumerator);
break;
}
}
- iterator->destroy(iterator);
+ pthread_mutex_unlock(&this->mutex);
+ enumerator->destroy(enumerator);
if (!to_delete)
{
DBG1(DBG_KNL, "deleting policy %R === %R %N failed, not found", src_ts,