// Routing Subdir
if( Pos == 0 ) {
+ LEAVE('s', "routes");
return strdup("routes");
}
// Pseudo Interfaces
if( Pos == 1 ) {
+ LEAVE('s', "lo");
return strdup("lo");
}
Pos -= 2;
// Routing subdir
if( strcmp(Name, "routes") == 0 ) {
+ LEAVE('p', &gIP_RouteNode);
return &gIP_RouteNode;
}
// Loopback
if( strcmp(Name, "lo") == 0 ) {
+ LEAVE('p', &gIP_LoopInterface.Node);
return &gIP_LoopInterface.Node;
}
case 4:
if( Threads_GetUID() != 0 ) LEAVE_RET('i', -1);
if( !CheckString( Data ) ) LEAVE_RET('i', -1);
+ LOG("New interface for '%s'", Data);
{
char name[4] = "";
tInterface *iface = IPStack_AddInterface(Data, name);
// Set type
iface->Type = *(int*)Data;
+ LOG("Interface type set to %i", iface->Type);
size = IPStack_GetAddressSize(iface->Type);
// Check it's actually valid
if( iface->Type != 0 && size == 0 ) {
size = IPStack_GetAddressSize(iface->Type);
if( !CheckMem( Data, size ) ) LEAVE_RET('i', -1);
// TODO: Protect against trashing
+ LOG("Interface address set to '%s'", IPStack_PrintAddress(iface->Type, Data));
memcpy( iface->Address, Data, size );
- LEAVE('i', 1);
- return 1;
+ LEAVE_RET('i', 1);
/*
* getset_subnet
// Is the mask sane?
if( *(int*)Data < 0 || *(int*)Data > IPStack_GetAddressSize(iface->Type)*8-1 )
LEAVE_RET('i', -1);
-
+ LOG("Set subnet bits to %i", *(int*)Data);
// Ok, set it
iface->SubnetBits = *(int*)Data;
}
- LEAVE('i', iface->SubnetBits);
- return iface->SubnetBits;
+ LEAVE_RET('i', iface->SubnetBits);
/*
* get_device
if( !CheckMem( Data, iface->Adapter->DeviceLen+1 ) )
LEAVE_RET('i', -1);
strcpy( Data, iface->Adapter->Device );
- return iface->Adapter->DeviceLen;
+ LEAVE_RET('i', iface->Adapter->DeviceLen);
/*
* ping
case 4:
if( !CheckMem( Data, sizeof(tIPv4) ) ) LEAVE_RET('i', -1);
tmp = IPv4_Ping(iface, *(tIPv4*)Data);
- LEAVE('i', tmp);
- return tmp;
+ LEAVE_RET('i', tmp);
case 6:
LEAVE_RET('i', 1);