Added gitignore rules
[tpg/acess2.git] / Modules / IPStack / interface.c
index 6538078..14c3ed3 100644 (file)
@@ -144,28 +144,6 @@ tVFS_Node *IPStack_Root_FindDir(tVFS_Node *Node, const char *Name)
                return &gIP_LoopInterface.Node;
        }
        
-       #if 0
-       i = 0;  num = 0;
-       while('0' <= Name[i] && Name[i] <= '9')
-       {
-               num *= 10;
-               num += Name[i] - '0';
-               i ++;
-       }
-       if(Name[i] != '\0') {
-               LEAVE('n');
-               return NULL;
-       }
-       
-       for( iface = gIP_Interfaces; iface; iface = iface->Next )
-       {
-               if( (int)iface->Node.ImplInt == num )
-               {
-                       LEAVE('p', &iface->Node);
-                       return &iface->Node;
-               }
-       }
-       #else
        for( iface = gIP_Interfaces; iface; iface = iface->Next )
        {
                if( strcmp(iface->Name, Name) == 0 )
@@ -174,7 +152,6 @@ tVFS_Node *IPStack_Root_FindDir(tVFS_Node *Node, const char *Name)
                        return &iface->Node;
                }
        }
-       #endif
        
        LEAVE('p', NULL);
        return NULL;
@@ -238,6 +215,7 @@ tInterface *IPStack_AddInterface(const char *Device, const char *Name)
                + IPStack_GetAddressSize(-1)*3  // Address, Route->Network, Route->NextHop
                );
        if(!iface) {
+               Log_Warning("IPStack", "AddInterface - malloc() failed");
                LEAVE('n');
                return NULL;    // Return ERR_MYBAD
        }
@@ -266,12 +244,7 @@ tInterface *IPStack_AddInterface(const char *Device, const char *Name)
        iface->TimeoutDelay = DEFAULT_TIMEOUT;
        
        // Get adapter handle
-       iface->Adapter = IPStack_GetAdapter(Device);
-       if( !iface->Adapter ) {
-               free( iface );
-               LEAVE('n');
-               return NULL;    // Return ERR_YOUFAIL
-       }
+       iface->Adapter = card;
        
        // Delay setting ImplInt until after the adapter is opened
        // Keeps things simple
@@ -554,6 +527,7 @@ tAdapter *IPStack_GetAdapter(const char *Path)
        // Ok, so let's open it
        dev = malloc( sizeof(tAdapter) + strlen(Path) + 1 );
        if(!dev) {
+               Log_Warning("IPStack", "GetAdapter - malloc() failed");
                Mutex_Release( &glIP_Adapters );
                LEAVE('n');
                return NULL;
@@ -577,7 +551,7 @@ tAdapter *IPStack_GetAdapter(const char *Path)
        tmp = VFS_IOCtl(dev->DeviceFD, 0, NULL);
        LOG("Device type = %i", tmp);
        if( tmp != DRV_TYPE_NETWORK ) {
-               Warning("IPStack_GetAdapter: '%s' is not a network interface", dev->Device);
+               Log_Warning("IPStack", "IPStack_GetAdapter: '%s' is not a network interface", dev->Device);
                VFS_Close( dev->DeviceFD );
                free( dev );
                Mutex_Release( &glIP_Adapters );

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