*/
tVFS_Node *IPStack_Root_FindDir(tVFS_Node *Node, const char *Name)
{
+ #if 0
int i, num;
+ #endif
tInterface *iface;
ENTER("pNode sName", Node, Name);
return &gIP_LoopInterface.Node;
}
+ #if 0
i = 0; num = 0;
while('0' <= Name[i] && Name[i] <= '9')
{
return &iface->Node;
}
}
+ #else
+ for( iface = gIP_Interfaces; iface; iface = iface->Next )
+ {
+ if( strcmp(iface->Name, Name) == 0 )
+ {
+ LEAVE('p', &iface->Node);
+ return &iface->Node;
+ }
+ }
+ #endif
+
LEAVE('p', NULL);
return NULL;
}
card = IPStack_GetAdapter(Device);
- iface = malloc(sizeof(tInterface) + strlen(Name));
+ iface = malloc(sizeof(tInterface) + sprintf(NULL, "%i", giIP_NextIfaceId) + 1);
if(!iface) {
LEAVE('i', -2);
return -2; // Return ERR_MYBAD
// Delay setting ImplInt until after the adapter is opened
// Keeps things simple
iface->Node.ImplInt = giIP_NextIfaceId++;
+ sprintf(iface->Name, "%i", iface->Node.ImplInt);
// Append to list
SHORTLOCK( &glIP_Interfaces );
*/
static const char *casIOCtls_Route[] = {
DRV_IOCTLNAMES,
- "get_network", // Get network - (void *Data)
- "set_network", // Set network - (void *Data)
- "get_nexthop", // Get next hop - (void *Data)
- "set_nexthop", // Set next hop - (void *Data)
- "getset_subnetbits", // Get/Set subnet bits - (int *Bits)
- "getset_metric", // Get/Set metric - (int *Metric)
+ "get_network", // Get network - (void *Data), returns boolean success
+ "set_network", // Set network - (void *Data), returns boolean success
+ "get_nexthop", // Get next hop - (void *Data), returns boolean success
+ "set_nexthop", // Set next hop - (void *Data), returns boolean success
+ "getset_subnetbits", // Get/Set subnet bits - (int *Bits), returns current value
+ "getset_metric", // Get/Set metric - (int *Metric), returns current value
+ "get_interface", // Get interface name - (char *Name), returns name length, NULL OK
NULL
};
}
return rt->Metric;
+ // Get interface name
+ case 10:
+ if( Data ) {
+ if( !CheckMem(Data, strlen(rt->Interface->Name) + 1) )
+ return -1;
+ strcpy(Data, rt->Interface->Name);
+ }
+ return strlen(rt->Interface->Name);
+
default:
return 0;
}