aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcharon/plugins/dhcp/dhcp_provider.c
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2012-08-31 12:55:56 +0200
committerMartin Willi <martin@revosec.ch>2012-08-31 12:55:56 +0200
commit1323dc1138246a6e2819bcc20b167b75d52e6d7c (patch)
tree5081fcc1d015a8cd0ec6dfe39a8df14f12d86ac5 /src/libcharon/plugins/dhcp/dhcp_provider.c
parent868409139b00f24607baab2d81b873cb1a5a9e5b (diff)
parent69e056a2c13ac7da9ed4e48f846d642aa01a362b (diff)
downloadstrongswan-1323dc1138246a6e2819bcc20b167b75d52e6d7c.tar.bz2
strongswan-1323dc1138246a6e2819bcc20b167b75d52e6d7c.tar.xz
Merge branch 'multi-vip'
Brings support for multiple virtual IPs and multiple pools in left/rigthsourceip definitions. Also introduces the new left/rightdns options to configure requested DNS server address family and respond with multiple connection specific servers.
Diffstat (limited to 'src/libcharon/plugins/dhcp/dhcp_provider.c')
-rw-r--r--src/libcharon/plugins/dhcp/dhcp_provider.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/libcharon/plugins/dhcp/dhcp_provider.c b/src/libcharon/plugins/dhcp/dhcp_provider.c
index a6a887780..e46cc4d90 100644
--- a/src/libcharon/plugins/dhcp/dhcp_provider.c
+++ b/src/libcharon/plugins/dhcp/dhcp_provider.c
@@ -84,7 +84,7 @@ METHOD(attribute_provider_t, acquire_address, host_t*,
private_dhcp_provider_t *this, char *pool,
identification_t *id, host_t *requested)
{
- if (streq(pool, "dhcp"))
+ if (streq(pool, "dhcp") && requested->get_family(requested) == AF_INET)
{
dhcp_transaction_t *transaction, *old;
host_t *vip;
@@ -110,7 +110,7 @@ METHOD(attribute_provider_t, release_address, bool,
private_dhcp_provider_t *this, char *pool,
host_t *address, identification_t *id)
{
- if (streq(pool, "dhcp"))
+ if (streq(pool, "dhcp") && address->get_family(address) == AF_INET)
{
dhcp_transaction_t *transaction;
@@ -129,18 +129,25 @@ METHOD(attribute_provider_t, release_address, bool,
}
METHOD(attribute_provider_t, create_attribute_enumerator, enumerator_t*,
- private_dhcp_provider_t *this, char *pool, identification_t *id,
- host_t *vip)
+ private_dhcp_provider_t *this, linked_list_t *pools, identification_t *id,
+ linked_list_t *vips)
{
- dhcp_transaction_t *transaction;
+ dhcp_transaction_t *transaction = NULL;
+ enumerator_t *enumerator;
+ host_t *vip;
- if (!vip)
+ this->mutex->lock(this->mutex);
+ enumerator = vips->create_enumerator(vips);
+ while (enumerator->enumerate(enumerator, &vip))
{
- return NULL;
+ transaction = this->transactions->get(this->transactions,
+ (void*)hash_id_host(id, vip));
+ if (transaction)
+ {
+ break;
+ }
}
- this->mutex->lock(this->mutex);
- transaction = this->transactions->get(this->transactions,
- (void*)hash_id_host(id, vip));
+ enumerator->destroy(enumerator);
if (!transaction)
{
this->mutex->unlock(this->mutex);