[0.4.11][IP][TCPIP][LWIP] Backports 2023-08-13 (also fixes a BSOD)

0.4.15-dev-6399-g f8a6542b15 [IP] Don't reference uninitialized PCB to avoid BSOD. CORE-18982
0.4.15-dev-6395-g 2010a5b8d9 [IP] Unlock Connection when TCPAllocatePort() fails. CORE-18371
0.4.15-dev-5707-g 874d317a71 [IP] Allow 0xFFFF as Valid Network Port Number (#5074) CORE-18371 CORE-18764
PARTIALLY pick 0.4.14-dev-1326-g 792b64ea46 [TCPIP][FORMATTING] Format TiDispatch function. No functional changes (#2112)
0.4.13-dev-368-g 3a98d96eac [LWIP] Fix src/core/init.c a bit (#1620)

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:
Joachim Henze 2023-08-13 16:29:36 +02:00
parent 7b99293b02
commit cc2f6571df
10 changed files with 132 additions and 117 deletions

View file

@ -122,9 +122,9 @@ GetPacketTypeFromHeaderBuffer(PLAN_ADAPTER Adapter,
/* FIXME: Support other medias */
return NDIS_STATUS_NOT_ACCEPTED;
}
TI_DbgPrint(DEBUG_DATALINK, ("EtherType (0x%X).\n", *PacketType));
return NDIS_STATUS_SUCCESS;
}
@ -137,13 +137,13 @@ GetPacketTypeFromNdisPacket(PLAN_ADAPTER Adapter,
PVOID HeaderBuffer;
ULONG BytesCopied;
NDIS_STATUS Status;
HeaderBuffer = ExAllocatePoolWithTag(NonPagedPool,
Adapter->HeaderSize,
HEADER_TAG);
if (!HeaderBuffer)
return NDIS_STATUS_RESOURCES;
/* Copy the media header */
BytesCopied = CopyPacketToBuffer(HeaderBuffer,
NdisPacket,
@ -161,9 +161,9 @@ GetPacketTypeFromNdisPacket(PLAN_ADAPTER Adapter,
HeaderBuffer,
BytesCopied,
PacketType);
ExFreePoolWithTag(HeaderBuffer, HEADER_TAG);
return Status;
}
@ -583,26 +583,26 @@ BOOLEAN ReadIpConfiguration(PIP_INTERFACE Interface)
ULONG Unused;
NTSTATUS Status;
IP_ADDRESS DefaultMask, Router;
AddrInitIPv4(&DefaultMask, 0);
TcpipRegistryPath.MaximumLength = sizeof(WCHAR) * 150;
TcpipRegistryPath.Length = 0;
TcpipRegistryPath.Buffer = Buffer;
/* Build the registry path */
RtlAppendUnicodeStringToString(&TcpipRegistryPath, &Prefix);
RtlAppendUnicodeStringToString(&TcpipRegistryPath, &Interface->Name);
InitializeObjectAttributes(&ObjectAttributes,
&TcpipRegistryPath,
OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
0,
NULL);
/* Open a handle to the adapter parameters */
Status = ZwOpenKey(&ParameterHandle, KEY_READ, &ObjectAttributes);
if (!NT_SUCCESS(Status))
{
return FALSE;
@ -680,7 +680,7 @@ BOOLEAN ReadIpConfiguration(PIP_INTERFACE Interface)
if (!AddrIsUnspecified(&Interface->Unicast) &&
!AddrIsUnspecified(&Interface->Netmask))
IPAddInterfaceRoute(Interface);
/* Read default gateway info */
Status = ZwQueryValueKey(ParameterHandle,
&Gateway,
@ -740,14 +740,14 @@ BOOLEAN ReconfigureAdapter(PRECONFIGURE_CONTEXT Context)
Interface->Unicast = DefaultMask;
Interface->Netmask = DefaultMask;
Interface->Broadcast = DefaultMask;
/* Remove all interface routes */
RouterRemoveRoutesForInterface(Interface);
/* Destroy all cached neighbors */
NBDestroyNeighborsForInterface(Interface);
}
Context->Adapter->CompletingReset = FALSE;
/* Update the IP and link status information cached in TCP */
@ -760,7 +760,7 @@ BOOLEAN ReconfigureAdapter(PRECONFIGURE_CONTEXT Context)
Adapter->State = Context->State;
return TRUE;
}
/* NDIS Bug! */
#if 0
/* Get maximum link speed */
@ -769,12 +769,12 @@ BOOLEAN ReconfigureAdapter(PRECONFIGURE_CONTEXT Context)
OID_GEN_LINK_SPEED,
&Interface->Speed,
sizeof(UINT));
if (!NT_SUCCESS(NdisStatus))
Interface->Speed = IP_DEFAULT_LINK_SPEED;
Adapter->Speed = Interface->Speed * 100L;
/* Get maximum frame size */
NdisStatus = NDISCall(Adapter,
NdisRequestQueryInformation,
@ -783,9 +783,9 @@ BOOLEAN ReconfigureAdapter(PRECONFIGURE_CONTEXT Context)
sizeof(UINT));
if (NdisStatus != NDIS_STATUS_SUCCESS)
return FALSE;
Interface->MTU = Adapter->MTU;
/* Get maximum packet size */
NdisStatus = NDISCall(Adapter,
NdisRequestQueryInformation,
@ -797,17 +797,17 @@ BOOLEAN ReconfigureAdapter(PRECONFIGURE_CONTEXT Context)
#endif
Adapter->State = Context->State;
return TRUE;
}
VOID ReconfigureAdapterWorker(PVOID Context)
{
PRECONFIGURE_CONTEXT ReconfigureContext = Context;
/* Complete the reconfiguration asynchronously */
ReconfigureAdapter(ReconfigureContext);
/* Free the context */
ExFreePool(ReconfigureContext);
}
@ -834,11 +834,11 @@ VOID NTAPI ProtocolStatus(
/* Ignore the status indication if we have no context yet. We'll get another later */
if (!Adapter->Context)
return;
Context = ExAllocatePoolWithTag(NonPagedPool, sizeof(RECONFIGURE_CONTEXT), CONTEXT_TAG);
if (!Context)
return;
Context->Adapter = Adapter;
switch(GeneralStatus)
@ -854,16 +854,16 @@ VOID NTAPI ProtocolStatus(
Context->State = LAN_STATE_STARTED;
break;
case NDIS_STATUS_MEDIA_DISCONNECT:
DbgPrint("NDIS_STATUS_MEDIA_DISCONNECT\n");
if (Adapter->State == LAN_STATE_STOPPED)
{
ExFreePoolWithTag(Context, CONTEXT_TAG);
return;
}
Context->State = LAN_STATE_STOPPED;
break;
@ -945,7 +945,7 @@ VOID NTAPI ProtocolBindAdapter(
* SystemSpecific1: Pointer to a registry path with protocol-specific configuration information
* SystemSpecific2: Unused & must not be touched
*/
{
{
TI_DbgPrint(DEBUG_DATALINK, ("Called with registry path %wZ for %wZ\n", SystemSpecific1, DeviceName));
*Status = LANRegisterAdapter(DeviceName, SystemSpecific1);
}
@ -1377,19 +1377,19 @@ BOOLEAN BindAdapter(
TI_DbgPrint(DEBUG_DATALINK,("Adapter Description: %wZ\n",
&IF->Description));
/* Get maximum link speed */
NdisStatus = NDISCall(Adapter,
NdisRequestQueryInformation,
OID_GEN_LINK_SPEED,
&IF->Speed,
sizeof(UINT));
if (!NT_SUCCESS(NdisStatus))
IF->Speed = IP_DEFAULT_LINK_SPEED;
Adapter->Speed = IF->Speed * 100L;
/* Get maximum frame size */
NdisStatus = NDISCall(Adapter,
NdisRequestQueryInformation,
@ -1398,9 +1398,9 @@ BOOLEAN BindAdapter(
sizeof(UINT));
if (NdisStatus != NDIS_STATUS_SUCCESS)
return FALSE;
IF->MTU = Adapter->MTU;
/* Get maximum packet size */
NdisStatus = NDISCall(Adapter,
NdisRequestQueryInformation,
@ -1646,7 +1646,7 @@ NDIS_STATUS LANUnregisterAdapter(
return NdisStatus;
}
VOID
VOID
NTAPI
LANUnregisterProtocol(VOID)
/*

View file

@ -392,6 +392,7 @@ NTSTATUS FileOpenAddress(
PVOID Options)
{
PADDRESS_FILE AddrFile;
UINT AllocatedPort;
TI_DbgPrint(MID_TRACE, ("Called (Proto %d).\n", Protocol));
@ -449,14 +450,15 @@ NTSTATUS FileOpenAddress(
if (Address->Address[0].Address[0].sin_port)
{
/* 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 */
if (AddrFile->Port == 0xffff)
if (AllocatedPort == (UINT)-1)
{
ExFreePoolWithTag(AddrFile, ADDR_FILE_TAG);
return STATUS_ADDRESS_ALREADY_EXISTS;
}
AddrFile->Port = AllocatedPort;
/* Sanity check */
ASSERT(Address->Address[0].Address[0].sin_port == AddrFile->Port);
@ -464,14 +466,15 @@ NTSTATUS FileOpenAddress(
else if (!AddrIsUnspecified(&AddrFile->Address))
{
/* 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 */
if (AddrFile->Port == 0xffff)
if (AllocatedPort == (UINT)-1)
{
ExFreePoolWithTag(AddrFile, ADDR_FILE_TAG);
return STATUS_ADDRESS_ALREADY_EXISTS;
}
AddrFile->Port = AllocatedPort;
}
else
{
@ -486,16 +489,16 @@ NTSTATUS FileOpenAddress(
case IPPROTO_UDP:
TI_DbgPrint(MID_TRACE,("Allocating udp port\n"));
AddrFile->Port =
UDPAllocatePort(Address->Address[0].Address[0].sin_port);
AllocatedPort = UDPAllocatePort(Address->Address[0].Address[0].sin_port);
if ((Address->Address[0].Address[0].sin_port &&
AddrFile->Port != Address->Address[0].Address[0].sin_port) ||
AddrFile->Port == 0xffff)
AllocatedPort != Address->Address[0].Address[0].sin_port) ||
AllocatedPort == (UINT)-1)
{
ExFreePoolWithTag(AddrFile, ADDR_FILE_TAG);
return STATUS_ADDRESS_ALREADY_EXISTS;
}
AddrFile->Port = AllocatedPort;
TI_DbgPrint(MID_TRACE,("Setting port %d (wanted %d)\n",
AddrFile->Port,

View file

@ -143,7 +143,7 @@ TDI_STATUS InfoTdiSetArptableMIB(PIP_INTERFACE IF, PVOID Buffer, UINT BufferSize
if ((NCE = NBLocateNeighbor(&Address, IF)))
NBRemoveNeighbor(NCE);
if (NBAddNeighbor(IF,
&Address,
ArpEntry->PhysAddr,

View file

@ -473,10 +473,6 @@ TiDispatchInternal(
}
NTSTATUS NTAPI
TiDispatch(
PDEVICE_OBJECT DeviceObject,
PIRP Irp)
/*
* FUNCTION: Dispatch routine for IRP_MJ_DEVICE_CONTROL requests
* ARGUMENTS:
@ -485,11 +481,15 @@ TiDispatch(
* RETURNS:
* Status of the operation
*/
NTSTATUS NTAPI
TiDispatch(
PDEVICE_OBJECT DeviceObject,
PIRP Irp)
{
NTSTATUS Status;
PIO_STACK_LOCATION IrpSp;
IrpSp = IoGetCurrentIrpStackLocation(Irp);
IrpSp = IoGetCurrentIrpStackLocation(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));
return IRPFinish( Irp, Status );
return IRPFinish(Irp, Status);
}

View file

@ -303,7 +303,7 @@ VOID ProcessFragment(
TI_DbgPrint(DEBUG_IP, ("Continueing assembly.\n"));
/* We have a reassembly structure */
TcpipAcquireSpinLock(&IPDR->Lock, &OldIrql);
/* Reset the timeout since we received a fragment */
IPDR->TimeoutCount = 0;
} else {
@ -454,7 +454,7 @@ VOID ProcessFragment(
Assemble the datagram and pass it to an upper layer protocol */
TI_DbgPrint(DEBUG_IP, ("Complete datagram received.\n"));
RemoveIPDR(IPDR);
TcpipReleaseSpinLock(&IPDR->Lock, OldIrql);
@ -539,7 +539,7 @@ VOID IPDatagramReassemblyTimeout(
TcpipReleaseSpinLockFromDpcLevel(&CurrentIPDR->Lock);
RemoveEntryList(CurrentEntry);
FreeIPDR(CurrentIPDR);
}
}
else
{
ASSERT(CurrentIPDR->TimeoutCount < MAX_TIMEOUT_COUNT);
@ -562,9 +562,9 @@ VOID IPv4Receive(PIP_INTERFACE IF, PIP_PACKET IPPacket)
{
UCHAR FirstByte;
ULONG BytesCopied;
TI_DbgPrint(DEBUG_IP, ("Received IPv4 datagram.\n"));
/* Read in the first IP header byte for size information */
BytesCopied = CopyPacketToBuffer((PCHAR)&FirstByte,
IPPacket->NdisPacket,
@ -623,7 +623,7 @@ VOID IPv4Receive(PIP_INTERFACE IF, PIP_PACKET IPPacket)
AddrInitIPv4(&IPPacket->SrcAddr, ((PIPv4_HEADER)IPPacket->Header)->SrcAddr);
AddrInitIPv4(&IPPacket->DstAddr, ((PIPv4_HEADER)IPPacket->Header)->DstAddr);
TI_DbgPrint(MID_TRACE,("IPPacket->Position = %d\n",
IPPacket->Position));

View file

@ -22,23 +22,23 @@ NTSTATUS TCPCheckPeerForAccept(PVOID Context,
PTDI_CONNECTION_INFORMATION WhoIsConnecting;
PTA_IP_ADDRESS RemoteAddress;
struct ip_addr ipaddr;
if (Request->RequestFlags & TDI_QUERY_ACCEPT)
DbgPrint("TDI_QUERY_ACCEPT NOT SUPPORTED!!!\n");
WhoIsConnecting = (PTDI_CONNECTION_INFORMATION)Request->ReturnConnectionInformation;
RemoteAddress = (PTA_IP_ADDRESS)WhoIsConnecting->RemoteAddress;
RemoteAddress->TAAddressCount = 1;
RemoteAddress->Address[0].AddressLength = TDI_ADDRESS_LENGTH_IP;
RemoteAddress->Address[0].AddressType = TDI_ADDRESS_TYPE_IP;
Status = TCPTranslateError(LibTCPGetPeerName(newpcb,
&ipaddr,
&RemoteAddress->Address[0].Address[0].sin_port));
RemoteAddress->Address[0].Address[0].in_addr = ipaddr.addr;
return Status;
}
@ -61,7 +61,7 @@ NTSTATUS TCPListen(PCONNECTION_ENDPOINT Connection, UINT Backlog)
TI_DbgPrint(DEBUG_TCP, ("Connection->SocketContext %x\n",
Connection->SocketContext));
AddressToBind.addr = Connection->AddressFile->Address.Address.IPv4Address;
Status = TCPTranslateError(LibTCPBind(Connection,
@ -78,10 +78,14 @@ NTSTATUS TCPListen(PCONNECTION_ENDPOINT Connection, UINT Backlog)
if (NT_SUCCESS(Status))
{
/* Allocate the port in the port bitmap */
Connection->AddressFile->Port = TCPAllocatePort(LocalAddress.Address[0].Address[0].sin_port);
/* This should never fail */
ASSERT(Connection->AddressFile->Port != 0xFFFF);
UINT AllocatedPort = TCPAllocatePort(LocalAddress.Address[0].Address[0].sin_port);
/* This should never fail unless all ports are in use */
if (AllocatedPort == (UINT) -1)
{
UnlockObject(Connection, OldIrql);
return STATUS_TOO_MANY_ADDRESSES;
}
Connection->AddressFile->Port = AllocatedPort;
}
}
}
@ -146,7 +150,7 @@ NTSTATUS TCPAccept ( PTDI_REQUEST Request,
LockObject(Listener, &OldIrql);
Bucket = ExAllocateFromNPagedLookasideList(&TdiBucketLookasideList);
if (Bucket)
{
Bucket->AssociatedEndpoint = Connection;

View file

@ -23,14 +23,14 @@ TCPSendDataCallback(struct netif *netif, struct pbuf *p, struct ip_addr *dest)
if (((*(u8_t*)p->payload) & 0xF0) == 0x40)
{
Header = p->payload;
LocalAddress.Type = IP_ADDRESS_V4;
LocalAddress.Address.IPv4Address = Header->SrcAddr;
RemoteAddress.Type = IP_ADDRESS_V4;
RemoteAddress.Address.IPv4Address = Header->DstAddr;
}
else
else
{
return ERR_IF;
}
@ -96,20 +96,20 @@ err_t
TCPInterfaceInit(struct netif *netif)
{
PIP_INTERFACE IF = netif->state;
netif->hwaddr_len = IF->AddressLength;
RtlCopyMemory(netif->hwaddr, IF->Address, netif->hwaddr_len);
netif->output = TCPSendDataCallback;
netif->mtu = IF->MTU;
netif->name[0] = 'e';
netif->name[1] = 'n';
netif->flags |= NETIF_FLAG_BROADCAST;
TCPUpdateInterfaceLinkStatus(IF);
TCPUpdateInterfaceIPInformation(IF);
return 0;
@ -121,12 +121,12 @@ TCPRegisterInterface(PIP_INTERFACE IF)
struct ip_addr ipaddr;
struct ip_addr netmask;
struct ip_addr gw;
gw.addr = 0;
ipaddr.addr = 0;
netmask.addr = 0;
IF->TCPContext = netif_add(IF->TCPContext,
IF->TCPContext = netif_add(IF->TCPContext,
&ipaddr,
&netmask,
&gw,
@ -147,19 +147,19 @@ TCPUpdateInterfaceIPInformation(PIP_INTERFACE IF)
struct ip_addr ipaddr;
struct ip_addr netmask;
struct ip_addr gw;
gw.addr = 0;
GetInterfaceIPv4Address(IF,
ADE_UNICAST,
(PULONG)&ipaddr.addr);
GetInterfaceIPv4Address(IF,
ADE_ADDRMASK,
(PULONG)&netmask.addr);
netif_set_addr(IF->TCPContext, &ipaddr, &netmask, &gw);
if (ipaddr.addr != 0)
{
netif_set_up(IF->TCPContext);
@ -169,4 +169,4 @@ TCPUpdateInterfaceIPInformation(PIP_INTERFACE IF)
{
netif_set_down(IF->TCPContext);
}
}
}

View file

@ -189,7 +189,7 @@ NTSTATUS TCPStartup(VOID)
{
NTSTATUS Status;
Status = PortsStartup( &TCPPorts, 1, 0xfffe );
Status = PortsStartup(&TCPPorts, 1, 0xffff);
if (!NT_SUCCESS(Status))
{
return Status;
@ -342,15 +342,21 @@ NTSTATUS TCPConnect
/* Check if we had an unspecified port */
if (!Connection->AddressFile->Port)
{
UINT AllocatedPort;
/* We did, so we need to copy back the port */
Status = TCPGetSockAddress(Connection, (PTRANSPORT_ADDRESS)&LocalAddress, FALSE);
if (NT_SUCCESS(Status))
{
/* Allocate the port in the port bitmap */
Connection->AddressFile->Port = TCPAllocatePort(LocalAddress.Address[0].Address[0].sin_port);
/* This should never fail */
ASSERT(Connection->AddressFile->Port != 0xFFFF);
AllocatedPort = TCPAllocatePort(LocalAddress.Address[0].Address[0].sin_port);
/* This should never fail unless all ports are in use */
if (AllocatedPort == (UINT) -1)
{
UnlockObject(Connection, OldIrql);;
return STATUS_TOO_MANY_ADDRESSES;
}
Connection->AddressFile->Port = AllocatedPort;
}
}
@ -373,6 +379,11 @@ NTSTATUS TCPConnect
Status = TCPTranslateError(LibTCPConnect(Connection,
&connaddr,
RemotePort));
if (!NT_SUCCESS(Status))
{
RemoveEntryList(&Bucket->Entry);
ExFreeToNPagedLookasideList(&TdiBucketLookasideList, Bucket);
}
}
}

View file

@ -197,14 +197,14 @@ static void
dhcp_handle_nak(struct netif *netif)
{
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));
/* Set the interface down since the address must no longer be used, as per RFC2131 */
netif_set_down(netif);
/* remove IP address from interface */
netif_set_ipaddr(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 */
dhcp_set_state(dhcp, DHCP_BACKING_OFF);
/* We can immediately restart discovery */
@ -373,7 +373,7 @@ dhcp_fine_tmr()
while (netif != NULL) {
/* only act on DHCP configured interfaces */
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) {
netif->dhcp->request_timeout--;
}
@ -564,7 +564,7 @@ dhcp_handle_ack(struct netif *netif)
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)));
}
#if LWIP_DNS
/* DNS servers */
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("reply wasn't freed", dhcp->msg_in == NULL );
}
/* clear data structure */
memset(dhcp, 0, sizeof(struct dhcp));
/* dhcp_set_state(&dhcp, DHCP_OFF); */
@ -1183,7 +1183,7 @@ dhcp_release(struct netif *netif)
ip_addr_set_zero(&dhcp->offered_si_addr);
#endif /* LWIP_DHCP_BOOTP_FILE */
dhcp->offered_t0_lease = dhcp->offered_t1_renew = dhcp->offered_t2_rebind = 0;
/* create and initialize the DHCP message header */
result = dhcp_create_msg(netif, dhcp, DHCP_RELEASE);
if (result == ERR_OK) {
@ -1207,7 +1207,7 @@ dhcp_release(struct netif *netif)
netif_set_ipaddr(netif, IP_ADDR_ANY);
netif_set_gw(netif, IP_ADDR_ANY);
netif_set_netmask(netif, IP_ADDR_ANY);
return result;
}

View file

@ -6,9 +6,9 @@
/*
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 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
* and/or other materials provided with the distribution.
* 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
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* 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
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* 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
* OF SUCH DAMAGE.
*
* This file is part of the lwIP TCP/IP stack.
*
*
* Author: Adam Dunkels <adam@sics.se>
*
*/
@ -70,9 +70,6 @@
#if (!LWIP_UDP && LWIP_UDPLITE)
#error "If you want to use UDP Lite, you have to define LWIP_UDP=1 in your lwipopts.h"
#endif
#if (!LWIP_UDP && LWIP_SNMP)
#error "If you want to use SNMP, you have to define LWIP_UDP=1 in your lwipopts.h"
#endif
#if (!LWIP_UDP && LWIP_DHCP)
#error "If you want to use DHCP, you have to define LWIP_UDP=1 in your lwipopts.h"
#endif
@ -124,7 +121,7 @@
#if (LWIP_TCP && ((TCP_MAXRTX > 12) || (TCP_SYNMAXRTX > 12)))
#error "If you want to use TCP, TCP_MAXRTX and TCP_SYNMAXRTX must less or equal to 12 (due to tcp_backoff table), so, you have to reduce them in your lwipopts.h"
#endif
#if (LWIP_TCP && TCP_LISTEN_BACKLOG && (TCP_DEFAULT_LISTEN_BACKLOG < 0) || (TCP_DEFAULT_LISTEN_BACKLOG > 0xff))
#if (LWIP_TCP && TCP_LISTEN_BACKLOG && ((TCP_DEFAULT_LISTEN_BACKLOG < 0) || (TCP_DEFAULT_LISTEN_BACKLOG > 0xff)))
#error "If you want to use TCP backlog, TCP_DEFAULT_LISTEN_BACKLOG must fit into an u8_t"
#endif
#if (LWIP_NETIF_API && (NO_SYS==1))
@ -166,7 +163,7 @@
#if (DNS_LOCAL_HOSTLIST && !DNS_LOCAL_HOSTLIST_IS_DYNAMIC && !(defined(DNS_LOCAL_HOSTLIST_INIT)))
#error "you have to define define DNS_LOCAL_HOSTLIST_INIT {{'host1', 0x123}, {'host2', 0x234}} to initialize DNS_LOCAL_HOSTLIST"
#endif
#if PPP_SUPPORT && !PPPOS_SUPPORT & !PPPOE_SUPPORT
#if PPP_SUPPORT && !PPPOS_SUPPORT && !PPPOE_SUPPORT
#error "PPP_SUPPORT needs either PPPOS_SUPPORT or PPPOE_SUPPORT turned on"
#endif
#if !LWIP_ETHERNET && (LWIP_ARP || PPPOE_SUPPORT)
@ -191,7 +188,7 @@
#if NETCONN_MORE != TCP_WRITE_FLAG_MORE
#error "NETCONN_MORE != TCP_WRITE_FLAG_MORE"
#endif
#endif /* LWIP_NETCONN && LWIP_TCP */
#endif /* LWIP_NETCONN && LWIP_TCP */
#if LWIP_SOCKET
/* Check that the SO_* socket options and SOF_* lwIP-internal flags match */
#if SO_ACCEPTCONN != SOF_ACCEPTCONN