Author: cgutman Date: Sun Oct 26 23:30:53 2008 New Revision: 37010
URL: http://svn.reactos.org/svn/reactos?rev=37010&view=rev Log: - Fix several port issues - We don't allocate ports out of range anymore - Dhcp doesn't crash when run from the command line anymore
Modified: branches/aicom-network-fixes/lib/drivers/ip/network/ports.c branches/aicom-network-fixes/lib/drivers/ip/transport/udp/udp.c
Modified: branches/aicom-network-fixes/lib/drivers/ip/network/ports.c URL: http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/lib/drivers/... ============================================================================== --- branches/aicom-network-fixes/lib/drivers/ip/network/ports.c [iso-8859-1] (original) +++ branches/aicom-network-fixes/lib/drivers/ip/network/ports.c [iso-8859-1] Sun Oct 26 23:30:53 2008 @@ -44,7 +44,7 @@ Port = htons(Port);
if ((Port < PortSet->StartingPort) || - (Port > PortSet->StartingPort + PortSet->PortsToOversee)) + (Port >= PortSet->StartingPort + PortSet->PortsToOversee)) { return FALSE; } @@ -67,19 +67,19 @@ if( AllocatedPort != (ULONG)-1 ) { RtlSetBit( &PortSet->ProtoBitmap, AllocatedPort ); AllocatedPort += PortSet->StartingPort; + ExReleaseFastMutex( &PortSet->Mutex ); + return htons(AllocatedPort); } ExReleaseFastMutex( &PortSet->Mutex );
- AllocatedPort = htons(AllocatedPort); - - return AllocatedPort; + return -1; }
ULONG AllocatePortFromRange( PPORT_SET PortSet, ULONG Lowest, ULONG Highest ) { ULONG AllocatedPort;
if ((Lowest < PortSet->StartingPort) || - (Highest > PortSet->StartingPort + PortSet->PortsToOversee)) + (Highest >= PortSet->StartingPort + PortSet->PortsToOversee)) { return -1; } @@ -92,10 +92,10 @@ if( AllocatedPort != (ULONG)-1 && AllocatedPort <= Highest) { RtlSetBit( &PortSet->ProtoBitmap, AllocatedPort ); AllocatedPort += PortSet->StartingPort; + ExReleaseFastMutex( &PortSet->Mutex ); + return htons(AllocatedPort); } ExReleaseFastMutex( &PortSet->Mutex );
- AllocatedPort = htons(AllocatedPort); - - return AllocatedPort; + return -1; }
Modified: branches/aicom-network-fixes/lib/drivers/ip/transport/udp/udp.c URL: http://svn.reactos.org/svn/reactos/branches/aicom-network-fixes/lib/drivers/... ============================================================================== --- branches/aicom-network-fixes/lib/drivers/ip/transport/udp/udp.c [iso-8859-1] (original) +++ branches/aicom-network-fixes/lib/drivers/ip/transport/udp/udp.c [iso-8859-1] Sun Oct 26 23:30:53 2008 @@ -311,7 +311,7 @@
NTSTATUS Status;
- Status = PortsStartup( &UDPPorts, 1, 0xfffe ); + Status = PortsStartup( &UDPPorts, 1, UDP_STARTING_PORT + UDP_DYNAMIC_PORTS );
if( !NT_SUCCESS(Status) ) return Status;