IPStack - Removed early network config, because it now shouldn't work
authorJohn Hodge <[email protected]>
Sat, 12 May 2012 11:27:53 +0000 (19:27 +0800)
committerJohn Hodge <[email protected]>
Sat, 12 May 2012 11:27:53 +0000 (19:27 +0800)
KernelLand/Modules/IPStack/main.c

index 3aecfb3..5763e2d 100644 (file)
@@ -53,8 +53,7 @@ tDevFS_Driver gIP_DriverInfo = {
  */
 int IPStack_Install(char **Arguments)
 {
-        int    i = 0;
-       
+       // TODO: different Layer 2 protocols
        // Layer 3 - Network Layer Protocols
        ARP_Initialise();
        IPv4_Initialise();
@@ -63,134 +62,6 @@ int IPStack_Install(char **Arguments)
        TCP_Initialise();
        UDP_Initialise();
        
-       if(Arguments)
-       {
-               // Parse module arguments
-               for( i = 0; Arguments[i]; i++ )
-               {
-                       // TODO:
-                       // Define interfaces by <Device>:<Type>:<HexStreamAddress>:<Bits>
-                       // Where:
-                       // - <Device> is the device path (E.g. /Devices/ne2k/0)
-                       // - <Type> is a number (e.g. 4) or symbol (e.g. AF_INET4)
-                       // - <HexStreamAddress> is a condensed hexadecimal stream (in big endian)
-                       //      (E.g. 0A000201 for 10.0.2.1 IPv4)
-                       // - <Bits> is the number of subnet bits (E.g. 24 for an IPv4 Class C)
-                       // Example: /Devices/ne2k/0:4:0A00020A:24
-                       //  would define an interface with the address 10.0.2.10/24
-                       if( Arguments[i][0] == '/' ) {
-                               // Define Interface
-                               char    *dev, *type, *addr, *bits;
-                               
-                               // Read definition
-                               dev = Arguments[i];
-                               type = strchr(dev, ':');
-                               if( !type ) {
-                                       Log_Warning("IPStack", "<Device>:<Type>:<HexStreamAddress>:<Bits>");
-                                       continue;
-                               }
-                               *type = '\0';   type ++;
-                               
-                               addr = strchr(type, ':');
-                               if( !addr ) {
-                                       Log_Warning("IPStack", "<Device>:<Type>:<HexStreamAddress>:<Bits>");
-                                       continue;
-                               }
-                               *addr = '\0';   addr ++;
-                               
-                               bits = strchr(addr, ':');
-                               if( !bits ) {
-                                       Log_Warning("IPStack", "<Device>:<Type>:<HexStreamAddress>:<Bits>");
-                                       continue;
-                               }
-                               *bits = '\0';   bits ++;
-                               
-                               // Define interface
-                               {
-                                        int    iType = atoi(type);
-                                        int    size = IPStack_GetAddressSize(iType);
-                                       Uint8   addrData[size];
-                                        int    iBits = atoi(bits);
-                                       
-                                       UnHex(addrData, size, addr);
-                                       
-                                       tInterface      *iface = IPStack_AddInterface(dev, "");
-                                       if( !iface ) {
-                                               Log_Warning("IPStack", "Unable to add interface on '%s'", dev);
-                                               continue ;
-                                       }
-                                       iface->Type = iType;
-                                       memcpy(iface->Address, addrData, size);
-                                       iface->SubnetBits = iBits;
-                                       
-                                       // Route for addrData/iBits, no next hop, default metric
-                                       IPStack_AddRoute(iface->Name, iface->Address, iBits, NULL, 0);
-
-                                       Log_Notice("IPStack", "Boot interface %s/%i on %s",
-                                               IPStack_PrintAddress(iType, addrData), iBits,
-                                               dev);
-                               }
-                               
-                               continue;
-                       }
-                       
-                       // I could also define routes using <Interface>:<HexStreamNetwork>:<Bits>[:<HexStreamGateway>]
-                       // Example: 1:00000000:0:0A000201
-                       if( '0' <= Arguments[i][0] && Arguments[i][0] <= '9' )
-                       {
-                               // Define Interface
-                               char    *ifaceName, *network, *bits, *gateway;
-                               
-                               // Read definition
-                               ifaceName = Arguments[i];
-                               
-                               network = strchr(ifaceName, ':');
-                               if( !network ) {
-                                       Log_Warning("IPStack", "<iface>:<HexStreamNetwork>:<Bits>:<HexStreamGateway>");
-                                       continue;
-                               }
-                               *network = '\0';        network ++;
-                               
-                               bits = strchr(network, ':');
-                               if( !bits ) {
-                                       Log_Warning("IPStack", "<Device>:<Type>:<HexStreamAddress>:<Bits>");
-                                       continue;
-                               }
-                               *bits = '\0';   bits ++;
-                               
-                               gateway = strchr(bits, ':');
-                               if( gateway ) {
-                                       *gateway = '\0';        gateway ++;
-                               }
-                               
-                               // Define route
-                               {
-                                       tVFS_Node       *node = IPStack_Root_FindDir(NULL, ifaceName);
-                                       if( !node ) {
-                                               Log_Warning("IPStack", "Unknown interface '%s' in arg %i", ifaceName, i);
-                                               continue ;
-                                       }
-                                       tInterface      *iface = node->ImplPtr;
-                                       
-                                        int    size = IPStack_GetAddressSize(iface->Type);
-                                       Uint8   netData[size];
-                                       Uint8   gwData[size];
-                                        int    iBits = atoi(bits);
-                                       
-                                       UnHex(netData, size, network);
-                                       if( gateway )
-                                               UnHex(gwData, size, gateway);
-                                       else
-                                               memset(gwData, 0, size);
-                                       
-                                       IPStack_AddRoute(ifaceName, netData, iBits, gwData, 30);
-                               }
-                               
-                               continue;
-                       }
-               }
-       }
-       
        // Initialise loopback interface
        gIP_LoopInterface.Adapter = Adapter_GetByName("lo");
        

UCC git Repository :: git.ucc.asn.au