Log CHILD_SA segment responsibility

This commit is contained in:
Martin Willi
2010-07-26 13:53:54 +02:00
parent 3e6736f67e
commit 08e266a119
9 changed files with 95 additions and 18 deletions
+17
View File
@@ -67,6 +67,22 @@ METHOD(ha_kernel_t, get_segment, u_int,
return 0;
}
METHOD(ha_kernel_t, get_segment_spi, u_int,
private_ha_kernel_t *this, host_t *host, u_int32_t spi)
{
if (host->get_family(host) == AF_INET)
{
unsigned long hash;
u_int32_t addr;
addr = *(u_int32_t*)host->get_address(host).ptr;
hash = jhash_2words(ntohl(addr), ntohl(spi), this->initval);
return (((u_int64_t)hash * this->count) >> 32) + 1;
}
return 0;
}
/**
* Activate/Deactivate a segment for a given clusterip file
*/
@@ -206,6 +222,7 @@ ha_kernel_t *ha_kernel_create(u_int count)
INIT(this,
.public = {
.get_segment = _get_segment,
.get_segment_spi = _get_segment_spi,
.activate = _activate,
.deactivate = _deactivate,
.destroy = _destroy,