attribute-provider: Pass full IKE_SA to provider backends
This commit is contained in:
@@ -65,16 +65,13 @@ METHOD(attribute_manager_t, acquire_address, host_t*,
|
||||
{
|
||||
enumerator_t *enumerator;
|
||||
attribute_provider_t *current;
|
||||
identification_t *id;
|
||||
host_t *host = NULL;
|
||||
|
||||
id = ike_sa->get_other_eap_id(ike_sa);
|
||||
|
||||
this->lock->read_lock(this->lock);
|
||||
enumerator = this->providers->create_enumerator(this->providers);
|
||||
while (enumerator->enumerate(enumerator, ¤t))
|
||||
{
|
||||
host = current->acquire_address(current, pools, id, requested);
|
||||
host = current->acquire_address(current, pools, ike_sa, requested);
|
||||
if (host)
|
||||
{
|
||||
break;
|
||||
@@ -92,16 +89,13 @@ METHOD(attribute_manager_t, release_address, bool,
|
||||
{
|
||||
enumerator_t *enumerator;
|
||||
attribute_provider_t *current;
|
||||
identification_t *id;
|
||||
bool found = FALSE;
|
||||
|
||||
id = ike_sa->get_other_eap_id(ike_sa);
|
||||
|
||||
this->lock->read_lock(this->lock);
|
||||
enumerator = this->providers->create_enumerator(this->providers);
|
||||
while (enumerator->enumerate(enumerator, ¤t))
|
||||
{
|
||||
if (current->release_address(current, pools, address, id))
|
||||
if (current->release_address(current, pools, address, ike_sa))
|
||||
{
|
||||
found = TRUE;
|
||||
break;
|
||||
@@ -119,11 +113,8 @@ METHOD(attribute_manager_t, release_address, bool,
|
||||
static enumerator_t *responder_enum_create(attribute_provider_t *provider,
|
||||
enum_data_t *data)
|
||||
{
|
||||
identification_t *id;
|
||||
|
||||
id = data->ike_sa->get_other_eap_id(data->ike_sa);
|
||||
return provider->create_attribute_enumerator(provider, data->pools,
|
||||
id, data->vips);
|
||||
data->ike_sa, data->vips);
|
||||
}
|
||||
|
||||
METHOD(attribute_manager_t, create_responder_enumerator, enumerator_t*,
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
#ifndef ATTRIBUTE_PROVIDER_H_
|
||||
#define ATTRIBUTE_PROVIDER_H_
|
||||
|
||||
#include <sa/ike_sa.h>
|
||||
#include <networking/host.h>
|
||||
#include <utils/identification.h>
|
||||
#include <collections/linked_list.h>
|
||||
|
||||
typedef struct attribute_provider_t attribute_provider_t;
|
||||
@@ -36,35 +36,35 @@ struct attribute_provider_t {
|
||||
* Acquire a virtual IP address to assign to a peer.
|
||||
*
|
||||
* @param pools list of pool names (char*) to acquire from
|
||||
* @param id peer ID
|
||||
* @param ike_sa associated IKE_SA to assign address over
|
||||
* @param requested IP in configuration request
|
||||
* @return allocated address, NULL to serve none
|
||||
*/
|
||||
host_t* (*acquire_address)(attribute_provider_t *this,
|
||||
linked_list_t *pools, identification_t *id,
|
||||
linked_list_t *pools, ike_sa_t *ike_sa,
|
||||
host_t *requested);
|
||||
/**
|
||||
* Release a previously acquired address.
|
||||
*
|
||||
* @param pools list of pool names (char*) to release to
|
||||
* @param address address to release
|
||||
* @param id peer ID
|
||||
* @param ike_sa IKE_SA to release address for
|
||||
* @return TRUE if the address has been released by the provider
|
||||
*/
|
||||
bool (*release_address)(attribute_provider_t *this,
|
||||
linked_list_t *pools, host_t *address,
|
||||
identification_t *id);
|
||||
ike_sa_t *ike_sa);
|
||||
|
||||
/**
|
||||
* Create an enumerator over attributes to hand out to a peer.
|
||||
*
|
||||
* @param pool list of pools names (char*) to query attributes from
|
||||
* @param id peer ID
|
||||
* @param ike_sa IKE_SA to request attributes for
|
||||
* @param vip list of virtual IPs (host_t*) to assign to peer
|
||||
* @return enumerator (configuration_attribute_type_t, chunk_t)
|
||||
*/
|
||||
enumerator_t* (*create_attribute_enumerator)(attribute_provider_t *this,
|
||||
linked_list_t *pools, identification_t *id,
|
||||
linked_list_t *pools, ike_sa_t *ike_sa,
|
||||
linked_list_t *vips);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user