kernel-wfp: Add some missing IPv6 GUIDs, fix IPv6 host conversion

This commit is contained in:
Martin Willi 2013-12-18 11:56:36 +01:00
parent 288dc68596
commit 6aaa432741
2 changed files with 29 additions and 2 deletions

View File

@ -33,15 +33,27 @@ const GUID FWPM_CONDITION_IP_PROTOCOL = {
const GUID FWPM_LAYER_INBOUND_TRANSPORT_V4 = {
0x5926dfc8, 0xe3cf, 0x4426, { 0xa2,0x83,0xdc,0x39,0x3f,0x5d,0x0f,0x9d }
};
const GUID FWPM_LAYER_INBOUND_TRANSPORT_V6 = {
0x634a869f, 0xfc23, 0x4b90, { 0xb0,0xc1,0xbf,0x62,0x0a,0x36,0xae,0x6f }
};
const GUID FWPM_LAYER_OUTBOUND_TRANSPORT_V4 = {
0x09e61aea, 0xd214, 0x46e2, { 0x9b,0x21,0xb2,0x6b,0x0b,0x2f,0x28,0xc8 }
};
const GUID FWPM_LAYER_OUTBOUND_TRANSPORT_V6 = {
0xe1735bde, 0x013f, 0x4655, { 0xb3,0x51,0xa4,0x9e,0x15,0x76,0x2d,0xf0 }
};
const GUID FWPM_CALLOUT_IPSEC_INBOUND_TRANSPORT_V4 = {
0x5132900d, 0x5e84, 0x4b5f, { 0x80,0xe4,0x01,0x74,0x1e,0x81,0xff,0x10 }
};
const GUID FWPM_CALLOUT_IPSEC_INBOUND_TRANSPORT_V6 = {
0x49d3ac92, 0x2a6c, 0x4dcf, { 0x95,0x5f,0x1c,0x3b,0xe0,0x09,0xdd,0x99 }
};
const GUID FWPM_CALLOUT_IPSEC_OUTBOUND_TRANSPORT_V4 = {
0x4b46bf0a, 0x4523, 0x4e57, { 0xaa,0x38,0xa8,0x79,0x87,0xc9,0x10,0xd9 }
};
const GUID FWPM_CALLOUT_IPSEC_OUTBOUND_TRANSPORT_V6 = {
0x38d87722, 0xad83, 0x4f11, { 0xa9,0x1f,0xdf,0x0f,0xb0,0x77,0x22,0x5b }
};
/**
* Load a function symbol from a loaded dll

View File

@ -803,6 +803,21 @@ static bool install_sa(private_kernel_wfp_ipsec_t *this, entry_t *entry,
return TRUE;
}
/**
* 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
*/
@ -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;