mirror of https://github.com/PCSX2/pcsx2.git
DEV9: Correct alignment calculation in Sockets
This commit is contained in:
parent
00f4cd5252
commit
f317ba327c
|
@ -4,6 +4,7 @@
|
|||
#include "IP_Packet.h"
|
||||
#include "DEV9/PacketReader/NetLib.h"
|
||||
|
||||
#include "common/BitUtils.h"
|
||||
#include "common/Console.h"
|
||||
|
||||
namespace PacketReader::IP
|
||||
|
@ -209,8 +210,8 @@ namespace PacketReader::IP
|
|||
for (size_t i = 0; i < options.size(); i++)
|
||||
opOffset += options[i]->GetLength();
|
||||
|
||||
opOffset += opOffset % 4; //needs to be a whole number of 32bits
|
||||
headerLength = opOffset;
|
||||
//needs to be a whole number of 32bits
|
||||
headerLength = Common::AlignUpPow2(opOffset, 4);
|
||||
}
|
||||
|
||||
void IP_Packet::CalculateChecksum()
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "TCP_Packet.h"
|
||||
#include "DEV9/PacketReader/NetLib.h"
|
||||
|
||||
#include "common/BitUtils.h"
|
||||
#include "common/Console.h"
|
||||
|
||||
namespace PacketReader::IP::TCP
|
||||
|
@ -232,8 +233,8 @@ namespace PacketReader::IP::TCP
|
|||
for (size_t i = 0; i < options.size(); i++)
|
||||
opOffset += options[i]->GetLength();
|
||||
|
||||
opOffset += opOffset % 4; //needs to be a whole number of 32bits
|
||||
headerLength = opOffset;
|
||||
//needs to be a whole number of 32bits
|
||||
headerLength = Common::AlignUpPow2(opOffset, 4);
|
||||
|
||||
//Also write into dataOffsetAndNS_Flag
|
||||
u8 ns = dataOffsetAndNS_Flag & 1;
|
||||
|
|
Loading…
Reference in New Issue