Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
233 changes: 186 additions & 47 deletions CHANGELOG

Large diffs are not rendered by default.

54 changes: 23 additions & 31 deletions COPYING
Original file line number Diff line number Diff line change
@@ -1,33 +1,25 @@
/*
* Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
* 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,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* 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.
*
* 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>
*
*/
Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
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,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
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.

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.

2 changes: 1 addition & 1 deletion FEATURES
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The focus of the lwIP TCP/IP implementation is to reduce resource usage while st

Main features include:
- Protocols: IP, IPv6, ICMP, ND, MLD, UDP, TCP, IGMP, ARP, PPPoS, PPPoE, 6LowPAN (via IEEE 802.15.4, BLE or ZEP; since v2.1.0)
- DHCP client, stateless DHCPv6 (since v2.1.0), DNS client (incl. mDNS hostname resolver), AutoIP/APIPA (Zeroconf), SNMP agent (v1, v2c, v3 (since v2.1.0), private MIB support & MIB compiler)
- DHCP client, stateless DHCPv6 (since v2.1.0), DNS client (incl. mDNS hostname resolver), AutoIP/APIPA (Zeroconf), ACD (Address Conflict Detection), SNMP agent (v1, v2c, v3 (since v2.1.0), private MIB support & MIB compiler)
- APIs: specialized APIs for enhanced performance & zero copy, optional Berkeley-alike socket API
- Extended features: IP forwarding over multiple network interfaces
- Extended TCP features: congestion control, RTT estimation and fast recovery/fast retransmit, sending SACKs (since v2.1.0), "altcp": nearly transparent TLS for any tcp pcb (since v2.1.0)
Expand Down
19 changes: 5 additions & 14 deletions FILES
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
api/ - The code for the high-level wrapper API. Not needed if
you use the lowel-level call-back/raw API.
contrib/ - lwIP examples, ports, and small apps (formerly http://git.savannah.gnu.org/cgit/lwip/lwip-contrib.git/)
src/ - The source code for the lwIP TCP/IP stack.
doc/ - The documentation for lwIP.
test/ - Some code to test whether the sources do what they should.

apps/ - Higher layer applications that are specifically programmed
with the lwIP low-level raw API.

core/ - The core of the TPC/IP stack; protocol implementations,
memory and buffer management, and the low-level raw API.

include/ - lwIP include files.

netif/ - Generic network interface device drivers are kept here.

For more information on the various subdirectories, check the FILES
file in each directory.
See also the FILES file in each subdirectory.
27 changes: 27 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Portions COPYRIGHT 2016 STMicroelectronics
# Copyright (c) 2001-2004 Swedish Institute of Computer Science, 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, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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.
35 changes: 19 additions & 16 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ FEATURES
multiple network interfaces
* ICMP (Internet Control Message Protocol) for network maintenance and debugging
* IGMP (Internet Group Management Protocol) for multicast traffic management
* MLD (Multicast listener discovery for IPv6). Aims to be compliant with
* MLD (Multicast listener discovery for IPv6). Aims to be compliant with
RFC 2710. No support for MLDv2
* ND (Neighbor discovery and stateless address autoconfiguration for IPv6).
Aims to be compliant with RFC 4861 (Neighbor discovery) and RFC 4862
(Address autoconfiguration)
* DHCP, AutoIP/APIPA (Zeroconf) and (stateless) DHCPv6
* DHCP, AutoIP/APIPA (Zeroconf), ACD (Address Conflict Detection)
and (stateless) DHCPv6
* UDP (User Datagram Protocol) including experimental UDP-lite extensions
* TCP (Transmission Control Protocol) with congestion control, RTT estimation
fast recovery/fast retransmit and sending SACKs
Expand Down Expand Up @@ -63,37 +64,39 @@ help improve lwIP by use of Savannah's interface, Git and the
mailing list. A core team of developers will commit changes to the
Git source tree.

The lwIP TCP/IP stack is maintained in the 'lwip' Git module and
contributions (such as platform ports) are in the 'contrib' Git module.
The lwIP TCP/IP stack is maintained in the 'src' directory and
contributions (such as platform ports and applications) are in
the 'contrib' directory.

See doc/savannah.txt for details on Git server access for users and
developers.

The current Git trees are web-browsable:
http://git.savannah.gnu.org/cgit/lwip.git
http://git.savannah.gnu.org/cgit/lwip/lwip-contrib.git
The current Git tree is web-browsable:
https://git.savannah.gnu.org/cgit/lwip.git

Submit patches and bugs via the lwIP project page:
http://savannah.nongnu.org/projects/lwip/
https://savannah.nongnu.org/projects/lwip/

Continuous integration builds (GCC, clang):
https://travis-ci.org/yarrick/lwip-merged
https://github.com/lwip-tcpip/lwip/actions


DOCUMENTATION

Self documentation of the source code is regularly extracted from the current
Git sources and is available from this web page:
http://www.nongnu.org/lwip/

There is now a constantly growing wiki about lwIP at
http://lwip.wikia.com/wiki/LwIP_Wiki
https://www.nongnu.org/lwip/

Also, there are mailing lists you can subscribe at
http://savannah.nongnu.org/mail/?group=lwip
https://savannah.nongnu.org/mail/?group=lwip
plus searchable archives:
http://lists.nongnu.org/archive/html/lwip-users/
http://lists.nongnu.org/archive/html/lwip-devel/
https://lists.nongnu.org/archive/html/lwip-users/
https://lists.nongnu.org/archive/html/lwip-devel/

There is a wiki about lwIP at
https://lwip.wikia.com/wiki/LwIP_Wiki
You might get questions answered there, but unfortunately, it is not as
well maintained as it should be.

lwIP was originally written by Adam Dunkels:
http://dunkels.com/adam/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

## Version

This library is based on the LwIP stack modified by ST: [stm32_mw_lwip](https://github.com/STMicroelectronics/stm32_mw_lwip) version [v2.1.3_230818](https://github.com/STMicroelectronics/stm32_mw_lwip/releases/tag/v2.1.3_230818).
This library is based on the LwIP stack modified by ST: [stm32_mw_lwip](https://github.com/STMicroelectronics/stm32_mw_lwip) version [v2.2.0_20250106](https://github.com/STMicroelectronics/stm32_mw_lwip/releases/tag/v2.2.0_20250106).
11 changes: 11 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ with newer versions.
(git master)

* [Enter new changes just after this line - do not remove this line]
* The eth_addr_cmp and ip_addr_cmp set of functions have been renamed to eth_addr_eq, ip_addr_eq
and so on, since they return non-zero on equality. Macros for the old names exist.
* The sio_write function used by PPP now takes the data argument as const.
* The prev field in the snmp_varbind struct has been removed.

(2.2.0)

++ Repository changes:

* The contrib repository has been added into the main repository in the subdirectory 'contrib'
(the old contrib repository remains online for reference but is not used any more)

(2.1.0)

Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=STM32duino LwIP
version=2.1.3
version=2.2.0
author=Adam Dunkels <adam@sics.se>
maintainer=See url
sentence=A Lightweight TCP/IP stack
Expand Down
4 changes: 2 additions & 2 deletions src/api/api_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ netconn_bind(struct netconn *conn, const ip_addr_t *addr, u16_t port)
* and NETCONN_FLAG_IPV6_V6ONLY is 0, use IP_ANY_TYPE to bind
*/
if ((netconn_get_ipv6only(conn) == 0) &&
ip_addr_cmp(addr, IP6_ADDR_ANY)) {
ip_addr_eq(addr, IP6_ADDR_ANY)) {
addr = IP_ANY_TYPE;
}
#endif /* LWIP_IPV4 && LWIP_IPV6 */
Expand Down Expand Up @@ -1260,13 +1260,13 @@ netconn_join_leave_group_netif(struct netconn *conn,
*
* @param name a string representation of the DNS host name to query
* @param addr a preallocated ip_addr_t where to store the resolved IP address
* @param dns_addrtype IP address type (IPv4 / IPv6)
* @return ERR_OK: resolving succeeded
* ERR_MEM: memory error, try again later
* ERR_ARG: dns client not initialized or invalid hostname
* ERR_VAL: dns server response was invalid
*/
#if LWIP_IPV4 && LWIP_IPV6
/** @param dns_addrtype IP address type (IPv4 / IPv6) */
err_t
netconn_gethostbyname_addrtype(const char *name, ip_addr_t *addr, u8_t dns_addrtype)
#else
Expand Down
25 changes: 13 additions & 12 deletions src/api/api_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static void netconn_drain(struct netconn *conn);
#endif /* LWIP_TCPIP_CORE_LOCKING */

#if LWIP_NETCONN_FULLDUPLEX
const u8_t netconn_deleted = 0;
static const u8_t netconn_deleted = 0;

int
lwip_netconn_is_deallocated_msg(void *msg)
Expand All @@ -106,9 +106,9 @@ lwip_netconn_is_deallocated_msg(void *msg)
#endif /* LWIP_NETCONN_FULLDUPLEX */

#if LWIP_TCP
const u8_t netconn_aborted = 0;
const u8_t netconn_reset = 0;
const u8_t netconn_closed = 0;
static const u8_t netconn_aborted = 0;
static const u8_t netconn_reset = 0;
static const u8_t netconn_closed = 0;

/** Translate an error to a unique void* passed via an mbox */
static void *
Expand Down Expand Up @@ -221,6 +221,7 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
struct netbuf *buf;
struct netconn *conn;
u16_t len;
err_t err;
#if LWIP_SO_RCVBUF
int recv_avail;
#endif /* LWIP_SO_RCVBUF */
Expand Down Expand Up @@ -269,8 +270,10 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
}

len = p->tot_len;
if (sys_mbox_trypost(&conn->recvmbox, buf) != ERR_OK) {
err = sys_mbox_trypost(&conn->recvmbox, buf);
if (err != ERR_OK) {
netbuf_delete(buf);
LWIP_DEBUGF(API_MSG_DEBUG, ("recv_udp: sys_mbox_trypost failed, err=%d\n", err));
return;
} else {
#if LWIP_SO_RCVBUF
Expand Down Expand Up @@ -469,7 +472,7 @@ err_tcp(void *arg, err_t err)
}
/* pass error message to acceptmbox to wake up pending accept */
if (NETCONN_MBOX_VALID(conn, &conn->acceptmbox)) {
/* use trypost to preven deadlock */
/* use trypost to prevent deadlock */
sys_mbox_trypost(&conn->acceptmbox, mbox_msg);
}

Expand All @@ -492,7 +495,7 @@ err_tcp(void *arg, err_t err)
conn->current_msg->err = err;
}
op_completed_sem = LWIP_API_MSG_SEM(conn->current_msg);
LWIP_ASSERT("inavlid op_completed_sem", sys_sem_valid(op_completed_sem));
LWIP_ASSERT("invalid op_completed_sem", sys_sem_valid(op_completed_sem));
conn->current_msg = NULL;
/* wake up the waiting task */
sys_sem_signal(op_completed_sem);
Expand Down Expand Up @@ -759,10 +762,8 @@ netconn_alloc(enum netconn_type t, netconn_callback callback)
sys_mbox_set_invalid(&conn->acceptmbox);
#endif
conn->state = NETCONN_NONE;
#if LWIP_SOCKET
/* initialize socket to -1 since 0 is a valid socket */
conn->socket = -1;
#endif /* LWIP_SOCKET */
conn->callback_arg.socket = -1;
conn->callback = callback;
#if LWIP_TCP
conn->current_msg = NULL;
Expand Down Expand Up @@ -978,7 +979,7 @@ lwip_netconn_do_close_internal(struct netconn *conn WRITE_DELAYED_PARAM)
/* Try to close the connection */
if (shut_close) {
#if LWIP_SO_LINGER
/* check linger possibilites before calling tcp_close */
/* check linger possibilities before calling tcp_close */
err = ERR_OK;
/* linger enabled/required at all? (i.e. is there untransmitted data left?) */
if ((conn->linger >= 0) && (conn->pcb.tcp->unsent || conn->pcb.tcp->unacked)) {
Expand Down Expand Up @@ -1472,7 +1473,7 @@ lwip_netconn_do_listen(void *m)
/* "Socket API like" dual-stack support: If IP to listen to is IP6_ADDR_ANY,
* and NETCONN_FLAG_IPV6_V6ONLY is NOT set, use IP_ANY_TYPE to listen
*/
if (ip_addr_cmp(&msg->conn->pcb.ip->local_ip, IP6_ADDR_ANY) &&
if (ip_addr_eq(&msg->conn->pcb.ip->local_ip, IP6_ADDR_ANY) &&
(netconn_get_ipv6only(msg->conn) == 0)) {
/* change PCB type to IPADDR_TYPE_ANY */
IP_SET_TYPE_VAL(msg->conn->pcb.tcp->local_ip, IPADDR_TYPE_ANY);
Expand Down
2 changes: 1 addition & 1 deletion src/api/if_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ lwip_if_indextoname(unsigned int ifindex, char *ifname)

/**
* @ingroup if_api
* Returs the interface index corresponding to name ifname.
* Returns the interface index corresponding to name ifname.
* @param ifname Interface name
* @return The corresponding index if ifname is the name of an interface;
* otherwise, zero.
Expand Down
4 changes: 2 additions & 2 deletions src/api/netbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* @defgroup netbuf Network buffers
* @ingroup netconn
* Network buffer descriptor for @ref netconn. Based on @ref pbuf internally
* to avoid copying data around.\n
* Buffers must not be shared accross multiple threads, all functions except
* to avoid copying data around.<br>
* Buffers must not be shared across multiple threads, all functions except
* netbuf_new() and netbuf_delete() are not thread-safe.
*/

Expand Down
Loading