From: John Hodge Date: Wed, 2 Feb 2011 12:33:49 +0000 (+0800) Subject: Updated InitRD to new usermode layout, cleanups in networking X-Git-Tag: rel0.07~14 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=4fc7efa62f7a33e0c8a499f5a175419c2d16c273;p=tpg%2Facess2.git Updated InitRD to new usermode layout, cleanups in networking --- diff --git a/Modules/Filesystems/InitRD/files.lst b/Modules/Filesystems/InitRD/files.lst index 7ac60834..141e45d7 100644 --- a/Modules/Filesystems/InitRD/files.lst +++ b/Modules/Filesystems/InitRD/files.lst @@ -1,20 +1,21 @@ Dir "SBin" { - File "init" "../../../Usermode/Applications/init" - File "login" "../../../Usermode/Applications/login" + File "init" "../../../Usermode/Output/i386/SBin/init" + File "login" "../../../Usermode/Output/i386/SBin/login" } Dir "Bin" { - File "CLIShell" "../../../Usermode/Applications/CLIShell" - File "ls" "../../../Usermode/Applications/ls" - File "cat" "../../../Usermode/Applications/cat" - File "mount" "../../../Usermode/Applications/mount" - File "pcidump" "../../../Usermode/Applications/pcidump" + File "CLIShell" "../../../Usermode/Output/i386/Bin/CLIShell" + File "ls" "../../../Usermode/Output/i386/Bin/ls" + File "cat" "../../../Usermode/Output/i386/Bin/cat" + File "mount" "../../../Usermode/Output/i386/Bin/mount" + File "pcidump" "../../../Usermode/Output/i386/Bin/pcidump" + File "ifconfig" "../../../Usermode/Output/i386/Bin/ifconfig" } Dir "Libs" { - File "ld-acess.so" "../../../Usermode/Libraries/ld-acess.so" - File "libacess.so" "../../../Usermode/Libraries/libacess.so" - File "libc.so" "../../../Usermode/Libraries/libc.so" - File "libgcc.so" "../../../Usermode/Libraries/libgcc.so" - File "libreadline.so" "../../../Usermode/Libraries/libreadline.so" + File "ld-acess.so" "../../../Usermode/Output/i386/Libs/ld-acess.so" + File "libc.so" "../../../Usermode/Output/i386/Libs/libc.so" + File "libgcc.so" "../../../Usermode/Output/i386/Libs/libgcc.so" + File "libreadline.so" "../../../Usermode/Output/i386/Libs/libreadline.so" + File "libreadline.so" "../../../Usermode/Output/i386/Libs/libnet.so" } Dir "Conf" { File "BootConf.cfg" "../../../Usermode/Filesystem/Conf/BootConf.cfg" diff --git a/Modules/Filesystems/InitRD/main.c b/Modules/Filesystems/InitRD/main.c index ff24b516..e5781915 100644 --- a/Modules/Filesystems/InitRD/main.c +++ b/Modules/Filesystems/InitRD/main.c @@ -12,7 +12,7 @@ extern tVFS_Node gInitRD_RootNode; // === PROTOTYPES === int InitRD_Install(char **Arguments); -tVFS_Node *InitRD_InitDevice(char *Device, char **Arguments); +tVFS_Node *InitRD_InitDevice(const char *Device, const char **Arguments); void InitRD_Unmount(tVFS_Node *Node); Uint64 InitRD_ReadFile(tVFS_Node *Node, Uint64 Offset, Uint64 Size, void *Buffer); char *InitRD_ReadDir(tVFS_Node *Node, int ID); @@ -38,7 +38,7 @@ int InitRD_Install(char **Arguments) /** * \brief Mount the InitRD */ -tVFS_Node *InitRD_InitDevice(char *Device, char **Arguments) +tVFS_Node *InitRD_InitDevice(const char *Device, const char **Arguments) { #if DUMP_ON_MOUNT InitRD_DumpDir( &gInitRD_RootNode, 0 ); diff --git a/Modules/IPStack/tcp.c b/Modules/IPStack/tcp.c index 18150a36..51f6ae43 100644 --- a/Modules/IPStack/tcp.c +++ b/Modules/IPStack/tcp.c @@ -282,14 +282,16 @@ void TCP_INT_HandleConnectionPacket(tTCPConnection *Connection, tTCPHeader *Head tTCPStoredPacket *pkt; int dataLen; + // Syncronise sequence values if(Header->Flags & TCP_FLAG_SYN) { Connection->NextSequenceRcv = ntohl(Header->SequenceNumber) + 1; } + // Handle a server replying to our initial SYN if( Connection->State == TCP_ST_SYN_SENT ) { - if( (Header->Flags & (TCP_FLAG_SYN|TCP_FLAG_ACK)) == (TCP_FLAG_SYN|TCP_FLAG_ACK) ) { - + if( (Header->Flags & (TCP_FLAG_SYN|TCP_FLAG_ACK)) == (TCP_FLAG_SYN|TCP_FLAG_ACK) ) + { Header->DestPort = Header->SourcePort; Header->SourcePort = htons(Connection->LocalPort); Header->AcknowlegementNumber = htonl(Connection->NextSequenceRcv); @@ -303,6 +305,13 @@ void TCP_INT_HandleConnectionPacket(tTCPConnection *Connection, tTCPHeader *Head } } + // Handle a client confirming the connection + if( Connection->State == TCP_ST_HALFOPEN && (Header->Flags & TCP_FLAG_ACK) ) + { + Connection->State = TCP_ST_OPEN; + Log_Log("TCP", "Connection fully opened"); + } + // Get length of data dataLen = Length - (Header->DataOffset>>4)*4; Log_Log("TCP", "HandleConnectionPacket - dataLen = %i", dataLen); @@ -330,6 +339,7 @@ void TCP_INT_HandleConnectionPacket(tTCPConnection *Connection, tTCPHeader *Head } } + // Check for an empty packet if(dataLen == 0) { Log_Log("TCP", "Empty Packet"); return ; diff --git a/Modules/Network/NE2000/ne2000.c b/Modules/Network/NE2000/ne2000.c index d77bfb86..d5eadb77 100644 --- a/Modules/Network/NE2000/ne2000.c +++ b/Modules/Network/NE2000/ne2000.c @@ -256,23 +256,7 @@ int Ne2k_IOCtl(tVFS_Node *Node, int ID, void *Data) ENTER("pNode iID pData", Node, ID, Data); switch( ID ) { - case DRV_IOCTL_TYPE: - LEAVE('i', DRV_TYPE_NETWORK); - return DRV_TYPE_NETWORK; - - case DRV_IOCTL_IDENT: - tmp = ModUtil_SetIdent(Data, "Ne2k"); - LEAVE('i', tmp); - return tmp; - - case DRV_IOCTL_VERSION: - LEAVE('x', VERSION); - return VERSION; - - case DRV_IOCTL_LOOKUP: - tmp = ModUtil_LookupString( (char**)casIOCtls, Data ); - LEAVE('i', tmp); - return tmp; + BASE_IOCTLS(DRV_TYPE_NETWORK, "NE2000", VERSION, casIOCtls); } // If this is the root, return @@ -382,6 +366,7 @@ Uint64 Ne2k_Read(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer) ENTER("pNode XOffset XLength pBuffer", Node, Offset, Length, Buffer); + // TODO: Use MutexP/MutexV instead while(Card->NumWaitingPackets == 0) Threads_Yield(); // Make sure that the card is in page 0 diff --git a/Usermode/Applications/testclient_src/main.c b/Usermode/Applications/testclient_src/main.c index 5682a8d7..8401e0bd 100644 --- a/Usermode/Applications/testclient_src/main.c +++ b/Usermode/Applications/testclient_src/main.c @@ -14,7 +14,7 @@ int main(int argc, char *argv[]) int con = -1; int len; uint16_t port; - uint8_t buf[4] = {10,0,2,1}; + uint8_t buf[4] = {10,2,0,37}; uint8_t data[4096]; // Packet Data con = open("/Devices/ip/1/tcpc", OPENFLAG_READ|OPENFLAG_WRITE); @@ -28,7 +28,7 @@ int main(int argc, char *argv[]) ioctl(con, 7, NULL); // Connect #define REQ_STR "GET / HTTP/1.1\r\n"\ - "Host: prelude\r\n"\ + "Host: sonata\r\n"\ "User-Agent: Acess2 TCP Test Client\r\n"\ "\r\n"