Commit Graph

5059 Commits

Author SHA1 Message Date
goldsimon
8345e9035f gesockopt: fall-through in switch/case only if a case contains no code at all 2017-05-12 20:33:57 +02:00
goldsimon
5c35bab26c getsockopt: invalid type used to check for UDP 2017-05-12 20:31:11 +02:00
goldsimon
e80b2eb4cf Fix mdns_resp_del_service 2017-05-12 13:21:42 +02:00
David Girault
c8b7759e10 mdns: added support for removing service in mdns responder
New function `mdns_resp_del_service()` added.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-05-12 13:12:22 +02:00
goldsimon
20fd844935 fixed typo in docs 2017-05-11 21:26:34 +02:00
goldsimon
79bd47736c SO_BROADCAST is valid for SOCK_DGRAM only 2017-05-11 20:48:57 +02:00
Axel Lin
9dee346000 apps/smtp: Fix memory leak in smtp_send_mail_alloced error paths
Call smtp_free_struct(s) in all smtp_send_mail_alloced error paths to ensure
no memory leak.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-05-11 10:47:20 +02:00
goldsimon
ec9096be40 fixed typo in httpd debug message 2017-05-10 13:41:26 +02:00
goldsimon
035bf4dcb0 Fixed bug #50992: window updated too often 2017-05-10 13:40:17 +02:00
Axel Lin
ae210967f2 apps/smtp: Fix memory leak if SMTP_BODYDH_MALLOC fails
Need to free s before return error.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-05-10 11:25:34 +02:00
Axel Lin
5bbe190b3b apps/smtp: Make smtp_send_bodyh_data takes "const char **from" parameter
Fixes below build error:
cc -g -Wall -DLWIP_DEBUG -pedantic -Werror -Wparentheses -Wsequence-point -Wswitch-default -Wextra -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wc++-compat -Wwrite-strings -Wold-style-definition -Wcast-align -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Wno-address -Wunreachable-code -Wuninitialized -Wlogical-op -I. -I../../.. -I../../../../lwip/src/include -I../../../ports/unix/port/include -I../../../../mbedtls/include -Wno-redundant-decls -DLWIP_HAVE_MBEDTLS=1 -c ../../../../lwip/src/apps/smtp/smtp.c
../../../../lwip/src/apps/smtp/smtp.c: In function ‘smtp_send_body_data_handler’:
../../../../lwip/src/apps/smtp/smtp.c:1487:41: error: cast discards ‘const’ qualifier from pointer target type [-Werror=cast-qual]
     if((res = smtp_send_bodyh_data(pcb, (char **)&s->body, &s->body_len))
                                         ^
../../../../lwip/src/apps/smtp/smtp.c:1507:47: error: cast discards ‘const’ qualifier from pointer target type [-Werror=cast-qual]
             ((res = smtp_send_bodyh_data(pcb, (char **)&s->body, &s->body_len)) == BDHALLDATASENT)
                                               ^
cc1: all warnings being treated as errors
../../Common.allports.mk:94: recipe for target 'smtp.o' failed
make: *** [smtp.o] Error 1

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-05-10 08:43:07 +02:00
Axel Lin
f5f34f138c apps/smtp: Fix missing altcp conversion in smtp_send_bodyh_data
The pcb is "struct altcp_pcb *" so we cannot call tcp_sndbuf/tcp_write here.
Use altcp_sndbuf/altcp_write instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-05-10 08:18:00 +02:00
Axel Lin
b9d5399ec1 apps/smtp: Trivial typo fixes
s/smpt/smtp/g

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-05-10 08:06:49 +02:00
Joel Cunningham
c03fef9a3c bug #50837: add zero-window probe timeout
This commit adds a timeout to the zero-window probing (persist timer)
mechanism. LwIP has not historically had a timeout for the persist
timer, leading to unbounded blocking if connection drops during the
zero-window condition

This commit also adds two units test, one to check the RTO timeout
and a second to check the zero-window probe timeout
2017-05-09 09:01:03 -05:00
Axel Lin
d87b11e8f9 sockets: Remove unreachable break statements in event_callback
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-05-09 11:25:59 +02:00
Sylvain Rochet
4171f39a72 PPP: remove ppp_singlebuf
We don't have to keep a helper function just for the sake of a PBUF_RAW
constant. Inline ppp_singlebuf function.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2017-05-05 15:42:15 +02:00
Axel Lin
3e909bafa8 PPP: use pbuf_coalesce() instead of private ppp_singlebuf()
pbuf_coalesce() creates a single pbuf out of a chain of pbufs, which is
exactly what ppp_singlebuf() need.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2017-05-05 15:36:26 +02:00
Dirk Ziegelmeier
a942582b4b Minor #ifdef cleanup in netif.c 2017-05-05 11:11:19 +02:00
Axel Lin
89d825f603 netif: Fix IPv6-only build
Fix below build error if LWIP_IPV4 == 0.
cc -g -Wall -DLWIP_DEBUG -pedantic -Werror -Wparentheses -Wsequence-point -Wswitch-default -Wextra -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wc++-compat -Wwrite-strings -Wold-style-definition -Wcast-align -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Wno-address -Wunreachable-code -Wuninitialized -Wlogical-op -I. -I../../.. -I../../../../lwip/src/include -I../../../ports/unix/port/include -I../../../../mbedtls/include -Wno-redundant-decls -DLWIP_HAVE_MBEDTLS=1 -c ../../../../lwip/src/core/netif.c
../../../../lwip/src/core/netif.c: In function ‘netif_add’:
../../../../lwip/src/core/netif.c:284:7: error: ‘ipaddr’ undeclared (first use in this function)
   if (ipaddr == NULL) {
       ^~~~~~
../../../../lwip/src/core/netif.c:284:7: note: each undeclared identifier is reported only once for each function it appears in
../../../../lwip/src/core/netif.c:285:14: error: implicit declaration of function ‘ip_2_ip4’ [-Werror=implicit-function-declaration]
     ipaddr = ip_2_ip4(IP4_ADDR_ANY);
              ^~~~~~~~
../../../../lwip/src/core/netif.c:285:5: error: nested extern declaration of ‘ip_2_ip4’ [-Werror=nested-externs]
     ipaddr = ip_2_ip4(IP4_ADDR_ANY);
     ^~~~~~
../../../../lwip/src/core/netif.c:285:23: error: ‘IP4_ADDR_ANY’ undeclared (first use in this function)
     ipaddr = ip_2_ip4(IP4_ADDR_ANY);
                       ^~~~~~~~~~~~
../../../../lwip/src/core/netif.c:287:7: error: ‘netmask’ undeclared (first use in this function)
   if (netmask == NULL) {
       ^~~~~~~
../../../../lwip/src/core/netif.c:290:7: error: ‘gw’ undeclared (first use in this function)
   if (gw == NULL) {
       ^~
cc1: all warnings being treated as errors
../../Common.allports.mk:94: recipe for target 'netif.o' failed
make: *** [netif.o] Error 1

Fixes: 5967380c20 ("netif_add: avoid passing NULL pointers to subsequent functions")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-05-05 10:39:15 +02:00
goldsimon
749e078d36 6lowpan: fix compiling with !LWIP_UDP 2017-05-05 09:19:02 +02:00
Dirk Ziegelmeier
5967380c20 netif_add: avoid passing NULL pointers to subsequent functions (reported by Axel Lin) 2017-05-05 09:07:40 +02:00
Axel Lin
9bbb741247 tcp: Remove unreachable code in tcp_close_shutdown_fin
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-05-05 08:58:09 +02:00
goldsimon
d36306e30b sntp_process: fixed unused variable if sub-second time info is not used 2017-05-04 15:49:12 +02:00
Axel Lin
bf510fee51 SNMP: Cleanup unreachable code
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-05-04 09:15:29 +02:00
Dirk Ziegelmeier
fe8c62e7b6 Fix bug #50932: LWIP-provided byteorder functions defined in the wrong scope
Apply suggested fix from "Fayek"
2017-05-03 22:28:46 +02:00
goldsimon
72a8db7867 tcp_fasttmr: adapt comment (to delayed FIN implementation) 2017-05-03 21:42:59 +02:00
goldsimon
f00d7db409 backport of "variable assigned but not used" warnings from STM (why don't people report such things?) 2017-05-03 20:31:29 +02:00
goldsimon
eff97c04ef backport of "unreachable code" warnings from STM (why don't people report such things?) 2017-05-03 20:30:38 +02:00
Dirk Ziegelmeier
6c236b047e ip_route() can be called with IP_ANY_TYPE in src parameter, so remove code associated to that 2017-05-03 16:42:30 +02:00
Daniel Elstner
ccf10a5023 SNTP: Avoid warning if debugging is disabled 2017-05-03 16:40:11 +02:00
Joel Cunningham
ddf4e17411 tcp: indentation fix in tcp_receive()
TCP_OVERSIZE block was moved out from inside the while loop and thus
should be on column 7
2017-05-03 09:29:02 -05:00
goldsimon
4cf6f9ed51 tcp_free_acked_segments: fix debug printf parameter errors, fix unused parameters for !LWIP_DEBUG and/or LWIP_NOASSERT 2017-05-03 13:49:24 +02:00
goldsimon
778206798e task #14433: TCP: combine unsent/unacked queue loops in tcp_receive() 2017-05-03 12:32:01 +02:00
goldsimon
39316bb9de httpd: fixed bug #50915 (HTTP_IS_DATA_VOLATILE was wrong for LWIP_HTTPD_DYNAMIC_FILE_READ==1) 2017-05-03 09:57:12 +02:00
goldsimon
b9c47c5089 tcp_route: add comment, fixed whitespace 2017-05-03 09:56:08 +02:00
goldsimon
5c0aab7bd5 udp SO_REUSE_RXTOALL: don't copy IP header in duplicated pbuf 2017-05-03 09:54:46 +02:00
Dirk Ziegelmeier
2b9a132772 Fix compile in tcp_route when IPv4 only is used and source-based routing is disabled 2017-05-03 09:09:37 +02:00
Dirk Ziegelmeier
d32492e953 Make patch 4 of David's Minix3 patches superfluous: Use PBUF_POOL to duplicate incoming packets in UDP
... which would have been the correct way to do it anyway :-)
http://git.minix3.org/index.cgi?p=minix.git;a=blob;f=minix/lib/liblwip/patches/0004-MINIX-3-only-avoid-large-contiguous-allocations.patch;h=f23143c7e8d372b3b35b599a97975d79924f73c1;hb=HEAD
2017-05-03 09:02:56 +02:00
goldsimon
7defe372b9 fixed compiling pbuf.c with LWIP_TCP==0 2017-05-03 09:02:06 +02:00
goldsimon
082fe71c0c fixed compiling sockets.c with LWIP_UDP==0 2017-05-03 09:01:48 +02:00
Dirk Ziegelmeier
676dd74140 Minor cleanup and documentation updates 2017-05-03 08:51:00 +02:00
Dirk Ziegelmeier
e835707814 Cleanup and simplify tcp_connect() code 2017-05-03 08:46:06 +02:00
Dirk Ziegelmeier
5800cf51be Work on task #14494: Implement SO_BINDTODEVICE
TCP needs additional netif handling
2017-05-03 08:00:06 +02:00
Axel Lin
c144e5b1ec pbuf_coalesce: Replace pbuf_alloc+pbuf_copy with pbuf_clone
Avoid duplicate the same implementation.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-05-02 20:36:00 +02:00
Axel Lin
bc0fafdeca udp: Fix compiling for IPv6-only build
Fix below build error when LWIP_IPV6 && !LWIP_IPV4:
cc -g -Wall -DLWIP_DEBUG -pedantic -Werror -Wparentheses -Wsequence-point -Wswitch-default -Wextra -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wc++-compat -Wwrite-strings -Wold-style-definition -Wcast-align -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Wno-address -Wunreachable-code -Wuninitialized -Wlogical-op -I. -I../../.. -I../../../../lwip/src/include -I../../../ports/unix/port/include -I../../../../mbedtls/include -Wno-redundant-decls -DLWIP_HAVE_MBEDTLS=1 -c ../../../../lwip/src/core/udp.c
../../../../lwip/src/core/udp.c: In function ‘udp_input_local_match’:
../../../../lwip/src/core/udp.c:130:58: error: unused parameter ‘inp’ [-Werror=unused-parameter]
 udp_input_local_match(struct udp_pcb *pcb, struct netif *inp, u8_t broadcast)
                                                          ^~~

Fixes: 13ffc86aef ("Start working task #14494: Implement SO_BINDTODEVICE")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-05-02 15:55:32 +02:00
Dirk Ziegelmeier
e3289116b9 Fix next build error introduced in my last commit 2017-05-02 15:21:52 +02:00
Dirk Ziegelmeier
6a754325dc Fix build error introduced in my last commit 2017-05-02 14:53:18 +02:00
Dirk Ziegelmeier
c7e3519f46 Start working task #14494: Implement SO_BINDTODEVICE
Implement setsockopt. TODO: getsockopt
2017-05-02 13:18:29 +02:00
Dirk Ziegelmeier
eab2ae5d78 Cleanup netif_name_to_index() implementation 2017-05-02 12:51:25 +02:00
goldsimon
0545eba002 Fixed copy&paste error found by travis-ci... 2017-05-02 10:42:59 +02:00
Dirk Ziegelmeier
13ffc86aef Start working task #14494: Implement SO_BINDTODEVICE
Implement binding TCP, UDP and RAW PCBs to a netif
2017-05-02 09:39:48 +02:00
Dirk Ziegelmeier
20fed63297 Add custom pbuf usage example to pbuf_alloced_custom() docs 2017-04-28 13:19:32 +02:00
Dirk Ziegelmeier
83d0607acf Add PBUF_NEEDS_COPY macro to documentation 2017-04-27 19:25:19 +02:00
goldsimon
1add8c14ca netif: tiny cleanup to last commit 2017-04-27 14:12:13 +02:00
goldsimon
975e29d76e fixed copy&paste error :-) 2017-04-27 12:46:14 +02:00
Dirk Ziegelmeier
1aa24ee21b Add new DHCP hooks to DHCP docs 2017-04-27 12:42:14 +02:00
Dirk Ziegelmeier
a09a8e4a06 Some documentation updates and fixes
Dedicated Zero-copy RX page
Fix doxygen warnings
2017-04-27 12:41:08 +02:00
goldsimon
6aac9377ee Clean up LWIP_NETIF_HWADDRHINT a bit: create a struct holding the hint(s) and pass a pointer to that struct around. That way we are free to add more hints if required (e.g. see task #11620) 2017-04-27 12:39:54 +02:00
Axel Lin
4c9b316e6b pbuf: Fix allocate zero length pbuf
Current code fails to allocate zero length pbuf (e.g. for PBUF_RAW PBUF_POOL),
fix it.

Fixes: eb269e61b5 ("First step to clean up pbuf implementation: add pbuf_alloc_reference() to allocate pbufs referencing external payload; move member initialization to common function; simplify PBUF_POOL chain allocator")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-04-26 20:15:22 +02:00
Joel Cunningham
fc7a68b5af sockets: fix CMSG alignment
This changes the CMSG alignment macros to ensure struct cmsghdr and data
are on a word (double word on 16-bit arch) aligned boundary

We need to ensure at least 32-bit alignment for 16-bit systems because
socklen_t could be 32-bit due to our definition
2017-04-26 08:39:44 -05:00
Dirk Ziegelmeier
c686261e1e Minor whitespace cleanup in ip.h 2017-04-26 12:28:54 +02:00
goldsimon
728aaeb528 Try to fix alignment warnings in CMSG_NXTHDR() 2017-04-26 08:55:07 +02:00
goldsimon
eac45ca284 Try to fix alignment warnings when assigning CMSG_DATA() to some struct pointer 2017-04-26 08:43:56 +02:00
goldsimon
eb269e61b5 First step to clean up pbuf implementation: add pbuf_alloc_reference() to allocate pbufs referencing external payload; move member initialization to common function; simplify PBUF_POOL chain allocator 2017-04-25 23:04:12 +02:00
goldsimon
e57552d401 pbuf_alloc_copy -> pbuf_clone 2017-04-25 22:02:07 +02:00
goldsimon
2fef874494 task #14270: DHCP should support user-defined additional options: added two hooks for adding and parsing user defined DHCP options 2017-04-25 20:18:59 +02:00
Axel Lin
471daba011 tcp_out: Fix LWIP_NETIF_TX_SINGLE_PBUF guard for not executing phase 2
This fixes build error if LWIP_NETIF_TX_SINGLE_PBUF==1.

Fixes: dd811bca06 ("Fix bug #50694 (TX exist more pbufs after enable LWIP_NETIF_TX_SINGLE_PBUF) by not executing phase 2 for LWIP_NETIF_TX_SINGLE_PBUF==1")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-04-25 20:17:47 +02:00
Joel Cunningham
2f117add7a sockets: task #14247, add CMSG and IP_PKTINFO
This commit adds CMSG infrastructure (currently used with recvmsg) and
the IP_PKTINFO socket option.

In order to use IP_PKTINFO, set LWIP_NETBUF_RECVINFO to 1

Unit test is added to verify this feature
2017-04-25 09:44:03 -05:00
goldsimon
ca961b9bc2 minor whitespace cleanups only 2017-04-25 12:07:28 +02:00
goldsimon
d02bc6481f Fixed bug #50816 (netif_add() prototype depends on configuration) by adding a new function netif_add_noaddrthat doesn't change 2017-04-25 12:05:05 +02:00
goldsimon
135d506065 minor whitespace fixes only 2017-04-25 12:03:52 +02:00
goldsimon
dd811bca06 Fix bug #50694 (TX exist more pbufs after enable LWIP_NETIF_TX_SINGLE_PBUF) by not executing phase 2 for LWIP_NETIF_TX_SINGLE_PBUF==1 2017-04-25 11:18:36 +02:00
goldsimon
4b68605276 Clarify LWIP_NETIF_TX_SINGLE_PBUF (drivers might still get chained pbufs and have to take care of that, e.g. by using pbuf_alloc_copy) 2017-04-25 10:09:32 +02:00
goldsimon
dcb2cb99a1 Added 'pbuf_alloc_copy' e.g. as a single function for use with non scatter-gather drivers 2017-04-25 10:08:31 +02:00
Dmitry
42eb98c9fc Fix bugs in httpd with "LWIP_HTTPD_CUSTOM_FILES && LWIP_HTTPD_DYNAMIC_FILE_READ" when SSI tags (from '<' to '>' when they span from one read to the next or end at one read buffer) - bugs #50844 aqnd #50845
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-04-24 22:33:17 +02:00
goldsimon
9c6da979ca fixed copy&paste error in last change to lwip_itoa() 2017-04-24 13:33:43 +02:00
goldsimon
16a71473c1 Better fix for bug #50838 (mem.c needs SYS_ARCH_PROTECTION around MEM_STATS): only lock where necessary 2017-04-24 12:23:05 +02:00
goldsimon
bd483fa229 Revert "Fixed bug #50838 (mem.c needs SYS_ARCH_PROTECTION around MEM_STATS)"
This reverts commit 3770adccfd.
2017-04-24 10:29:46 +02:00
Dirk Ziegelmeier
b71878f02e Fix bug #50739: 6lowpan - IPHC de-compression bug
Apply fix provided by Aigner B.
2017-04-21 22:30:23 +02:00
Dirk Ziegelmeier
13f51a0318 Fix bug #50824: Bug in SNTP POLL mode
Ignore all broken packets
Stop timeouts only when correct packet is received
2017-04-21 22:10:52 +02:00
Joel Cunningham
ad779e5c9c doc: clarify RST handling comment
This clarifies the documentation around RST handling to document
the approach follows RFC 5961 and is not a standards violation
2017-04-21 09:27:54 -05:00
goldsimon
f4730e78f8 sntp: use randomized startup delay ([0..5] seconds) by default (if LWIP_RAND is available) 2017-04-21 13:14:48 +02:00
goldsimon
65b8316459 sntp_opts.h: adapt comment to RFC errata 2017-04-21 13:14:03 +02:00
goldsimon
554f5d7f9e sntp: fix SNTP_LI_* bits; fix todo comment 2017-04-21 13:13:56 +02:00
goldsimon
84461e90e2 mqtt: fix shadowing global 'dup' 2017-04-21 07:23:32 +02:00
goldsimon
a50ba9c748 sockets.c: try to fix debug print (again) 2017-04-20 23:03:49 +02:00
Joel Cunningham
de90d03e48 tcp: task #14128 - Appropriate Byte Counting support
This commit adds TCP Appropriate Byte Counting (ABC) support based on
RFC 3465

ABC replaces the previous congestion window growth mechanism and has been
configured with limit of 2 SMSS.  See task #14128 for discussion on
defaults, but the goal is to mitigate the performance impact of delayed
ACKs on congestion window growth

This commit also introduces a mechanism to track when the stack is
undergoing a period following an RTO where data is being retransmitted.

Lastly, this adds a unit test to verify RTO period tracking and some
basic ABC cwnd checking
2017-04-20 15:59:24 -05:00
goldsimon
e1f2c8b30c sockets.c: try to fix debug print 2017-04-20 22:55:56 +02:00
goldsimon
2358a5ac32 lwip_netconn_do_close_internal: 'close' -> 'shut_close': don't override global function names (why is this reported only now?) 2017-04-20 22:52:27 +02:00
goldsimon
2c767a1d60 fix standard conformance: some socket functions should return 'ssize_t', not 'int' 2017-04-20 22:44:23 +02:00
goldsimon
1ada106d61 netconn_tcp_recvd: take size_t, not u32_t 2017-04-20 22:34:12 +02:00
goldsimon
4d6b90727f lwip_recvfrom: use LWIP_MIN instead of self-coded min 2017-04-20 22:07:08 +02:00
goldsimon
dbc969c139 Try to fix the socket API for sizeof(int) <= 2 by checking INT_MAX at 2 places 2017-04-20 22:06:36 +02:00
goldsimon
b93572dca8 Document struct netvector 2017-04-20 22:00:07 +02:00
goldsimon
131d656c23 lwip_itoa: check 'bufsize' instead of ignoring it; ensure code is not stolen from GPL 2017-04-20 21:57:03 +02:00
goldsimon
3770adccfd Fixed bug #50838 (mem.c needs SYS_ARCH_PROTECTION around MEM_STATS) 2017-04-20 21:44:00 +02:00
Dirk Ziegelmeier
d54240bdea One more try to fix compile without TCP 2017-04-19 08:44:05 +02:00
Dirk Ziegelmeier
302d84f5b2 Try to fix compile without TCP (reported by Axel Lin) 2017-04-19 08:18:15 +02:00
Dirk Ziegelmeier
32aa9a41e2 Apply patch from Kudratov Olimjon: Array index used before limits check
while ((q != NULL) && (options[offset] != DHCP_OPTION_END) && (offset < offset_max)) {
should be
while ((q != NULL) && (offset < offset_max) && (options[offset] != DHCP_OPTION_END)) {

See https://jira.reactos.org/browse/CORE-8978 for more info.
2017-04-19 06:35:07 +02:00
Tim Cussins
8e83e206f4 sockets.c: Make sock_inc_used overflow check robust.
Before this patch, it was possible that the overflow check might
miss an overflow event.

e.g. Consider 2 threads, both executing this method. u8_t fd_used is on 255...

Thread A -> atomically increment fd_used (which is now 0)
Thread B -> atomically increment fd_used (which is now 1)
Thread A -> check overflow... sees everything ok
Thread B -> check overflow... sees everything ok

And the overflow is missed :(

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-04-18 20:50:33 +02:00
Tim Cussins
7ac3056da9 sockets.c: Add missing lwip_select_dec_sockets_used within lwip_select.
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-04-18 20:50:33 +02:00
goldsimon
0952e618bd netconn_drain(): use lwip_netconn_is_err_msg() on acceptmbox, too. 2017-04-18 10:54:40 +02:00
Axel Lin
0b2a652317 api_msg: Use lwip_netconn_is_err_msg instead of NULL test in netconn_drain()
The NULL test no longer work after commit e0a2472706, it needs to test with
lwip_netconn_is_err_msg() instead.

Fixes: e0a2472706 ("netconn/sockets: remove fatal error handling, fix asynchronous error handling, ensure data before RST can be received")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-04-18 10:47:42 +02:00
Joel Cunningham
f28c1c851b loopif: set pbuf if_idx during poll
This sets the pbuf's if_idx during the loopif poll function (the
equivalent netif input function).  This was found during IP_PKTINFO
development where p->if_idx is read and was uninitialized
2017-04-15 11:31:38 -05:00
goldsimon
bf01941b23 opt.h: provide LWIP_NUM_SYS_TIMEOUT_INTERNAL as default value for MEMP_NUM_SYS_TIMEOUT that can be extended by local lwipopts.h 2017-04-12 21:52:34 +02:00
goldsimon
dfc57f0289 mqtt: move struct mqtt_client_s and inner structs to new file mqtt_priv.h (to hide it from apps but provide it for tests) 2017-04-12 21:50:58 +02:00
goldsimon
5310d8f13c event_callback: separated ++ from if 2017-04-12 12:40:50 +02:00
goldsimon
e0a2472706 netconn/sockets: remove fatal error handling, fix asynchronous error handling, ensure data before RST can be received 2017-04-12 12:37:16 +02:00
goldsimon
064044eeae sockets: speed up event_callback: don't iterate select_cb_list for NETCONN_EVT_RCVPLUS/SENDPLUS if the socket has been readable/writable before already 2017-04-12 09:12:55 +02:00
goldsimon
58c21eb13c sockets: speed up event_callback: don't iterate select_cb_list for NETCONN_EVT_RCVMINUS/SENDMINUS 2017-04-11 20:59:00 +02:00
goldsimon
b6fdb61654 sockets.c: refactor event_callback() a bit 2017-04-11 20:55:47 +02:00
goldsimon
b0af09ec45 select_cb_ctr no needed any more for LWIP_TCPIP_CORE_LOCKING==1 2017-04-11 12:50:25 +02:00
goldsimon
92997756d1 task #14420 (Remove sys_sem_signal from inside SYS_ARCH_PROTECT crit section) done for LWIP_TCPIP_CORE_LOCKING==1 2017-04-11 12:40:44 +02:00
goldsimon
26d3466f50 Add macro ETH_ADDR() to initialize a struct eth_addr with its 6 bytes and taking care of correct braces 2017-04-11 08:49:15 +02:00
Dirk Ziegelmeier
8695e6e6cb Fixup BRIDGEIF_INITDATA2 macro 2017-04-07 08:59:26 +02:00
Dirk Ziegelmeier
7ba5cc3d52 Improve bridgeif doxygen docs 2017-04-07 08:01:38 +02:00
Joel Cunningham
557a11047d Patch #9307: Replace mem_malloc+memset with mem_calloc
Aside from reducing source code, on systems which use MEM_LIBC_MALLOC,
this has the potential to improve performance depending on the underlying
memory allocator

See http://stackoverflow.com/questions/2688466/why-mallocmemset-is-slower-than-calloc
2017-04-05 14:53:24 -05:00
goldsimon
b34f2d5605 altcp: allocate altcp_pcbs from a pool, not from heap (new option MEMP_NUM_ALTCP_PCB defaults to MEMP_NUM_TCP_PCB) 2017-04-05 12:18:48 +02:00
Dirk Ziegelmeier
0f4ad57033 Fix build error in bridgeif.c 2017-04-05 08:11:37 +02:00
goldsimon
9c78909857 bridgeif: sanity-check init_data->max_ports <= BRIDGEIF_MAX_PORTS 2017-04-04 22:12:38 +02:00
goldsimon
77df9ccd5a bridgeif: fix that max_fdb_static_entries was used to init dynamic FDB 2017-04-04 22:09:31 +02:00
goldsimon
2a30fedbea fix passing NULL to netif_set_gw & netif_set_netmask (or netif_set_addr or netif_add) (broken on 18.03.2017 by 2d9ef2215b) 2017-04-04 22:08:37 +02:00
goldsimon
97f4033a8a bridgeif: improve documentation 2017-04-04 21:54:52 +02:00
goldsimon
8ed2bd4771 bridgeif: gracefully handle out-of-memory in bridgeif_fdb_init 2017-04-04 21:54:30 +02:00
goldsimon
e65a0950b2 mem_calloc: check for mem_size_t overflow when multiplying 2 mem_size_t input values 2017-04-04 21:52:01 +02:00
Dirk Ziegelmeier
6559ffd848 Fix C++ style comment in altcp_tls_mbedtls.c 2017-03-31 13:05:04 +02:00
goldsimon
33466ee6a8 dhcp_parse_reply: return ERR_VAL instead of asserting on offset-out-of-pbuf 2017-03-30 22:30:27 +02:00
goldsimon
1c57c84200 vj_uncompress_uncomp: copy from/to bigger buffers (used for checks before) instead of cs->cs_ip and ip; just to help static code analysis to see this is correct ;-) 2017-03-30 21:54:42 +02:00
goldsimon
aa0601a66d snmp_asn1_dec_tlv: explicitly check 'length_bytes > pbuf_stream->length' (for clarity, even if it would fail in pbuf_stream later) 2017-03-30 21:31:44 +02:00
goldsimon
3aa854409a pbuf_copy_partial: remove double-check of 'buf' and 'dataptr' 2017-03-30 21:29:53 +02:00
goldsimon
4313bf2a74 altcp_tls_mbedtls: fix TX when lower write returns ERR_MEM 2017-03-30 14:55:37 +02:00
goldsimon
51dbd1a7c0 altcp: added altcp_get_port() 2017-03-30 14:19:31 +02:00
Dirk Ziegelmeier
4a7569fc2d SNMP traps: Fix ignored return values 2017-03-30 13:01:10 +02:00
Dirk Ziegelmeier
132c285fd4 SNMP. Fix several ignored return values 2017-03-30 12:50:32 +02:00
Dirk Ziegelmeier
2673e635a3 Fix community string length copying - correctly handle long strings 2017-03-30 11:09:35 +02:00
Dirk Ziegelmeier
8d149e63a6 SNMP: strcpy -> strncpy, strlen -> strnlen 2017-03-30 08:57:53 +02:00
Joel Cunningham
c722261142 tcp: bug #50614: move unsent queue check/pcb->snd_buf update
This commit corrects what looks like an ancient incorrect organization
of the logic for processing an ACK which acks new data.  Once moved,
we can also change to using TCP_SEQ_LEQ on ackno instead of TCP_BETWEEN
because ackno has already been checked against snd_nxt

The work of checking the unsent queue and updating pcb->snd_buf (both
steps required for new data ACK) should be located under the conditional
that checks TCP_SEQ_BETWEEN(ackno, pcb->lastack+1, pcb->snd_nxt)

The comment following the unsent queue check/pcb->snd_buf update even
indicates "End of ACK for new data processing" when the logic is clearly
outside of this check

From what I can tell, this mis-organization isn't causing any incorrect
behavior since the unsent queue checked that ackno was between start of
segment and snd_nxt and recv_acked would be 0 during pcb->snd_buf update.
Instead this is waisted work for duplicate ACKS (can be common) and other
old ACKs
2017-03-29 16:24:54 -05:00
goldsimon
720f9b3a0b fix compiling altcp_tls_mbedtls sources/headers if mbedtls is not available 2017-03-29 23:02:16 +02:00
goldsimon
856b49a057 lwip_sendmsg: fix check for unsupported flags 2017-03-29 22:38:16 +02:00
goldsimon
5d600f72d2 bridgeif_input: check netif != NULL before calling netif_get_client_data() 2017-03-29 22:27:00 +02:00
goldsimon
ca9f57c09f lwip_fcntl/F_GETFL: no need to check sock->conn != NULL: already checked by get_socket() 2017-03-29 22:26:34 +02:00
goldsimon
5b6c654dd1 make F_GETFL return file access mode for !CORE_LOCKING as well 2017-03-29 20:54:24 +02:00
Joan Lledó
172dab1289 lwip_fcntl() returns access modes 2017-03-29 20:46:30 +02:00
Dirk Ziegelmeier
33e3ee0790 Clarify LWIP_ALTCP_TLS usage a bit 2017-03-29 08:52:19 +02:00
Dirk Ziegelmeier
8fd90ea136 improve mqtt documentation 2017-03-29 08:43:27 +02:00
Dirk Ziegelmeier
fbcdb4d9f1 Fix function name in altcp.c 2017-03-29 08:22:35 +02:00
Dirk Ziegelmeier
2ca717e18d altcp_tls.h: Document ARM mbedtls port 2017-03-28 21:34:00 +02:00
Dirk Ziegelmeier
40df1474cc SNMP: Advertise SNMPv3 support 2017-03-28 21:33:37 +02:00
Dirk Ziegelmeier
3266511ebb Improve documentation, add TLS stuff 2017-03-28 21:25:49 +02:00
Dirk Ziegelmeier
9b6192bd65 Create smtp_opts.h and add SMTP client to doxygen docs 2017-03-28 21:14:56 +02:00