ported some hard-to-merge cherries back to trunk :-/

shame, svn, shame: this was ways to complicated
	we should consider a switch to git...
This commit is contained in:
Martin Willi
2008-11-12 15:09:24 +00:00
parent 9fa5c75f48
commit b8cbb6451c
9 changed files with 85 additions and 97 deletions
+3 -11
View File
@@ -35,14 +35,6 @@ database_t *db;
*/
host_t *start = NULL, *end = NULL;
/**
* create a host from a blob
*/
static host_t *host_create_from_blob(chunk_t blob)
{
return host_create_from_chunk(blob.len == 4 ? AF_INET : AF_INET6, blob, 0);
}
/**
* calculate the size of a pool using start and end address chunk
*/
@@ -132,8 +124,8 @@ static void status(void)
found = TRUE;
}
start = host_create_from_blob(start_chunk);
end = host_create_from_blob(end_chunk);
start = host_create_from_chunk(AF_UNSPEC, start_chunk, 0);
end = host_create_from_chunk(AF_UNSPEC, end_chunk, 0);
size = get_pool_size(start_chunk, end_chunk);
printf("%8s %15H %15H ", name, start, end);
if (timeout)
@@ -541,7 +533,7 @@ static void leases(char *filter, bool utc)
printf("%-8s %-15s %-7s %-*s %-*s %s\n",
"name", "address", "status", len, "start", len, "end", "identity");
}
address = host_create_from_blob(address_chunk);
address = host_create_from_chunk(AF_UNSPEC, address_chunk, 0);
identity = identification_create_from_encoding(identity_type, identity_chunk);
printf("%-8s %-15H ", name, address);
+2 -18
View File
@@ -44,22 +44,6 @@ struct private_sql_attribute_t {
bool history;
};
/**
* read a host_t address from the addresses table
*/
static host_t *host_from_chunk(chunk_t chunk)
{
switch (chunk.len)
{
case 4:
return host_create_from_chunk(AF_INET, chunk, 0);
case 16:
return host_create_from_chunk(AF_INET6, chunk, 0);
default:
return NULL;
}
}
/**
* lookup/insert an identity
*/
@@ -145,7 +129,7 @@ static host_t *get_address(private_sql_attribute_t *this, char *name,
"WHERE id = ? AND identity = ? AND released != 0",
DB_UINT, now, DB_UINT, id, DB_UINT, identity) > 0)
{
host = host_from_chunk(address);
host = host_create_from_chunk(AF_UNSPEC, address, 0);
if (host)
{
DBG1(DBG_CFG, "acquired existing lease "
@@ -177,7 +161,7 @@ static host_t *get_address(private_sql_attribute_t *this, char *name,
DB_UINT, now, DB_UINT, identity,
DB_UINT, id, DB_UINT, now - timeout) > 0)
{
host = host_from_chunk(address);
host = host_create_from_chunk(AF_UNSPEC, address, 0);
if (host)
{
DBG1(DBG_CFG, "acquired new lease "