X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Modules%2FIPStack%2Ftcp.c;h=18150a36c1a12e419764f6012c5c58772c24b525;hb=23096bbffa94688e90db5045d124dcdfe83a132e;hp=8b486d23aecfc89fdcfdcaae1968f05e63e33b99;hpb=7d881c2e5fef91a6570e46ef69a5d4a5cf0e8b4d;p=tpg%2Facess2.git diff --git a/Modules/IPStack/tcp.c b/Modules/IPStack/tcp.c index 8b486d23..18150a36 100644 --- a/Modules/IPStack/tcp.c +++ b/Modules/IPStack/tcp.c @@ -79,12 +79,12 @@ void TCP_SendPacket( tTCPConnection *Conn, size_t Length, tTCPHeader *Data ) case 4: // Append IPv4 Pseudo Header buflen = 4 + 4 + 4 + ((Length+1)&~1); buf = malloc( buflen ); - buf[0] = Conn->Interface->IP4.Address.L; + buf[0] = ((tIPv4*)Conn->Interface->Address)->L; buf[1] = Conn->RemoteIP.v4.L; buf[2] = (htons(Length)<<16) | (6<<8) | 0; Data->Checksum = 0; memcpy( &buf[3], Data, Length ); - Data->Checksum = IPv4_Checksum( buf, buflen ); + Data->Checksum = htons( IPv4_Checksum( buf, buflen ) ); free(buf); IPv4_SendPacket(Conn->Interface, Conn->RemoteIP.v4, IP4PROT_TCP, 0, Length, Data); break; @@ -231,7 +231,7 @@ void TCP_GetPacket(tInterface *Interface, void *Address, int Length, void *Buffe srv->ConnectionsTail = conn; if(!srv->NewConnections) srv->NewConnections = conn; - SHORTLOCK(&srv->lConnections); + SHORTREL(&srv->lConnections); // Send the SYN ACK hdr->Flags |= TCP_FLAG_ACK; @@ -881,7 +881,7 @@ int TCP_Client_IOCtl(tVFS_Node *Node, int ID, void *Data) if(conn->State != TCP_ST_CLOSED) return -1; if(!CheckMem(Data, sizeof(Uint16))) return -1; conn->RemotePort = *(Uint16*)Data; - return 0; + return conn->RemotePort; case 6: // Set Remote IP if( conn->State != TCP_ST_CLOSED ) @@ -906,6 +906,10 @@ int TCP_Client_IOCtl(tVFS_Node *Node, int ID, void *Data) TCP_StartConnection(conn); return 1; + + // Get recieve buffer length + case 8: + return conn->RecievedBuffer->Length; } return 0;