1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-23 01:49:53 +03:00

Merge pull request #1580 from updatede/patch-2

Fix udp acceleration unusable on big endian system
This commit is contained in:
Yihong Wu 2022-04-26 10:18:04 +08:00 committed by GitHub
commit 3a91490b7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -338,6 +338,8 @@ void UdpAccelSend(UDP_ACCEL *a, UCHAR *data, UINT data_size, UCHAR flag, UINT ma
UINT size = 0; UINT size = 0;
UINT64 tmp; UINT64 tmp;
UINT ret; UINT ret;
UINT u32;
USHORT u16;
// Validate arguments // Validate arguments
if (a == NULL || (data_size != 0 && data == NULL)) if (a == NULL || (data_size != 0 && data == NULL))
{ {
@ -367,8 +369,8 @@ void UdpAccelSend(UDP_ACCEL *a, UCHAR *data, UINT data_size, UCHAR flag, UINT ma
} }
// Cookie // Cookie
tmp = Endian32(a->YourCookie); u32 = Endian32(a->YourCookie);
Copy(buf, &tmp, sizeof(UINT)); Copy(buf, &u32, sizeof(UINT));
buf += sizeof(UINT); buf += sizeof(UINT);
size += sizeof(UINT); size += sizeof(UINT);
@ -385,8 +387,8 @@ void UdpAccelSend(UDP_ACCEL *a, UCHAR *data, UINT data_size, UCHAR flag, UINT ma
size += sizeof(UINT64); size += sizeof(UINT64);
// Size // Size
tmp = Endian16(data_size); u16 = Endian16(data_size);
Copy(buf, &tmp, sizeof(USHORT)); Copy(buf, &u16, sizeof(USHORT));
buf += sizeof(USHORT); buf += sizeof(USHORT);
size += sizeof(USHORT); size += sizeof(USHORT);