From eb6bcdb3eee84bef4f00ea6423a8eecc637a4048 Mon Sep 17 00:00:00 2001 From: Simon Goldschmidt Date: Wed, 24 Apr 2013 20:55:45 +0200 Subject: [PATCH 1/6] Removed the demand to post trivial patches to lwip-users, things keep getting lost there. --- doc/contrib.txt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/doc/contrib.txt b/doc/contrib.txt index 39596fca..b9860208 100644 --- a/doc/contrib.txt +++ b/doc/contrib.txt @@ -46,11 +46,7 @@ features of Savannah help us not lose users' input. 4. Do not file a bug and post a fix to it to the patch area. Either a bug report or a patch will be enough. If you correct an existing bug then attach the patch to the bug rather than creating a new entry in the patch area. -5. Trivial patches (compiler warning, indentation and spelling fixes or anything obvious which takes a line or two) - can go to the lwip-users list. This is still the fastest way of interaction and the list is not so crowded - as to allow for loss of fixes. Putting bugs on Savannah and subsequently closing them is too much an overhead - for reporting a compiler warning fix. -6. Patches should be specific to a single change or to related changes.Do not mix bugfixes with spelling and other +5. Patches should be specific to a single change or to related changes.Do not mix bugfixes with spelling and other trivial fixes unless the bugfix is trivial too.Do not reorganize code and rename identifiers in the same patch you change behaviour if not necessary.A patch is easier to read and understand if it's to the point and short than if it's not to the point and long :) so the chances for it to be applied are greater. From 796098e4c9cf5be61422ce8eb7adba24ba3e112b Mon Sep 17 00:00:00 2001 From: Simon Goldschmidt Date: Wed, 24 Apr 2013 21:28:56 +0200 Subject: [PATCH 2/6] fixed bug #38701 (wrong comment on tcp_pcb::snd_queuelen --- src/core/tcp_out.c | 8 ++++---- src/include/lwip/tcp.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core/tcp_out.c b/src/core/tcp_out.c index d6622178..b9fc339e 100644 --- a/src/core/tcp_out.c +++ b/src/core/tcp_out.c @@ -1377,9 +1377,9 @@ void tcp_keepalive(struct tcp_pcb *pcb) { struct pbuf *p; -#if CHECKSUM_GEN_TCP +#if CHECKSUM_GEN_TCP struct tcp_hdr *tcphdr; -#endif /* CHECKSUM_GEN_TCP */ +#endif /* CHECKSUM_GEN_TCP */ LWIP_DEBUGF(TCP_DEBUG, ("tcp_keepalive: sending KEEPALIVE probe to ")); ipX_addr_debug_print(PCB_ISIPV6(pcb), TCP_DEBUG, &pcb->remote_ip); @@ -1394,12 +1394,12 @@ tcp_keepalive(struct tcp_pcb *pcb) ("tcp_keepalive: could not allocate memory for pbuf\n")); return; } -#if CHECKSUM_GEN_TCP +#if CHECKSUM_GEN_TCP tcphdr = (struct tcp_hdr *)p->payload; tcphdr->chksum = ipX_chksum_pseudo(PCB_ISIPV6(pcb), p, IP_PROTO_TCP, p->tot_len, &pcb->local_ip, &pcb->remote_ip); -#endif /* CHECKSUM_GEN_TCP */ +#endif /* CHECKSUM_GEN_TCP */ TCP_STATS_INC(tcp.xmit); /* Send output to IP */ diff --git a/src/include/lwip/tcp.h b/src/include/lwip/tcp.h index 0ab301f0..add77e8d 100644 --- a/src/include/lwip/tcp.h +++ b/src/include/lwip/tcp.h @@ -233,7 +233,7 @@ struct tcp_pcb { u16_t snd_buf; /* Available buffer space for sending (in bytes). */ #define TCP_SNDQUEUELEN_OVERFLOW (0xffffU-3) - u16_t snd_queuelen; /* Available buffer space for sending (in tcp_segs). */ + u16_t snd_queuelen; /* Available buffer space for sending (in pbufs). */ #if TCP_OVERSIZE /* Extra bytes available at the end of the last pbuf in unsent. */ From 9809f1ff6600466da3f96fb304791201c54b34fc Mon Sep 17 00:00:00 2001 From: Simon Goldschmidt Date: Wed, 24 Apr 2013 21:38:01 +0200 Subject: [PATCH 3/6] Fixed bug #38586 --- CHANGELOG | 3 +++ src/core/netif.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 685b5687..3f75c1ae 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -80,6 +80,9 @@ HISTORY ++ Bugfixes: + 2013-04-24: Simon Goldschmidt (patch by Emil Ljungdahl): + * netif.c: fixed bug #38586 netif_loop_output() "deadlocks" + 2013-01-15: Simon Goldschmidt * ip4.c: fixed bug #37665 ip_canforward operates on address in wrong byte order diff --git a/src/core/netif.c b/src/core/netif.c index f8133f76..e7a87c3c 100644 --- a/src/core/netif.c +++ b/src/core/netif.c @@ -719,7 +719,7 @@ netif_loop_output(struct netif *netif, struct pbuf *p, for (last = r; last->next != NULL; last = last->next); SYS_ARCH_PROTECT(lev); - if(netif->loop_first != NULL) { + if (netif->loop_first != NULL) { LWIP_ASSERT("if first != NULL, last must also be != NULL", netif->loop_last != NULL); netif->loop_last->next = r; netif->loop_last = last; @@ -735,7 +735,7 @@ netif_loop_output(struct netif *netif, struct pbuf *p, #if LWIP_NETIF_LOOPBACK_MULTITHREADING /* For multithreading environment, schedule a call to netif_poll */ - tcpip_callback((tcpip_callback_fn)netif_poll, netif); + tcpip_callback_with_block((tcpip_callback_fn)netif_poll, netif, 0); #endif /* LWIP_NETIF_LOOPBACK_MULTITHREADING */ return ERR_OK; From 8609d1e7902518f18292ce79778058c5a750884b Mon Sep 17 00:00:00 2001 From: Simon Goldschmidt Date: Wed, 24 Apr 2013 21:58:57 +0200 Subject: [PATCH 4/6] fixed bug #38526 Coverity: Recursive Header Inclusion in ip6.h --- CHANGELOG | 3 +++ src/core/ipv6/icmp6.c | 1 + src/core/ipv6/ip6_frag.c | 1 + src/core/ipv6/mld6.c | 1 + src/core/ipv6/nd6.c | 1 + src/include/ipv6/lwip/ip6.h | 2 +- 6 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 3f75c1ae..54cc1194 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -80,6 +80,9 @@ HISTORY ++ Bugfixes: + 2013-04-24: Simon Goldschmidt + * ip6.h, some ipv6 C files: fixed bug #38526 Coverity: Recursive Header Inclusion in ip6.h + 2013-04-24: Simon Goldschmidt (patch by Emil Ljungdahl): * netif.c: fixed bug #38586 netif_loop_output() "deadlocks" diff --git a/src/core/ipv6/icmp6.c b/src/core/ipv6/icmp6.c index ea82682e..bad7930d 100644 --- a/src/core/ipv6/icmp6.c +++ b/src/core/ipv6/icmp6.c @@ -51,6 +51,7 @@ #include "lwip/netif.h" #include "lwip/nd6.h" #include "lwip/mld6.h" +#include "lwip/ip.h" #include "lwip/stats.h" #include diff --git a/src/core/ipv6/ip6_frag.c b/src/core/ipv6/ip6_frag.c index a43fd614..47882d4e 100644 --- a/src/core/ipv6/ip6_frag.c +++ b/src/core/ipv6/ip6_frag.c @@ -44,6 +44,7 @@ #include "lwip/ip6.h" #include "lwip/icmp6.h" #include "lwip/nd6.h" +#include "lwip/ip.h" #include "lwip/pbuf.h" #include "lwip/memp.h" diff --git a/src/core/ipv6/mld6.c b/src/core/ipv6/mld6.c index 1cb2dd9c..bffd97f1 100644 --- a/src/core/ipv6/mld6.c +++ b/src/core/ipv6/mld6.c @@ -50,6 +50,7 @@ #include "lwip/icmp6.h" #include "lwip/ip6.h" #include "lwip/ip6_addr.h" +#include "lwip/ip.h" #include "lwip/inet_chksum.h" #include "lwip/pbuf.h" #include "lwip/netif.h" diff --git a/src/core/ipv6/nd6.c b/src/core/ipv6/nd6.c index 44629dbe..1a43a371 100644 --- a/src/core/ipv6/nd6.c +++ b/src/core/ipv6/nd6.c @@ -55,6 +55,7 @@ #include "lwip/netif.h" #include "lwip/icmp6.h" #include "lwip/mld6.h" +#include "lwip/ip.h" #include "lwip/stats.h" #include diff --git a/src/include/ipv6/lwip/ip6.h b/src/include/ipv6/lwip/ip6.h index b199c95a..860d3e92 100644 --- a/src/include/ipv6/lwip/ip6.h +++ b/src/include/ipv6/lwip/ip6.h @@ -45,7 +45,7 @@ #if LWIP_IPV6 /* don't build if not configured for use in lwipopts.h */ -#include "lwip/ip.h" +//#include "lwip/ip.h" #include "lwip/ip6_addr.h" #include "lwip/def.h" #include "lwip/pbuf.h" From 252126cf767682c27d765cf3efa3a750a609961b Mon Sep 17 00:00:00 2001 From: Simon Goldschmidt Date: Wed, 24 Apr 2013 22:20:12 +0200 Subject: [PATCH 5/6] fixed possible division by zero --- CHANGELOG | 3 +++ src/core/ipv4/igmp.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 54cc1194..cd627dbf 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -80,6 +80,9 @@ HISTORY ++ Bugfixes: + 2013-04-24: Simon Goldschmidt + * igmp.c: fixed possible division by zero + 2013-04-24: Simon Goldschmidt * ip6.h, some ipv6 C files: fixed bug #38526 Coverity: Recursive Header Inclusion in ip6.h diff --git a/src/core/ipv4/igmp.c b/src/core/ipv4/igmp.c index bd52744f..9cb4c0c6 100644 --- a/src/core/ipv4/igmp.c +++ b/src/core/ipv4/igmp.c @@ -701,7 +701,7 @@ igmp_start_timer(struct igmp_group *group, u8_t max_time) } #ifdef LWIP_RAND /* ensure the random value is > 0 */ - group->timer = (LWIP_RAND() % (max_time - 1)) + 1; + group->timer = (LWIP_RAND() % max_time); #endif /* LWIP_RAND */ } From 097bc4c6221e9da3c596769439897abd8ca86307 Mon Sep 17 00:00:00 2001 From: Simon Goldschmidt Date: Wed, 24 Apr 2013 22:28:22 +0200 Subject: [PATCH 6/6] patch #8008 Fix a potential null pointer dereference in assert --- CHANGELOG | 3 +++ src/api/api_msg.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index cd627dbf..bd2e2ecd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -80,6 +80,9 @@ HISTORY ++ Bugfixes: + 2013-04-24: patch by Liam + api_msg.c: patch #8008 Fix a potential null pointer dereference in assert + 2013-04-24: Simon Goldschmidt * igmp.c: fixed possible division by zero diff --git a/src/api/api_msg.c b/src/api/api_msg.c index b1a9b772..02973389 100644 --- a/src/api/api_msg.c +++ b/src/api/api_msg.c @@ -222,11 +222,12 @@ recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err) LWIP_ASSERT("recv_tcp must have a pcb argument", pcb != NULL); LWIP_ASSERT("recv_tcp must have an argument", arg != NULL); conn = (struct netconn *)arg; - LWIP_ASSERT("recv_tcp: recv for wrong pcb!", conn->pcb.tcp == pcb); if (conn == NULL) { return ERR_VAL; } + LWIP_ASSERT("recv_tcp: recv for wrong pcb!", conn->pcb.tcp == pcb); + if (!sys_mbox_valid(&conn->recvmbox)) { /* recvmbox already deleted */ if (p != NULL) {