Skip to content

Commit 7bbc850

Browse files
author
Mika Leppänen
committed
Squashed 'features/FEATURE_LWIP/lwip-interface/lwip/' changes from 10f93f4..7648b58
git-subtree-dir: features/FEATURE_LWIP/lwip-interface/lwip git-subtree-split: 7648b58d03006bd60b9592f1853c167bf52b0193
1 parent 61a7b15 commit 7bbc850

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+490
-242
lines changed

CHANGELOG

Lines changed: 81 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,91 @@ HISTORY
33
(git master)
44

55
* [Enter new changes just after this line - do not remove this line]
6-
6+
7+
(STABLE-2.0.2)
8+
9+
++ New features:
10+
11+
2017-02-10: Dirk Ziegelmeier
12+
* Implement task #14367: Hooks need a better place to be defined:
13+
We now have a #define for a header file name that is #included in every .c
14+
file that provides hooks.
15+
16+
++ Bugfixes:
17+
18+
2017-03-08
19+
* tcp: do not keep sending SYNs when getting ACKs
20+
21+
2017-03-08: Joel Cunningham
22+
* tcp: Initialize ssthresh to TCP_SND_BUF (bug #50476)
23+
24+
2017-03-01: Simon Goldschmidt
25+
* httpd: LWIP_HTTPD_POST_MANUAL_WND: fixed double-free when httpd_post_data_recved
26+
is called nested from httpd_post_receive_data() (bug #50424)
27+
28+
2017-02-28: David van Moolenbroek/Simon Goldschmidt
29+
* tcp: fixed bug #50418: LWIP_EVENT_API: fix invalid calbacks for SYN_RCVD pcb
30+
31+
2017-02-17: Simon Goldschmidt
32+
* dns: Improved DNS_LOCAL_HOSTLIST interface (bug #50325)
33+
34+
2017-02-16: Simon Goldschmidt
35+
* LWIP_NETCONN_FULLDUPLEX: fixed shutdown during write (bug #50274)
36+
37+
2017-02-13: Simon Goldschmidt/Dirk Ziegelmeier
38+
* For tiny targtes, LWIP_RAND is optional (fix compile time checks)
39+
40+
2017-02-10: Simon Goldschmidt
41+
* tcp: Fixed bug #47485 (tcp_close() should not fail on memory error) by retrying
42+
to send FIN from tcp_fasttmr
43+
44+
2017-02-09: Simon Goldschmidt
45+
* sockets: Fixed bug #44032 (LWIP_NETCONN_FULLDUPLEX: select might work on
46+
invalid/reused socket) by not allowing to reallocate a socket that has
47+
"select_waiting != 0"
48+
49+
2017-02-09: Simon Goldschmidt
50+
* httpd: Fixed bug #50059 (httpd LWIP_HTTPD_SUPPORT_11_KEEPALIVE vs.
51+
LWIP_HTTPD_KILL_OLD_ON_CONNECTIONS_EXCEEDED)
52+
53+
2017-02-08: Dirk Ziegelmeier
54+
* Rename "IPv6 mapped IPv4 addresses" to their correct name from RFC4191:
55+
"IPv4-mapped IPv6 address"
56+
57+
2017-02-08: Luc Revardel
58+
* mld6.c: Fix bug #50220 (mld6_leavegroup does not send ICMP6_TYPE_MLD, even
59+
if last reporter)
60+
61+
2017-02-08: David van Moolenbroek
62+
* ip6.c: Patch #9250: fix source substitution in ip6_output_if()
63+
64+
2017-02-08: Simon Goldschmidt
65+
* tcp_out.c: Fixed bug #50090 (last_unsent->oversize_left can become wrong value
66+
in tcp_write error path)
67+
68+
2017-02-02: Dirk Ziegelmeier
69+
* Fix bug #50206: UDP Netconn bind to IP6_ADDR_ANY fails
70+
71+
2017-01-18: Dirk Ziegelmeier
72+
* Fix zero-copy RX, see bug bug #50064. PBUF_REFs were not supported as ARP requests.
73+
74+
2017-01-15: Axel Lin, Dirk Ziegelmeier
75+
* minor bug fixes in mqtt
76+
77+
2017-01-11: Knut Andre Tidemann
78+
* sockets/netconn: fix broken default ICMPv6 handling of checksums
79+
80+
(STABLE-2.0.1)
81+
782
++ New features:
883

984
2016-12-31: Simon Goldschmidt
1085
* tcp.h/.c: added function tcp_listen_with_backlog_and_err() to get the error
1186
reason when listening fails (bug #49861)
1287

13-
2016-12-20: Erik Andersen
14-
* Add MQTT client
15-
88+
2016-12-20: Erik Andersen
89+
* Add MQTT client
90+
1691
2016-12-14: Jan Breuer:
1792
* opt.h, ndc.h/.c: add support for RDNSS option (as per RFC 6106)
1893

@@ -43,7 +118,7 @@ HISTORY
43118

44119
2016-12-05: Dirk Ziegelmeier
45120
* fixed compiling with IPv4 disabled (IPv6 only case)
46-
121+
47122
2016-11-28: Simon Goldschmidt
48123
* api_lib.c: fixed bug #49725 (send-timeout: netconn_write() can return
49124
ERR_OK without all bytes being written)
@@ -72,7 +147,7 @@ HISTORY
72147
2016-11-11: Dirk Ziegelmeier
73148
* sockets.c: fixed bug #49578 (dropping multicast membership does not work
74149
with LWIP_SOCKET_OFFSET)
75-
150+
76151
(STABLE-2.0.0)
77152

78153
++ New features:

doc/doxygen/lwip.Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PROJECT_NAME = "lwIP"
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER = "2.0.1"
41+
PROJECT_NUMBER = "2.0.2"
4242

4343
# Using the PROJECT_BRIEF tag one can provide an optional one line description
4444
# for a project that appears at the top of each page and should give viewer a

doc/doxygen/main_page.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
* @verbinclude "UPGRADING"
2727
*/
2828

29+
/**
30+
* @page changelog Changelog
31+
* @verbinclude "CHANGELOG"
32+
*/
33+
2934
/**
3035
* @page contrib How to contribute to lwIP
3136
* @verbinclude "contrib.txt"

src/api/lwip_api_msg.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,13 @@ pcb_new(struct api_msg *msg)
562562
case NETCONN_RAW:
563563
msg->conn->pcb.raw = raw_new_ip_type(iptype, msg->msg.n.proto);
564564
if (msg->conn->pcb.raw != NULL) {
565+
#if LWIP_IPV6
566+
/* ICMPv6 packets should always have checksum calculated by the stack as per RFC 3542 chapter 3.1 */
567+
if (NETCONNTYPE_ISIPV6(msg->conn->type) && msg->conn->pcb.raw->protocol == IP6_NEXTH_ICMP6) {
568+
msg->conn->pcb.raw->chksum_reqd = 1;
569+
msg->conn->pcb.raw->chksum_offset = 2;
570+
}
571+
#endif /* LWIP_IPV6 */
565572
raw_recv(msg->conn->pcb.raw, recv_raw, msg->conn);
566573
}
567574
break;
@@ -1777,25 +1784,28 @@ lwip_netconn_do_close(void *m)
17771784
#if LWIP_NETCONN_FULLDUPLEX
17781785
if (msg->msg.sd.shut & NETCONN_SHUT_WR) {
17791786
/* close requested, abort running write */
1780-
sys_sem_t* op_completed_sem;
1787+
sys_sem_t* write_completed_sem;
17811788
LWIP_ASSERT("msg->conn->current_msg != NULL", msg->conn->current_msg != NULL);
1782-
op_completed_sem = LWIP_API_MSG_SEM(msg->conn->current_msg);
1789+
write_completed_sem = LWIP_API_MSG_SEM(msg->conn->current_msg);
17831790
msg->conn->current_msg->err = ERR_CLSD;
17841791
msg->conn->current_msg = NULL;
17851792
msg->conn->write_offset = 0;
17861793
msg->conn->state = NETCONN_NONE;
1794+
state = NETCONN_NONE;
17871795
NETCONN_SET_SAFE_ERR(msg->conn, ERR_CLSD);
1788-
sys_sem_signal(op_completed_sem);
1796+
sys_sem_signal(write_completed_sem);
17891797
} else {
17901798
LWIP_ASSERT("msg->msg.sd.shut == NETCONN_SHUT_RD", msg->msg.sd.shut == NETCONN_SHUT_RD);
17911799
/* In this case, let the write continue and do not interfere with
17921800
conn->current_msg or conn->state! */
17931801
msg->err = tcp_shutdown(msg->conn->pcb.tcp, 1, 0);
17941802
}
1803+
}
1804+
if (state == NETCONN_NONE) {
17951805
#else /* LWIP_NETCONN_FULLDUPLEX */
17961806
msg->err = ERR_INPROGRESS;
1797-
#endif /* LWIP_NETCONN_FULLDUPLEX */
17981807
} else {
1808+
#endif /* LWIP_NETCONN_FULLDUPLEX */
17991809
if (msg->msg.sd.shut & NETCONN_SHUT_RD) {
18001810
/* Drain and delete mboxes */
18011811
netconn_drain(msg->conn);

src/api/lwip_err.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#include "lwip/def.h"
4141
#include "lwip/sys.h"
4242

43-
#include "lwip/errno.h"
43+
#include "lwip/lwip_errno.h"
4444

4545
#if !NO_SYS
4646
/** Table to quickly map an lwIP error (err_t) to a socket error

src/api/lwip_sockets.c

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ alloc_socket(struct netconn *newconn, int accepted)
407407
for (i = 0; i < NUM_SOCKETS; ++i) {
408408
/* Protect socket array */
409409
SYS_ARCH_PROTECT(lev);
410-
if (!sockets[i].conn) {
410+
if (!sockets[i].conn && (sockets[i].select_waiting == 0)) {
411411
sockets[i].conn = newconn;
412412
/* The socket is not yet known to anyone, so no need to protect
413413
after having marked it as used. */
@@ -420,7 +420,6 @@ alloc_socket(struct netconn *newconn, int accepted)
420420
sockets[i].sendevent = (NETCONNTYPE_GROUP(newconn->type) == NETCONN_TCP ? (accepted != 0) : 1);
421421
sockets[i].errevent = 0;
422422
sockets[i].err = 0;
423-
sockets[i].select_waiting = 0;
424423
return i + LWIP_SOCKET_OFFSET;
425424
}
426425
SYS_ARCH_UNPROTECT(lev);
@@ -585,9 +584,9 @@ lwip_bind(int s, const struct sockaddr *name, socklen_t namelen)
585584
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%"U16_F")\n", local_port));
586585

587586
#if LWIP_IPV4 && LWIP_IPV6
588-
/* Dual-stack: Unmap IPv6 mapped IPv4 addresses */
589-
if (IP_IS_V6_VAL(local_addr) && ip6_addr_isipv6mappedipv4(ip_2_ip6(&local_addr))) {
590-
unmap_ipv6_mapped_ipv4(ip_2_ip4(&local_addr), ip_2_ip6(&local_addr));
587+
/* Dual-stack: Unmap IPv4 mapped IPv6 addresses */
588+
if (IP_IS_V6_VAL(local_addr) && ip6_addr_isipv4mappedipv6(ip_2_ip6(&local_addr))) {
589+
unmap_ipv4_mapped_ipv6(ip_2_ip4(&local_addr), ip_2_ip6(&local_addr));
591590
IP_SET_TYPE_VAL(local_addr, IPADDR_TYPE_V4);
592591
}
593592
#endif /* LWIP_IPV4 && LWIP_IPV6 */
@@ -677,9 +676,9 @@ lwip_connect(int s, const struct sockaddr *name, socklen_t namelen)
677676
LWIP_DEBUGF(SOCKETS_DEBUG, (" port=%"U16_F")\n", remote_port));
678677

679678
#if LWIP_IPV4 && LWIP_IPV6
680-
/* Dual-stack: Unmap IPv6 mapped IPv4 addresses */
681-
if (IP_IS_V6_VAL(remote_addr) && ip6_addr_isipv6mappedipv4(ip_2_ip6(&remote_addr))) {
682-
unmap_ipv6_mapped_ipv4(ip_2_ip4(&remote_addr), ip_2_ip6(&remote_addr));
679+
/* Dual-stack: Unmap IPv4 mapped IPv6 addresses */
680+
if (IP_IS_V6_VAL(remote_addr) && ip6_addr_isipv4mappedipv6(ip_2_ip6(&remote_addr))) {
681+
unmap_ipv4_mapped_ipv6(ip_2_ip4(&remote_addr), ip_2_ip6(&remote_addr));
683682
IP_SET_TYPE_VAL(remote_addr, IPADDR_TYPE_V4);
684683
}
685684
#endif /* LWIP_IPV4 && LWIP_IPV6 */
@@ -865,9 +864,9 @@ lwip_recvfrom(int s, void *mem, size_t len, int flags,
865864
}
866865

867866
#if LWIP_IPV4 && LWIP_IPV6
868-
/* Dual-stack: Map IPv4 addresses to IPv6 mapped IPv4 */
867+
/* Dual-stack: Map IPv4 addresses to IPv4 mapped IPv6 */
869868
if (NETCONNTYPE_ISIPV6(netconn_type(sock->conn)) && IP_IS_V4(fromaddr)) {
870-
ip4_2_ipv6_mapped_ipv4(ip_2_ip6(fromaddr), ip_2_ip4(fromaddr));
869+
ip4_2_ipv4_mapped_ipv6(ip_2_ip6(fromaddr), ip_2_ip4(fromaddr));
871870
IP_SET_TYPE(fromaddr, IPADDR_TYPE_V6);
872871
}
873872
#endif /* LWIP_IPV4 && LWIP_IPV6 */
@@ -995,6 +994,10 @@ lwip_sendmsg(int s, const struct msghdr *msg, int flags)
995994
((flags & MSG_DONTWAIT) ? NETCONN_DONTBLOCK : 0);
996995

997996
for (i = 0; i < msg->msg_iovlen; i++) {
997+
u8_t apiflags = write_flags;
998+
if (i + 1 < msg->msg_iovlen) {
999+
apiflags |= NETCONN_MORE;
1000+
}
9981001
written = 0;
9991002
err = netconn_write_partly(sock->conn, msg->msg_iov[i].iov_base, msg->msg_iov[i].iov_len, write_flags, &written);
10001003
if (err == ERR_OK) {
@@ -1092,9 +1095,9 @@ lwip_sendmsg(int s, const struct msghdr *msg, int flags)
10921095

10931096
if (err == ERR_OK) {
10941097
#if LWIP_IPV4 && LWIP_IPV6
1095-
/* Dual-stack: Unmap IPv6 mapped IPv4 addresses */
1096-
if (IP_IS_V6_VAL(chain_buf->addr) && ip6_addr_isipv6mappedipv4(ip_2_ip6(&chain_buf->addr))) {
1097-
unmap_ipv6_mapped_ipv4(ip_2_ip4(&chain_buf->addr), ip_2_ip6(&chain_buf->addr));
1098+
/* Dual-stack: Unmap IPv4 mapped IPv6 addresses */
1099+
if (IP_IS_V6_VAL(chain_buf->addr) && ip6_addr_isipv4mappedipv6(ip_2_ip6(&chain_buf->addr))) {
1100+
unmap_ipv4_mapped_ipv6(ip_2_ip4(&chain_buf->addr), ip_2_ip6(&chain_buf->addr));
10981101
IP_SET_TYPE_VAL(chain_buf->addr, IPADDR_TYPE_V4);
10991102
}
11001103
#endif /* LWIP_IPV4 && LWIP_IPV6 */
@@ -1190,9 +1193,9 @@ lwip_sendto(int s, const void *data, size_t size, int flags,
11901193
#endif /* LWIP_NETIF_TX_SINGLE_PBUF */
11911194
if (err == ERR_OK) {
11921195
#if LWIP_IPV4 && LWIP_IPV6
1193-
/* Dual-stack: Unmap IPv6 mapped IPv4 addresses */
1194-
if (IP_IS_V6_VAL(buf.addr) && ip6_addr_isipv6mappedipv4(ip_2_ip6(&buf.addr))) {
1195-
unmap_ipv6_mapped_ipv4(ip_2_ip4(&buf.addr), ip_2_ip6(&buf.addr));
1196+
/* Dual-stack: Unmap IPv4 mapped IPv6 addresses */
1197+
if (IP_IS_V6_VAL(buf.addr) && ip6_addr_isipv4mappedipv6(ip_2_ip6(&buf.addr))) {
1198+
unmap_ipv4_mapped_ipv6(ip_2_ip4(&buf.addr), ip_2_ip6(&buf.addr));
11961199
IP_SET_TYPE_VAL(buf.addr, IPADDR_TYPE_V4);
11971200
}
11981201
#endif /* LWIP_IPV4 && LWIP_IPV6 */
@@ -1490,9 +1493,7 @@ lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset,
14901493
SYS_ARCH_PROTECT(lev);
14911494
sock = tryget_socket(i);
14921495
if (sock != NULL) {
1493-
/* @todo: what if this is a new socket (reallocated?) in this case,
1494-
select_waiting-- would be wrong (a global 'sockalloc' counter,
1495-
stored per socket could help) */
1496+
/* for now, handle select_waiting==0... */
14961497
LWIP_ASSERT("sock->select_waiting > 0", sock->select_waiting > 0);
14971498
if (sock->select_waiting > 0) {
14981499
sock->select_waiting--;
@@ -1684,8 +1685,7 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
16841685
}
16851686

16861687
/**
1687-
* Unimplemented: Close one end of a full-duplex connection.
1688-
* Currently, the full connection is closed.
1688+
* Close one end of a full-duplex connection.
16891689
*/
16901690
int
16911691
lwip_shutdown(int s, int how)
@@ -1750,10 +1750,10 @@ lwip_getaddrname(int s, struct sockaddr *name, socklen_t *namelen, u8_t local)
17501750
}
17511751

17521752
#if LWIP_IPV4 && LWIP_IPV6
1753-
/* Dual-stack: Map IPv4 addresses to IPv6 mapped IPv4 */
1753+
/* Dual-stack: Map IPv4 addresses to IPv4 mapped IPv6 */
17541754
if (NETCONNTYPE_ISIPV6(netconn_type(sock->conn)) &&
17551755
IP_IS_V4_VAL(naddr)) {
1756-
ip4_2_ipv6_mapped_ipv4(ip_2_ip6(&naddr), ip_2_ip4(&naddr));
1756+
ip4_2_ipv4_mapped_ipv6(ip_2_ip6(&naddr), ip_2_ip4(&naddr));
17571757
IP_SET_TYPE_VAL(naddr, IPADDR_TYPE_V6);
17581758
}
17591759
#endif /* LWIP_IPV4 && LWIP_IPV6 */
@@ -2574,6 +2574,12 @@ lwip_setsockopt_impl(int s, int level, int optname, const void *optval, socklen_
25742574
switch (optname) {
25752575
#if LWIP_IPV6 && LWIP_RAW
25762576
case IPV6_CHECKSUM:
2577+
/* It should not be possible to disable the checksum generation with ICMPv6
2578+
* as per RFC 3542 chapter 3.1 */
2579+
if(sock->conn->pcb.raw->protocol == IPPROTO_ICMPV6) {
2580+
return EINVAL;
2581+
}
2582+
25772583
LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB_TYPE(sock, optlen, int, NETCONN_RAW);
25782584
if (*(const int *)optval < 0) {
25792585
sock->conn->pcb.raw->chksum_reqd = 0;

0 commit comments

Comments
 (0)