mirror of
https://github.com/reactos/reactos.git
synced 2024-06-27 16:31:30 +00:00
[0.4.13][IP][TCPIP][LWIP] Backports 2023-08-13 (also fixes a BSOD)
0.4.15-dev-6399-gf8a6542b15
[IP] Don't reference uninitialized PCB to avoid BSOD. CORE-18982 0.4.15-dev-6395-g2010a5b8d9
[IP] Unlock Connection when TCPAllocatePort() fails. CORE-18371 0.4.15-dev-5707-g874d317a71
[IP] Allow 0xFFFF as Valid Network Port Number (#5074) CORE-18371 CORE-18764 PARTIALLY pick 0.4.14-dev-1326-g792b64ea46
[TCPIP][FORMATTING] Format TiDispatch function. No functional changes (#2112) and strip some EOL-whitespace. Just to make sure that the binary sizes did not increase: tcpip.sys master GCC8.4.0dbg RosBEWin2.2.2 462.848 tcpip.sys 0.4.14 GCC4.7.2dbg RosBEWin2.1.6 425.984 -> 425.984 tcpip.sys 0.4.13 GCC4.7.2dbg RosBEWin2.1.6 417.792 -> 417.792 tcpip.sys 0.4.12 GCC4.7.2dbg RosBEWin2.1.6 421.888 -> 421.888 tcpip.sys 0.4.11 GCC4.7.2dbg RosBEWin2.1.6 421.888 -> 421.888 tcpip.sys 0.4.10 GCC4.7.2dbg RosBEWin2.1.6 413.696 -> 413.696 tcpip.sys 0.4. 9 GCC4.7.2dbg RosBEWin2.1.6 413.696 -> 413.696 tcpip.sys 0.4. 8 GCC4.7.2dbg RosBEWin2.1.6 413.696 -> 413.696 tcpip.sys 0.4. 7 GCC4.7.2dbg RosBEWin2.1.6 413.696 -> 413.696
This commit is contained in:
parent
4a6b865483
commit
b743b450cd
|
@ -122,9 +122,9 @@ GetPacketTypeFromHeaderBuffer(PLAN_ADAPTER Adapter,
|
||||||
/* FIXME: Support other medias */
|
/* FIXME: Support other medias */
|
||||||
return NDIS_STATUS_NOT_ACCEPTED;
|
return NDIS_STATUS_NOT_ACCEPTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_DATALINK, ("EtherType (0x%X).\n", *PacketType));
|
TI_DbgPrint(DEBUG_DATALINK, ("EtherType (0x%X).\n", *PacketType));
|
||||||
|
|
||||||
return NDIS_STATUS_SUCCESS;
|
return NDIS_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,13 +137,13 @@ GetPacketTypeFromNdisPacket(PLAN_ADAPTER Adapter,
|
||||||
PVOID HeaderBuffer;
|
PVOID HeaderBuffer;
|
||||||
ULONG BytesCopied;
|
ULONG BytesCopied;
|
||||||
NDIS_STATUS Status;
|
NDIS_STATUS Status;
|
||||||
|
|
||||||
HeaderBuffer = ExAllocatePoolWithTag(NonPagedPool,
|
HeaderBuffer = ExAllocatePoolWithTag(NonPagedPool,
|
||||||
Adapter->HeaderSize,
|
Adapter->HeaderSize,
|
||||||
HEADER_TAG);
|
HEADER_TAG);
|
||||||
if (!HeaderBuffer)
|
if (!HeaderBuffer)
|
||||||
return NDIS_STATUS_RESOURCES;
|
return NDIS_STATUS_RESOURCES;
|
||||||
|
|
||||||
/* Copy the media header */
|
/* Copy the media header */
|
||||||
BytesCopied = CopyPacketToBuffer(HeaderBuffer,
|
BytesCopied = CopyPacketToBuffer(HeaderBuffer,
|
||||||
NdisPacket,
|
NdisPacket,
|
||||||
|
@ -161,9 +161,9 @@ GetPacketTypeFromNdisPacket(PLAN_ADAPTER Adapter,
|
||||||
HeaderBuffer,
|
HeaderBuffer,
|
||||||
BytesCopied,
|
BytesCopied,
|
||||||
PacketType);
|
PacketType);
|
||||||
|
|
||||||
ExFreePoolWithTag(HeaderBuffer, HEADER_TAG);
|
ExFreePoolWithTag(HeaderBuffer, HEADER_TAG);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -583,26 +583,26 @@ BOOLEAN ReadIpConfiguration(PIP_INTERFACE Interface)
|
||||||
ULONG Unused;
|
ULONG Unused;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
IP_ADDRESS DefaultMask, Router;
|
IP_ADDRESS DefaultMask, Router;
|
||||||
|
|
||||||
AddrInitIPv4(&DefaultMask, 0);
|
AddrInitIPv4(&DefaultMask, 0);
|
||||||
|
|
||||||
TcpipRegistryPath.MaximumLength = sizeof(WCHAR) * 150;
|
TcpipRegistryPath.MaximumLength = sizeof(WCHAR) * 150;
|
||||||
TcpipRegistryPath.Length = 0;
|
TcpipRegistryPath.Length = 0;
|
||||||
TcpipRegistryPath.Buffer = Buffer;
|
TcpipRegistryPath.Buffer = Buffer;
|
||||||
|
|
||||||
/* Build the registry path */
|
/* Build the registry path */
|
||||||
RtlAppendUnicodeStringToString(&TcpipRegistryPath, &Prefix);
|
RtlAppendUnicodeStringToString(&TcpipRegistryPath, &Prefix);
|
||||||
RtlAppendUnicodeStringToString(&TcpipRegistryPath, &Interface->Name);
|
RtlAppendUnicodeStringToString(&TcpipRegistryPath, &Interface->Name);
|
||||||
|
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
InitializeObjectAttributes(&ObjectAttributes,
|
||||||
&TcpipRegistryPath,
|
&TcpipRegistryPath,
|
||||||
OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
|
OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
|
||||||
0,
|
0,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/* Open a handle to the adapter parameters */
|
/* Open a handle to the adapter parameters */
|
||||||
Status = ZwOpenKey(&ParameterHandle, KEY_READ, &ObjectAttributes);
|
Status = ZwOpenKey(&ParameterHandle, KEY_READ, &ObjectAttributes);
|
||||||
|
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -680,7 +680,7 @@ BOOLEAN ReadIpConfiguration(PIP_INTERFACE Interface)
|
||||||
if (!AddrIsUnspecified(&Interface->Unicast) &&
|
if (!AddrIsUnspecified(&Interface->Unicast) &&
|
||||||
!AddrIsUnspecified(&Interface->Netmask))
|
!AddrIsUnspecified(&Interface->Netmask))
|
||||||
IPAddInterfaceRoute(Interface);
|
IPAddInterfaceRoute(Interface);
|
||||||
|
|
||||||
/* Read default gateway info */
|
/* Read default gateway info */
|
||||||
Status = ZwQueryValueKey(ParameterHandle,
|
Status = ZwQueryValueKey(ParameterHandle,
|
||||||
&Gateway,
|
&Gateway,
|
||||||
|
@ -740,14 +740,14 @@ BOOLEAN ReconfigureAdapter(PRECONFIGURE_CONTEXT Context)
|
||||||
Interface->Unicast = DefaultMask;
|
Interface->Unicast = DefaultMask;
|
||||||
Interface->Netmask = DefaultMask;
|
Interface->Netmask = DefaultMask;
|
||||||
Interface->Broadcast = DefaultMask;
|
Interface->Broadcast = DefaultMask;
|
||||||
|
|
||||||
/* Remove all interface routes */
|
/* Remove all interface routes */
|
||||||
RouterRemoveRoutesForInterface(Interface);
|
RouterRemoveRoutesForInterface(Interface);
|
||||||
|
|
||||||
/* Destroy all cached neighbors */
|
/* Destroy all cached neighbors */
|
||||||
NBDestroyNeighborsForInterface(Interface);
|
NBDestroyNeighborsForInterface(Interface);
|
||||||
}
|
}
|
||||||
|
|
||||||
Context->Adapter->CompletingReset = FALSE;
|
Context->Adapter->CompletingReset = FALSE;
|
||||||
|
|
||||||
/* Update the IP and link status information cached in TCP */
|
/* Update the IP and link status information cached in TCP */
|
||||||
|
@ -760,7 +760,7 @@ BOOLEAN ReconfigureAdapter(PRECONFIGURE_CONTEXT Context)
|
||||||
Adapter->State = Context->State;
|
Adapter->State = Context->State;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NDIS Bug! */
|
/* NDIS Bug! */
|
||||||
#if 0
|
#if 0
|
||||||
/* Get maximum link speed */
|
/* Get maximum link speed */
|
||||||
|
@ -769,12 +769,12 @@ BOOLEAN ReconfigureAdapter(PRECONFIGURE_CONTEXT Context)
|
||||||
OID_GEN_LINK_SPEED,
|
OID_GEN_LINK_SPEED,
|
||||||
&Interface->Speed,
|
&Interface->Speed,
|
||||||
sizeof(UINT));
|
sizeof(UINT));
|
||||||
|
|
||||||
if (!NT_SUCCESS(NdisStatus))
|
if (!NT_SUCCESS(NdisStatus))
|
||||||
Interface->Speed = IP_DEFAULT_LINK_SPEED;
|
Interface->Speed = IP_DEFAULT_LINK_SPEED;
|
||||||
|
|
||||||
Adapter->Speed = Interface->Speed * 100L;
|
Adapter->Speed = Interface->Speed * 100L;
|
||||||
|
|
||||||
/* Get maximum frame size */
|
/* Get maximum frame size */
|
||||||
NdisStatus = NDISCall(Adapter,
|
NdisStatus = NDISCall(Adapter,
|
||||||
NdisRequestQueryInformation,
|
NdisRequestQueryInformation,
|
||||||
|
@ -783,9 +783,9 @@ BOOLEAN ReconfigureAdapter(PRECONFIGURE_CONTEXT Context)
|
||||||
sizeof(UINT));
|
sizeof(UINT));
|
||||||
if (NdisStatus != NDIS_STATUS_SUCCESS)
|
if (NdisStatus != NDIS_STATUS_SUCCESS)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
Interface->MTU = Adapter->MTU;
|
Interface->MTU = Adapter->MTU;
|
||||||
|
|
||||||
/* Get maximum packet size */
|
/* Get maximum packet size */
|
||||||
NdisStatus = NDISCall(Adapter,
|
NdisStatus = NDISCall(Adapter,
|
||||||
NdisRequestQueryInformation,
|
NdisRequestQueryInformation,
|
||||||
|
@ -797,17 +797,17 @@ BOOLEAN ReconfigureAdapter(PRECONFIGURE_CONTEXT Context)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Adapter->State = Context->State;
|
Adapter->State = Context->State;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID ReconfigureAdapterWorker(PVOID Context)
|
VOID ReconfigureAdapterWorker(PVOID Context)
|
||||||
{
|
{
|
||||||
PRECONFIGURE_CONTEXT ReconfigureContext = Context;
|
PRECONFIGURE_CONTEXT ReconfigureContext = Context;
|
||||||
|
|
||||||
/* Complete the reconfiguration asynchronously */
|
/* Complete the reconfiguration asynchronously */
|
||||||
ReconfigureAdapter(ReconfigureContext);
|
ReconfigureAdapter(ReconfigureContext);
|
||||||
|
|
||||||
/* Free the context */
|
/* Free the context */
|
||||||
ExFreePool(ReconfigureContext);
|
ExFreePool(ReconfigureContext);
|
||||||
}
|
}
|
||||||
|
@ -834,11 +834,11 @@ VOID NTAPI ProtocolStatus(
|
||||||
/* Ignore the status indication if we have no context yet. We'll get another later */
|
/* Ignore the status indication if we have no context yet. We'll get another later */
|
||||||
if (!Adapter->Context)
|
if (!Adapter->Context)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Context = ExAllocatePoolWithTag(NonPagedPool, sizeof(RECONFIGURE_CONTEXT), CONTEXT_TAG);
|
Context = ExAllocatePoolWithTag(NonPagedPool, sizeof(RECONFIGURE_CONTEXT), CONTEXT_TAG);
|
||||||
if (!Context)
|
if (!Context)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Context->Adapter = Adapter;
|
Context->Adapter = Adapter;
|
||||||
|
|
||||||
switch(GeneralStatus)
|
switch(GeneralStatus)
|
||||||
|
@ -854,16 +854,16 @@ VOID NTAPI ProtocolStatus(
|
||||||
|
|
||||||
Context->State = LAN_STATE_STARTED;
|
Context->State = LAN_STATE_STARTED;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NDIS_STATUS_MEDIA_DISCONNECT:
|
case NDIS_STATUS_MEDIA_DISCONNECT:
|
||||||
DbgPrint("NDIS_STATUS_MEDIA_DISCONNECT\n");
|
DbgPrint("NDIS_STATUS_MEDIA_DISCONNECT\n");
|
||||||
|
|
||||||
if (Adapter->State == LAN_STATE_STOPPED)
|
if (Adapter->State == LAN_STATE_STOPPED)
|
||||||
{
|
{
|
||||||
ExFreePoolWithTag(Context, CONTEXT_TAG);
|
ExFreePoolWithTag(Context, CONTEXT_TAG);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Context->State = LAN_STATE_STOPPED;
|
Context->State = LAN_STATE_STOPPED;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -945,7 +945,7 @@ VOID NTAPI ProtocolBindAdapter(
|
||||||
* SystemSpecific1: Pointer to a registry path with protocol-specific configuration information
|
* SystemSpecific1: Pointer to a registry path with protocol-specific configuration information
|
||||||
* SystemSpecific2: Unused & must not be touched
|
* SystemSpecific2: Unused & must not be touched
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
TI_DbgPrint(DEBUG_DATALINK, ("Called with registry path %wZ for %wZ\n", SystemSpecific1, DeviceName));
|
TI_DbgPrint(DEBUG_DATALINK, ("Called with registry path %wZ for %wZ\n", SystemSpecific1, DeviceName));
|
||||||
*Status = LANRegisterAdapter(DeviceName, SystemSpecific1);
|
*Status = LANRegisterAdapter(DeviceName, SystemSpecific1);
|
||||||
}
|
}
|
||||||
|
@ -1377,19 +1377,19 @@ BOOLEAN BindAdapter(
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_DATALINK,("Adapter Description: %wZ\n",
|
TI_DbgPrint(DEBUG_DATALINK,("Adapter Description: %wZ\n",
|
||||||
&IF->Description));
|
&IF->Description));
|
||||||
|
|
||||||
/* Get maximum link speed */
|
/* Get maximum link speed */
|
||||||
NdisStatus = NDISCall(Adapter,
|
NdisStatus = NDISCall(Adapter,
|
||||||
NdisRequestQueryInformation,
|
NdisRequestQueryInformation,
|
||||||
OID_GEN_LINK_SPEED,
|
OID_GEN_LINK_SPEED,
|
||||||
&IF->Speed,
|
&IF->Speed,
|
||||||
sizeof(UINT));
|
sizeof(UINT));
|
||||||
|
|
||||||
if (!NT_SUCCESS(NdisStatus))
|
if (!NT_SUCCESS(NdisStatus))
|
||||||
IF->Speed = IP_DEFAULT_LINK_SPEED;
|
IF->Speed = IP_DEFAULT_LINK_SPEED;
|
||||||
|
|
||||||
Adapter->Speed = IF->Speed * 100L;
|
Adapter->Speed = IF->Speed * 100L;
|
||||||
|
|
||||||
/* Get maximum frame size */
|
/* Get maximum frame size */
|
||||||
NdisStatus = NDISCall(Adapter,
|
NdisStatus = NDISCall(Adapter,
|
||||||
NdisRequestQueryInformation,
|
NdisRequestQueryInformation,
|
||||||
|
@ -1398,9 +1398,9 @@ BOOLEAN BindAdapter(
|
||||||
sizeof(UINT));
|
sizeof(UINT));
|
||||||
if (NdisStatus != NDIS_STATUS_SUCCESS)
|
if (NdisStatus != NDIS_STATUS_SUCCESS)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
IF->MTU = Adapter->MTU;
|
IF->MTU = Adapter->MTU;
|
||||||
|
|
||||||
/* Get maximum packet size */
|
/* Get maximum packet size */
|
||||||
NdisStatus = NDISCall(Adapter,
|
NdisStatus = NDISCall(Adapter,
|
||||||
NdisRequestQueryInformation,
|
NdisRequestQueryInformation,
|
||||||
|
@ -1646,7 +1646,7 @@ NDIS_STATUS LANUnregisterAdapter(
|
||||||
return NdisStatus;
|
return NdisStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
LANUnregisterProtocol(VOID)
|
LANUnregisterProtocol(VOID)
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -396,6 +396,7 @@ NTSTATUS FileOpenAddress(
|
||||||
PVOID Options)
|
PVOID Options)
|
||||||
{
|
{
|
||||||
PADDRESS_FILE AddrFile;
|
PADDRESS_FILE AddrFile;
|
||||||
|
UINT AllocatedPort;
|
||||||
|
|
||||||
TI_DbgPrint(MID_TRACE, ("Called (Proto %d).\n", Protocol));
|
TI_DbgPrint(MID_TRACE, ("Called (Proto %d).\n", Protocol));
|
||||||
|
|
||||||
|
@ -464,14 +465,15 @@ NTSTATUS FileOpenAddress(
|
||||||
if (Address->Address[0].Address[0].sin_port)
|
if (Address->Address[0].Address[0].sin_port)
|
||||||
{
|
{
|
||||||
/* The client specified an explicit port so we force a bind to this */
|
/* The client specified an explicit port so we force a bind to this */
|
||||||
AddrFile->Port = TCPAllocatePort(Address->Address[0].Address[0].sin_port);
|
AllocatedPort = TCPAllocatePort(Address->Address[0].Address[0].sin_port);
|
||||||
|
|
||||||
/* Check for bind success */
|
/* Check for bind success */
|
||||||
if (AddrFile->Port == 0xffff)
|
if (AllocatedPort == (UINT)-1)
|
||||||
{
|
{
|
||||||
ExFreePoolWithTag(AddrFile, ADDR_FILE_TAG);
|
ExFreePoolWithTag(AddrFile, ADDR_FILE_TAG);
|
||||||
return STATUS_ADDRESS_ALREADY_EXISTS;
|
return STATUS_ADDRESS_ALREADY_EXISTS;
|
||||||
}
|
}
|
||||||
|
AddrFile->Port = AllocatedPort;
|
||||||
|
|
||||||
/* Sanity check */
|
/* Sanity check */
|
||||||
ASSERT(Address->Address[0].Address[0].sin_port == AddrFile->Port);
|
ASSERT(Address->Address[0].Address[0].sin_port == AddrFile->Port);
|
||||||
|
@ -479,14 +481,15 @@ NTSTATUS FileOpenAddress(
|
||||||
else if (!AddrIsUnspecified(&AddrFile->Address))
|
else if (!AddrIsUnspecified(&AddrFile->Address))
|
||||||
{
|
{
|
||||||
/* The client is trying to bind to a local address so allocate a port now too */
|
/* The client is trying to bind to a local address so allocate a port now too */
|
||||||
AddrFile->Port = TCPAllocatePort(0);
|
AllocatedPort = TCPAllocatePort(0);
|
||||||
|
|
||||||
/* Check for bind success */
|
/* Check for bind success */
|
||||||
if (AddrFile->Port == 0xffff)
|
if (AllocatedPort == (UINT)-1)
|
||||||
{
|
{
|
||||||
ExFreePoolWithTag(AddrFile, ADDR_FILE_TAG);
|
ExFreePoolWithTag(AddrFile, ADDR_FILE_TAG);
|
||||||
return STATUS_ADDRESS_ALREADY_EXISTS;
|
return STATUS_ADDRESS_ALREADY_EXISTS;
|
||||||
}
|
}
|
||||||
|
AddrFile->Port = AllocatedPort;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -501,16 +504,16 @@ NTSTATUS FileOpenAddress(
|
||||||
|
|
||||||
case IPPROTO_UDP:
|
case IPPROTO_UDP:
|
||||||
TI_DbgPrint(MID_TRACE,("Allocating udp port\n"));
|
TI_DbgPrint(MID_TRACE,("Allocating udp port\n"));
|
||||||
AddrFile->Port =
|
AllocatedPort = UDPAllocatePort(Address->Address[0].Address[0].sin_port);
|
||||||
UDPAllocatePort(Address->Address[0].Address[0].sin_port);
|
|
||||||
|
|
||||||
if ((Address->Address[0].Address[0].sin_port &&
|
if ((Address->Address[0].Address[0].sin_port &&
|
||||||
AddrFile->Port != Address->Address[0].Address[0].sin_port) ||
|
AllocatedPort != Address->Address[0].Address[0].sin_port) ||
|
||||||
AddrFile->Port == 0xffff)
|
AllocatedPort == (UINT)-1)
|
||||||
{
|
{
|
||||||
ExFreePoolWithTag(AddrFile, ADDR_FILE_TAG);
|
ExFreePoolWithTag(AddrFile, ADDR_FILE_TAG);
|
||||||
return STATUS_ADDRESS_ALREADY_EXISTS;
|
return STATUS_ADDRESS_ALREADY_EXISTS;
|
||||||
}
|
}
|
||||||
|
AddrFile->Port = AllocatedPort;
|
||||||
|
|
||||||
TI_DbgPrint(MID_TRACE,("Setting port %d (wanted %d)\n",
|
TI_DbgPrint(MID_TRACE,("Setting port %d (wanted %d)\n",
|
||||||
AddrFile->Port,
|
AddrFile->Port,
|
||||||
|
|
|
@ -143,7 +143,7 @@ TDI_STATUS InfoTdiSetArptableMIB(PIP_INTERFACE IF, PVOID Buffer, UINT BufferSize
|
||||||
|
|
||||||
if ((NCE = NBLocateNeighbor(&Address, IF)))
|
if ((NCE = NBLocateNeighbor(&Address, IF)))
|
||||||
NBRemoveNeighbor(NCE);
|
NBRemoveNeighbor(NCE);
|
||||||
|
|
||||||
if (NBAddNeighbor(IF,
|
if (NBAddNeighbor(IF,
|
||||||
&Address,
|
&Address,
|
||||||
ArpEntry->PhysAddr,
|
ArpEntry->PhysAddr,
|
||||||
|
|
|
@ -473,10 +473,6 @@ TiDispatchInternal(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS NTAPI
|
|
||||||
TiDispatch(
|
|
||||||
PDEVICE_OBJECT DeviceObject,
|
|
||||||
PIRP Irp)
|
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Dispatch routine for IRP_MJ_DEVICE_CONTROL requests
|
* FUNCTION: Dispatch routine for IRP_MJ_DEVICE_CONTROL requests
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -485,11 +481,15 @@ TiDispatch(
|
||||||
* RETURNS:
|
* RETURNS:
|
||||||
* Status of the operation
|
* Status of the operation
|
||||||
*/
|
*/
|
||||||
|
NTSTATUS NTAPI
|
||||||
|
TiDispatch(
|
||||||
|
PDEVICE_OBJECT DeviceObject,
|
||||||
|
PIRP Irp)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PIO_STACK_LOCATION IrpSp;
|
PIO_STACK_LOCATION IrpSp;
|
||||||
|
|
||||||
IrpSp = IoGetCurrentIrpStackLocation(Irp);
|
IrpSp = IoGetCurrentIrpStackLocation(Irp);
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_IRP, ("[TCPIP, TiDispatch] Called. IRP is at (0x%X).\n", Irp));
|
TI_DbgPrint(DEBUG_IRP, ("[TCPIP, TiDispatch] Called. IRP is at (0x%X).\n", Irp));
|
||||||
|
|
||||||
|
@ -541,7 +541,7 @@ TiDispatch(
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_IRP, ("[TCPIP, TiDispatch] Leaving. Status = (0x%X).\n", Status));
|
TI_DbgPrint(DEBUG_IRP, ("[TCPIP, TiDispatch] Leaving. Status = (0x%X).\n", Status));
|
||||||
|
|
||||||
return IRPFinish( Irp, Status );
|
return IRPFinish(Irp, Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -303,7 +303,7 @@ VOID ProcessFragment(
|
||||||
TI_DbgPrint(DEBUG_IP, ("Continueing assembly.\n"));
|
TI_DbgPrint(DEBUG_IP, ("Continueing assembly.\n"));
|
||||||
/* We have a reassembly structure */
|
/* We have a reassembly structure */
|
||||||
TcpipAcquireSpinLock(&IPDR->Lock, &OldIrql);
|
TcpipAcquireSpinLock(&IPDR->Lock, &OldIrql);
|
||||||
|
|
||||||
/* Reset the timeout since we received a fragment */
|
/* Reset the timeout since we received a fragment */
|
||||||
IPDR->TimeoutCount = 0;
|
IPDR->TimeoutCount = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -454,7 +454,7 @@ VOID ProcessFragment(
|
||||||
Assemble the datagram and pass it to an upper layer protocol */
|
Assemble the datagram and pass it to an upper layer protocol */
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_IP, ("Complete datagram received.\n"));
|
TI_DbgPrint(DEBUG_IP, ("Complete datagram received.\n"));
|
||||||
|
|
||||||
RemoveIPDR(IPDR);
|
RemoveIPDR(IPDR);
|
||||||
TcpipReleaseSpinLock(&IPDR->Lock, OldIrql);
|
TcpipReleaseSpinLock(&IPDR->Lock, OldIrql);
|
||||||
|
|
||||||
|
@ -539,7 +539,7 @@ VOID IPDatagramReassemblyTimeout(
|
||||||
TcpipReleaseSpinLockFromDpcLevel(&CurrentIPDR->Lock);
|
TcpipReleaseSpinLockFromDpcLevel(&CurrentIPDR->Lock);
|
||||||
RemoveEntryList(CurrentEntry);
|
RemoveEntryList(CurrentEntry);
|
||||||
FreeIPDR(CurrentIPDR);
|
FreeIPDR(CurrentIPDR);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ASSERT(CurrentIPDR->TimeoutCount < MAX_TIMEOUT_COUNT);
|
ASSERT(CurrentIPDR->TimeoutCount < MAX_TIMEOUT_COUNT);
|
||||||
|
@ -562,9 +562,9 @@ VOID IPv4Receive(PIP_INTERFACE IF, PIP_PACKET IPPacket)
|
||||||
{
|
{
|
||||||
UCHAR FirstByte;
|
UCHAR FirstByte;
|
||||||
ULONG BytesCopied;
|
ULONG BytesCopied;
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_IP, ("Received IPv4 datagram.\n"));
|
TI_DbgPrint(DEBUG_IP, ("Received IPv4 datagram.\n"));
|
||||||
|
|
||||||
/* Read in the first IP header byte for size information */
|
/* Read in the first IP header byte for size information */
|
||||||
BytesCopied = CopyPacketToBuffer((PCHAR)&FirstByte,
|
BytesCopied = CopyPacketToBuffer((PCHAR)&FirstByte,
|
||||||
IPPacket->NdisPacket,
|
IPPacket->NdisPacket,
|
||||||
|
@ -623,7 +623,7 @@ VOID IPv4Receive(PIP_INTERFACE IF, PIP_PACKET IPPacket)
|
||||||
|
|
||||||
AddrInitIPv4(&IPPacket->SrcAddr, ((PIPv4_HEADER)IPPacket->Header)->SrcAddr);
|
AddrInitIPv4(&IPPacket->SrcAddr, ((PIPv4_HEADER)IPPacket->Header)->SrcAddr);
|
||||||
AddrInitIPv4(&IPPacket->DstAddr, ((PIPv4_HEADER)IPPacket->Header)->DstAddr);
|
AddrInitIPv4(&IPPacket->DstAddr, ((PIPv4_HEADER)IPPacket->Header)->DstAddr);
|
||||||
|
|
||||||
TI_DbgPrint(MID_TRACE,("IPPacket->Position = %d\n",
|
TI_DbgPrint(MID_TRACE,("IPPacket->Position = %d\n",
|
||||||
IPPacket->Position));
|
IPPacket->Position));
|
||||||
|
|
||||||
|
|
|
@ -22,23 +22,23 @@ NTSTATUS TCPCheckPeerForAccept(PVOID Context,
|
||||||
PTDI_CONNECTION_INFORMATION WhoIsConnecting;
|
PTDI_CONNECTION_INFORMATION WhoIsConnecting;
|
||||||
PTA_IP_ADDRESS RemoteAddress;
|
PTA_IP_ADDRESS RemoteAddress;
|
||||||
struct ip_addr ipaddr;
|
struct ip_addr ipaddr;
|
||||||
|
|
||||||
if (Request->RequestFlags & TDI_QUERY_ACCEPT)
|
if (Request->RequestFlags & TDI_QUERY_ACCEPT)
|
||||||
DbgPrint("TDI_QUERY_ACCEPT NOT SUPPORTED!!!\n");
|
DbgPrint("TDI_QUERY_ACCEPT NOT SUPPORTED!!!\n");
|
||||||
|
|
||||||
WhoIsConnecting = (PTDI_CONNECTION_INFORMATION)Request->ReturnConnectionInformation;
|
WhoIsConnecting = (PTDI_CONNECTION_INFORMATION)Request->ReturnConnectionInformation;
|
||||||
RemoteAddress = (PTA_IP_ADDRESS)WhoIsConnecting->RemoteAddress;
|
RemoteAddress = (PTA_IP_ADDRESS)WhoIsConnecting->RemoteAddress;
|
||||||
|
|
||||||
RemoteAddress->TAAddressCount = 1;
|
RemoteAddress->TAAddressCount = 1;
|
||||||
RemoteAddress->Address[0].AddressLength = TDI_ADDRESS_LENGTH_IP;
|
RemoteAddress->Address[0].AddressLength = TDI_ADDRESS_LENGTH_IP;
|
||||||
RemoteAddress->Address[0].AddressType = TDI_ADDRESS_TYPE_IP;
|
RemoteAddress->Address[0].AddressType = TDI_ADDRESS_TYPE_IP;
|
||||||
|
|
||||||
Status = TCPTranslateError(LibTCPGetPeerName(newpcb,
|
Status = TCPTranslateError(LibTCPGetPeerName(newpcb,
|
||||||
&ipaddr,
|
&ipaddr,
|
||||||
&RemoteAddress->Address[0].Address[0].sin_port));
|
&RemoteAddress->Address[0].Address[0].sin_port));
|
||||||
|
|
||||||
RemoteAddress->Address[0].Address[0].in_addr = ipaddr.addr;
|
RemoteAddress->Address[0].Address[0].in_addr = ipaddr.addr;
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ NTSTATUS TCPListen(PCONNECTION_ENDPOINT Connection, UINT Backlog)
|
||||||
|
|
||||||
TI_DbgPrint(DEBUG_TCP, ("Connection->SocketContext %x\n",
|
TI_DbgPrint(DEBUG_TCP, ("Connection->SocketContext %x\n",
|
||||||
Connection->SocketContext));
|
Connection->SocketContext));
|
||||||
|
|
||||||
AddressToBind.addr = Connection->AddressFile->Address.Address.IPv4Address;
|
AddressToBind.addr = Connection->AddressFile->Address.Address.IPv4Address;
|
||||||
|
|
||||||
Status = TCPTranslateError(LibTCPBind(Connection,
|
Status = TCPTranslateError(LibTCPBind(Connection,
|
||||||
|
@ -78,10 +78,14 @@ NTSTATUS TCPListen(PCONNECTION_ENDPOINT Connection, UINT Backlog)
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* Allocate the port in the port bitmap */
|
/* Allocate the port in the port bitmap */
|
||||||
Connection->AddressFile->Port = TCPAllocatePort(LocalAddress.Address[0].Address[0].sin_port);
|
UINT AllocatedPort = TCPAllocatePort(LocalAddress.Address[0].Address[0].sin_port);
|
||||||
|
/* This should never fail unless all ports are in use */
|
||||||
/* This should never fail */
|
if (AllocatedPort == (UINT) -1)
|
||||||
ASSERT(Connection->AddressFile->Port != 0xFFFF);
|
{
|
||||||
|
UnlockObject(Connection, OldIrql);
|
||||||
|
return STATUS_TOO_MANY_ADDRESSES;
|
||||||
|
}
|
||||||
|
Connection->AddressFile->Port = AllocatedPort;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,7 +150,7 @@ NTSTATUS TCPAccept ( PTDI_REQUEST Request,
|
||||||
LockObject(Listener, &OldIrql);
|
LockObject(Listener, &OldIrql);
|
||||||
|
|
||||||
Bucket = ExAllocateFromNPagedLookasideList(&TdiBucketLookasideList);
|
Bucket = ExAllocateFromNPagedLookasideList(&TdiBucketLookasideList);
|
||||||
|
|
||||||
if (Bucket)
|
if (Bucket)
|
||||||
{
|
{
|
||||||
Bucket->AssociatedEndpoint = Connection;
|
Bucket->AssociatedEndpoint = Connection;
|
||||||
|
|
|
@ -23,14 +23,14 @@ TCPSendDataCallback(struct netif *netif, struct pbuf *p, struct ip_addr *dest)
|
||||||
if (((*(u8_t*)p->payload) & 0xF0) == 0x40)
|
if (((*(u8_t*)p->payload) & 0xF0) == 0x40)
|
||||||
{
|
{
|
||||||
Header = p->payload;
|
Header = p->payload;
|
||||||
|
|
||||||
LocalAddress.Type = IP_ADDRESS_V4;
|
LocalAddress.Type = IP_ADDRESS_V4;
|
||||||
LocalAddress.Address.IPv4Address = Header->SrcAddr;
|
LocalAddress.Address.IPv4Address = Header->SrcAddr;
|
||||||
|
|
||||||
RemoteAddress.Type = IP_ADDRESS_V4;
|
RemoteAddress.Type = IP_ADDRESS_V4;
|
||||||
RemoteAddress.Address.IPv4Address = Header->DstAddr;
|
RemoteAddress.Address.IPv4Address = Header->DstAddr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return ERR_IF;
|
return ERR_IF;
|
||||||
}
|
}
|
||||||
|
@ -96,20 +96,20 @@ err_t
|
||||||
TCPInterfaceInit(struct netif *netif)
|
TCPInterfaceInit(struct netif *netif)
|
||||||
{
|
{
|
||||||
PIP_INTERFACE IF = netif->state;
|
PIP_INTERFACE IF = netif->state;
|
||||||
|
|
||||||
netif->hwaddr_len = IF->AddressLength;
|
netif->hwaddr_len = IF->AddressLength;
|
||||||
RtlCopyMemory(netif->hwaddr, IF->Address, netif->hwaddr_len);
|
RtlCopyMemory(netif->hwaddr, IF->Address, netif->hwaddr_len);
|
||||||
|
|
||||||
netif->output = TCPSendDataCallback;
|
netif->output = TCPSendDataCallback;
|
||||||
netif->mtu = IF->MTU;
|
netif->mtu = IF->MTU;
|
||||||
|
|
||||||
netif->name[0] = 'e';
|
netif->name[0] = 'e';
|
||||||
netif->name[1] = 'n';
|
netif->name[1] = 'n';
|
||||||
|
|
||||||
netif->flags |= NETIF_FLAG_BROADCAST;
|
netif->flags |= NETIF_FLAG_BROADCAST;
|
||||||
|
|
||||||
TCPUpdateInterfaceLinkStatus(IF);
|
TCPUpdateInterfaceLinkStatus(IF);
|
||||||
|
|
||||||
TCPUpdateInterfaceIPInformation(IF);
|
TCPUpdateInterfaceIPInformation(IF);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -121,12 +121,12 @@ TCPRegisterInterface(PIP_INTERFACE IF)
|
||||||
struct ip_addr ipaddr;
|
struct ip_addr ipaddr;
|
||||||
struct ip_addr netmask;
|
struct ip_addr netmask;
|
||||||
struct ip_addr gw;
|
struct ip_addr gw;
|
||||||
|
|
||||||
gw.addr = 0;
|
gw.addr = 0;
|
||||||
ipaddr.addr = 0;
|
ipaddr.addr = 0;
|
||||||
netmask.addr = 0;
|
netmask.addr = 0;
|
||||||
|
|
||||||
IF->TCPContext = netif_add(IF->TCPContext,
|
IF->TCPContext = netif_add(IF->TCPContext,
|
||||||
&ipaddr,
|
&ipaddr,
|
||||||
&netmask,
|
&netmask,
|
||||||
&gw,
|
&gw,
|
||||||
|
@ -147,19 +147,19 @@ TCPUpdateInterfaceIPInformation(PIP_INTERFACE IF)
|
||||||
struct ip_addr ipaddr;
|
struct ip_addr ipaddr;
|
||||||
struct ip_addr netmask;
|
struct ip_addr netmask;
|
||||||
struct ip_addr gw;
|
struct ip_addr gw;
|
||||||
|
|
||||||
gw.addr = 0;
|
gw.addr = 0;
|
||||||
|
|
||||||
GetInterfaceIPv4Address(IF,
|
GetInterfaceIPv4Address(IF,
|
||||||
ADE_UNICAST,
|
ADE_UNICAST,
|
||||||
(PULONG)&ipaddr.addr);
|
(PULONG)&ipaddr.addr);
|
||||||
|
|
||||||
GetInterfaceIPv4Address(IF,
|
GetInterfaceIPv4Address(IF,
|
||||||
ADE_ADDRMASK,
|
ADE_ADDRMASK,
|
||||||
(PULONG)&netmask.addr);
|
(PULONG)&netmask.addr);
|
||||||
|
|
||||||
netif_set_addr(IF->TCPContext, &ipaddr, &netmask, &gw);
|
netif_set_addr(IF->TCPContext, &ipaddr, &netmask, &gw);
|
||||||
|
|
||||||
if (ipaddr.addr != 0)
|
if (ipaddr.addr != 0)
|
||||||
{
|
{
|
||||||
netif_set_up(IF->TCPContext);
|
netif_set_up(IF->TCPContext);
|
||||||
|
@ -169,4 +169,4 @@ TCPUpdateInterfaceIPInformation(PIP_INTERFACE IF)
|
||||||
{
|
{
|
||||||
netif_set_down(IF->TCPContext);
|
netif_set_down(IF->TCPContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,7 +189,7 @@ NTSTATUS TCPStartup(VOID)
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Status = PortsStartup( &TCPPorts, 1, 0xfffe );
|
Status = PortsStartup(&TCPPorts, 1, 0xffff);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -342,15 +342,21 @@ NTSTATUS TCPConnect
|
||||||
/* Check if we had an unspecified port */
|
/* Check if we had an unspecified port */
|
||||||
if (!Connection->AddressFile->Port)
|
if (!Connection->AddressFile->Port)
|
||||||
{
|
{
|
||||||
|
UINT AllocatedPort;
|
||||||
|
|
||||||
/* We did, so we need to copy back the port */
|
/* We did, so we need to copy back the port */
|
||||||
Status = TCPGetSockAddress(Connection, (PTRANSPORT_ADDRESS)&LocalAddress, FALSE);
|
Status = TCPGetSockAddress(Connection, (PTRANSPORT_ADDRESS)&LocalAddress, FALSE);
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* Allocate the port in the port bitmap */
|
/* Allocate the port in the port bitmap */
|
||||||
Connection->AddressFile->Port = TCPAllocatePort(LocalAddress.Address[0].Address[0].sin_port);
|
AllocatedPort = TCPAllocatePort(LocalAddress.Address[0].Address[0].sin_port);
|
||||||
|
/* This should never fail unless all ports are in use */
|
||||||
/* This should never fail */
|
if (AllocatedPort == (UINT) -1)
|
||||||
ASSERT(Connection->AddressFile->Port != 0xFFFF);
|
{
|
||||||
|
UnlockObject(Connection, OldIrql);;
|
||||||
|
return STATUS_TOO_MANY_ADDRESSES;
|
||||||
|
}
|
||||||
|
Connection->AddressFile->Port = AllocatedPort;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,6 +379,11 @@ NTSTATUS TCPConnect
|
||||||
Status = TCPTranslateError(LibTCPConnect(Connection,
|
Status = TCPTranslateError(LibTCPConnect(Connection,
|
||||||
&connaddr,
|
&connaddr,
|
||||||
RemotePort));
|
RemotePort));
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
RemoveEntryList(&Bucket->Entry);
|
||||||
|
ExFreeToNPagedLookasideList(&TdiBucketLookasideList, Bucket);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -197,14 +197,14 @@ static void
|
||||||
dhcp_handle_nak(struct netif *netif)
|
dhcp_handle_nak(struct netif *netif)
|
||||||
{
|
{
|
||||||
struct dhcp *dhcp = netif->dhcp;
|
struct dhcp *dhcp = netif->dhcp;
|
||||||
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_handle_nak(netif=%p) %c%c%"U16_F"\n",
|
LWIP_DEBUGF(DHCP_DEBUG | LWIP_DBG_TRACE, ("dhcp_handle_nak(netif=%p) %c%c%"U16_F"\n",
|
||||||
(void*)netif, netif->name[0], netif->name[1], (u16_t)netif->num));
|
(void*)netif, netif->name[0], netif->name[1], (u16_t)netif->num));
|
||||||
/* Set the interface down since the address must no longer be used, as per RFC2131 */
|
/* Set the interface down since the address must no longer be used, as per RFC2131 */
|
||||||
netif_set_down(netif);
|
netif_set_down(netif);
|
||||||
/* remove IP address from interface */
|
/* remove IP address from interface */
|
||||||
netif_set_ipaddr(netif, IP_ADDR_ANY);
|
netif_set_ipaddr(netif, IP_ADDR_ANY);
|
||||||
netif_set_gw(netif, IP_ADDR_ANY);
|
netif_set_gw(netif, IP_ADDR_ANY);
|
||||||
netif_set_netmask(netif, IP_ADDR_ANY);
|
netif_set_netmask(netif, IP_ADDR_ANY);
|
||||||
/* Change to a defined state */
|
/* Change to a defined state */
|
||||||
dhcp_set_state(dhcp, DHCP_BACKING_OFF);
|
dhcp_set_state(dhcp, DHCP_BACKING_OFF);
|
||||||
/* We can immediately restart discovery */
|
/* We can immediately restart discovery */
|
||||||
|
@ -373,7 +373,7 @@ dhcp_fine_tmr()
|
||||||
while (netif != NULL) {
|
while (netif != NULL) {
|
||||||
/* only act on DHCP configured interfaces */
|
/* only act on DHCP configured interfaces */
|
||||||
if (netif->dhcp != NULL) {
|
if (netif->dhcp != NULL) {
|
||||||
/* timer is active (non zero), and is about to trigger now */
|
/* timer is active (non zero), and is about to trigger now */
|
||||||
if (netif->dhcp->request_timeout > 1) {
|
if (netif->dhcp->request_timeout > 1) {
|
||||||
netif->dhcp->request_timeout--;
|
netif->dhcp->request_timeout--;
|
||||||
}
|
}
|
||||||
|
@ -564,7 +564,7 @@ dhcp_handle_ack(struct netif *netif)
|
||||||
if (dhcp_option_given(dhcp, DHCP_OPTION_IDX_ROUTER)) {
|
if (dhcp_option_given(dhcp, DHCP_OPTION_IDX_ROUTER)) {
|
||||||
ip4_addr_set_u32(&dhcp->offered_gw_addr, htonl(dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_ROUTER)));
|
ip4_addr_set_u32(&dhcp->offered_gw_addr, htonl(dhcp_get_option_value(dhcp, DHCP_OPTION_IDX_ROUTER)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LWIP_DNS
|
#if LWIP_DNS
|
||||||
/* DNS servers */
|
/* DNS servers */
|
||||||
n = 0;
|
n = 0;
|
||||||
|
@ -670,7 +670,7 @@ dhcp_start(struct netif *netif)
|
||||||
LWIP_ASSERT("pbuf p_out wasn't freed", dhcp->p_out == NULL);
|
LWIP_ASSERT("pbuf p_out wasn't freed", dhcp->p_out == NULL);
|
||||||
LWIP_ASSERT("reply wasn't freed", dhcp->msg_in == NULL );
|
LWIP_ASSERT("reply wasn't freed", dhcp->msg_in == NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clear data structure */
|
/* clear data structure */
|
||||||
memset(dhcp, 0, sizeof(struct dhcp));
|
memset(dhcp, 0, sizeof(struct dhcp));
|
||||||
/* dhcp_set_state(&dhcp, DHCP_OFF); */
|
/* dhcp_set_state(&dhcp, DHCP_OFF); */
|
||||||
|
@ -1183,7 +1183,7 @@ dhcp_release(struct netif *netif)
|
||||||
ip_addr_set_zero(&dhcp->offered_si_addr);
|
ip_addr_set_zero(&dhcp->offered_si_addr);
|
||||||
#endif /* LWIP_DHCP_BOOTP_FILE */
|
#endif /* LWIP_DHCP_BOOTP_FILE */
|
||||||
dhcp->offered_t0_lease = dhcp->offered_t1_renew = dhcp->offered_t2_rebind = 0;
|
dhcp->offered_t0_lease = dhcp->offered_t1_renew = dhcp->offered_t2_rebind = 0;
|
||||||
|
|
||||||
/* create and initialize the DHCP message header */
|
/* create and initialize the DHCP message header */
|
||||||
result = dhcp_create_msg(netif, dhcp, DHCP_RELEASE);
|
result = dhcp_create_msg(netif, dhcp, DHCP_RELEASE);
|
||||||
if (result == ERR_OK) {
|
if (result == ERR_OK) {
|
||||||
|
@ -1207,7 +1207,7 @@ dhcp_release(struct netif *netif)
|
||||||
netif_set_ipaddr(netif, IP_ADDR_ANY);
|
netif_set_ipaddr(netif, IP_ADDR_ANY);
|
||||||
netif_set_gw(netif, IP_ADDR_ANY);
|
netif_set_gw(netif, IP_ADDR_ANY);
|
||||||
netif_set_netmask(netif, IP_ADDR_ANY);
|
netif_set_netmask(netif, IP_ADDR_ANY);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,9 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without modification,
|
* Redistribution and use in source and binary forms, with or without modification,
|
||||||
* are permitted provided that the following conditions are met:
|
* are permitted provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice,
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
@ -17,21 +17,21 @@
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
* 3. The name of the author may not be used to endorse or promote products
|
* 3. The name of the author may not be used to endorse or promote products
|
||||||
* derived from this software without specific prior written permission.
|
* derived from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||||
* OF SUCH DAMAGE.
|
* OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* This file is part of the lwIP TCP/IP stack.
|
* This file is part of the lwIP TCP/IP stack.
|
||||||
*
|
*
|
||||||
* Author: Adam Dunkels <adam@sics.se>
|
* Author: Adam Dunkels <adam@sics.se>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -188,7 +188,7 @@
|
||||||
#if NETCONN_MORE != TCP_WRITE_FLAG_MORE
|
#if NETCONN_MORE != TCP_WRITE_FLAG_MORE
|
||||||
#error "NETCONN_MORE != TCP_WRITE_FLAG_MORE"
|
#error "NETCONN_MORE != TCP_WRITE_FLAG_MORE"
|
||||||
#endif
|
#endif
|
||||||
#endif /* LWIP_NETCONN && LWIP_TCP */
|
#endif /* LWIP_NETCONN && LWIP_TCP */
|
||||||
#if LWIP_SOCKET
|
#if LWIP_SOCKET
|
||||||
/* Check that the SO_* socket options and SOF_* lwIP-internal flags match */
|
/* Check that the SO_* socket options and SOF_* lwIP-internal flags match */
|
||||||
#if SO_ACCEPTCONN != SOF_ACCEPTCONN
|
#if SO_ACCEPTCONN != SOF_ACCEPTCONN
|
||||||
|
|
Loading…
Reference in a new issue