aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcharon/plugins/kernel_wfp/kernel_wfp_ipsec.c
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2013-12-18 11:56:36 +0100
committerMartin Willi <martin@revosec.ch>2014-06-04 16:32:09 +0200
commit6aaa432741c6675493c7a07bc5e9c5ea69eaf21e (patch)
tree88e2204497eec4fdc86de713a7943d51d15afad3 /src/libcharon/plugins/kernel_wfp/kernel_wfp_ipsec.c
parent288dc68596f6c5b52d061356e3599ba50087e355 (diff)
downloadstrongswan-6aaa432741c6675493c7a07bc5e9c5ea69eaf21e.tar.bz2
strongswan-6aaa432741c6675493c7a07bc5e9c5ea69eaf21e.tar.xz
kernel-wfp: Add some missing IPv6 GUIDs, fix IPv6 host conversion
Diffstat (limited to 'src/libcharon/plugins/kernel_wfp/kernel_wfp_ipsec.c')
-rw-r--r--src/libcharon/plugins/kernel_wfp/kernel_wfp_ipsec.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/libcharon/plugins/kernel_wfp/kernel_wfp_ipsec.c b/src/libcharon/plugins/kernel_wfp/kernel_wfp_ipsec.c
index 3dbbb30a6..a658fd150 100644
--- a/src/libcharon/plugins/kernel_wfp/kernel_wfp_ipsec.c
+++ b/src/libcharon/plugins/kernel_wfp/kernel_wfp_ipsec.c
@@ -804,6 +804,21 @@ static bool install_sa(private_kernel_wfp_ipsec_t *this, entry_t *entry,
}
/**
+ * Convert an IPv6 host address to WFP representation
+ */
+static void host2address6(host_t *host, void *out)
+{
+ u_int32_t *src, *dst = out;
+
+ src = (u_int32_t*)host->get_address(host).ptr;
+
+ dst[0] = untoh32(&src[3]);
+ dst[1] = untoh32(&src[2]);
+ dst[2] = untoh32(&src[1]);
+ dst[3] = untoh32(&src[0]);
+}
+
+/**
* Fill in traffic structure from entry addresses
*/
static bool hosts2traffic(private_kernel_wfp_ipsec_t *this,
@@ -822,8 +837,8 @@ static bool hosts2traffic(private_kernel_wfp_ipsec_t *this,
return TRUE;
case AF_INET6:
traffic->ipVersion = FWP_IP_VERSION_V6;
- memcpy(&traffic->localV6Address, l->get_address(l).ptr, 16);
- memcpy(&traffic->remoteV6Address, r->get_address(r).ptr, 16);
+ host2address6(l, &traffic->localV6Address);
+ host2address6(r, &traffic->remoteV6Address);
return TRUE;
default:
return FALSE;