- 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);
- if(iface == NULL) LEAVE_RET('i', -1);
- tmp = iface->Node.ImplInt;
- }
+ case 4: {
+ const struct {
+ const char *Device;
+ const char *Name;
+ int Type;
+ } *ifinfo = Data;
+
+ if( Threads_GetUID() != 0 )
+ LEAVE_RET('i', -1);
+ if( !CheckMem(ifinfo, sizeof(*ifinfo)) )
+ LEAVE_RET('i', -1);
+ if( !MM_IsUser(ifinfo->Device) || !CheckString( ifinfo->Device ) )
+ LEAVE_RET('i', -1);
+ if( !MM_IsUser(ifinfo->Name) || !CheckString( ifinfo->Name ) )
+ LEAVE_RET('i', -1);
+
+ LOG("New interface of type %i for '%s' named '%s'",
+ ifinfo->Type, ifinfo->Device, ifinfo->Name);
+ tInterface *iface = IPStack_AddInterface(ifinfo->Device, ifinfo->Type, ifinfo->Name);
+ if(iface == NULL) LEAVE_RET('i', -1);
+
+ tmp = iface->Node.ImplInt;