Fix some logic in port management code.
Modified: trunk/reactos/drivers/lib/ip/network/ports.c
_____
Modified: trunk/reactos/drivers/lib/ip/network/ports.c
--- trunk/reactos/drivers/lib/ip/network/ports.c 2005-03-16
20:36:02 UTC (rev 14142)
+++ trunk/reactos/drivers/lib/ip/network/ports.c 2005-03-16
21:03:51 UTC (rev 14143)
@@ -20,8 +20,7 @@
RtlInitializeBitMap( &PortSet->ProtoBitmap,
PortSet->ProtoBitBuffer,
PortSet->PortsToOversee );
- RtlClearBits( &PortSet->ProtoBitmap,
- PortSet->StartingPort, PortsToManage );
+ RtlClearAllBits( &PortSet->ProtoBitmap );
ExInitializeFastMutex( &PortSet->Mutex );
}
@@ -31,14 +30,16 @@
VOID DeallocatePort( PPORT_SET PortSet, ULONG Port ) {
Port = htons(Port);
- RtlClearBits( &PortSet->ProtoBitmap,
- PortSet->StartingPort + Port, 1 );
+ ASSERT(Port >= PortSet->StartingPort);
+ ASSERT(Port < PortSet->StartingPort + PortSet->PortsToOversee);
+ RtlClearBits( &PortSet->ProtoBitmap, Port - PortSet->StartingPort,
1 );
}
BOOLEAN AllocatePort( PPORT_SET PortSet, ULONG Port ) {
BOOLEAN Clear;
Port = htons(Port);
+ ASSERT(Port >= PortSet->StartingPort);
Port -= PortSet->StartingPort;
ExAcquireFastMutex( &PortSet->Mutex );
Show replies by date