better TCP sequence numbers

This commit is contained in:
Arisotura 2019-03-09 01:34:57 +01:00
parent f3f4613b4e
commit cde1963e63
1 changed files with 7 additions and 7 deletions

View File

@ -745,18 +745,18 @@ void HandleTCPFrame(u8* data, int len)
return;
}
// TODO: check those
u32 seqnum = ntohl(*(u32*)&tcpheader[4]);
u32 acknum = ntohl(*(u32*)&tcpheader[8]);
sock->SeqNum = acknum;
sock->AckNum = seqnum + tcpdatalen;
// send data over the socket
if (tcpdatalen > 0)
{
u8* tcpdata = &tcpheader[tcpheaderlen];
// TODO: check those
u32 seqnum = ntohl(*(u32*)&tcpheader[4]);
u32 acknum = ntohl(*(u32*)&tcpheader[8]);
sock->SeqNum = acknum;
sock->AckNum = seqnum + tcpdatalen;
printf("TCP: socket %d sending %d bytes\n", sockid, tcpdatalen);
printf("TCP: socket %d sending %d bytes (flags=%04X)\n", sockid, tcpdatalen, flags);
send(sock->Backend, (char*)tcpdata, tcpdatalen, 0);
// kind of a hack, there