diff options
author | Martin Willi <martin@revosec.ch> | 2010-07-26 13:49:35 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2010-07-26 13:53:54 +0200 |
commit | 08e266a119e77bc7df84b5a7066e216ec1f9e984 (patch) | |
tree | cb15ad6547381a6d15ce2eaa9810f44289e95230 /src/libcharon/plugins/ha/ha_kernel.c | |
parent | 3e6736f67e9c3535543bc3d2381ec21cf3902023 (diff) | |
download | strongswan-08e266a119e77bc7df84b5a7066e216ec1f9e984.tar.bz2 strongswan-08e266a119e77bc7df84b5a7066e216ec1f9e984.tar.xz |
Log CHILD_SA segment responsibility
Diffstat (limited to 'src/libcharon/plugins/ha/ha_kernel.c')
-rw-r--r-- | src/libcharon/plugins/ha/ha_kernel.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libcharon/plugins/ha/ha_kernel.c b/src/libcharon/plugins/ha/ha_kernel.c index 7428de497..69ba29521 100644 --- a/src/libcharon/plugins/ha/ha_kernel.c +++ b/src/libcharon/plugins/ha/ha_kernel.c @@ -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, |