Commit Graph

740 Commits

Author SHA1 Message Date
Knut Andre Tidemann
5e9df2c698 lwip: fix broken default ICMPv6 handling of checksums.
ICMPv6 should always have checksum generated for it as per RFC 3542
chapter 3.1.
2017-01-11 12:24:15 +01:00
Dirk Ziegelmeier
3a20ae3830 Add missing #include in netdb.c for atoi() 2017-01-05 08:55:12 +01:00
sg
98fc82fa71 added function tcp_listen_with_backlog_and_err() to get the error reason when listening fails (bug #49861) 2016-12-31 15:36:31 +01:00
Dirk Ziegelmeier
2e4b368c8c Revert "Fix bug #49914: lwip_sendmsg uses PBUF_REF pbufs"
This reverts commit 4e34851c57.
2016-12-23 09:51:26 +01:00
Dirk Ziegelmeier
4e34851c57 Fix bug #49914: lwip_sendmsg uses PBUF_REF pbufs
Use PBUF_RAM and create private copy of the data
2016-12-22 21:19:53 +01:00
goldsimon
c71733252c Fix compiling with LWIP_NOASSERT (and debug/error disabled, too) 2016-12-19 10:29:16 +01:00
Dirk Ziegelmeier
c21763f6cb Minor code cleanup api_lib.c 2016-12-18 21:31:14 +01:00
Thomas Mueller
fcd2daf57c fixed race condition in return value of netconn_gethostbyname() (and thus also lwip_gethostbyname/_r() and lwip_getaddrinfo())
Signed-off-by: sg <goldsimon@gmx.de>
2016-12-16 15:44:00 +01:00
sg
d9f461e4e4 Fixed #49848 (Non-blocking socket emit a sock error while read return EWOULDBLOCK) especially for EWOULDBLOCK (added task #14275 for the general problem) 2016-12-15 22:32:46 +01:00
Dirk Ziegelmeier
f2a5aa2866 Fix bug #49827: wrong cast to size_t on 16-bit x86 architecture
I hope I caught all of them.
TODO: Same for casts to get rid of alignment warnings, these are also casts via size_t
2016-12-12 10:07:00 +01:00
Dirk Ziegelmeier
89cb7b7aa1 Try to remove #include <stdlib.h> from many files. Does not seem necessary any more and might cause problems when porting lwIP. 2016-12-08 11:05:01 +01:00
Dirk Ziegelmeier
1687721600 Fix compile when IPv4 is disabled 2016-12-05 22:01:58 +01:00
Dirk Ziegelmeier
4bbed75cc4 Minor code layout cleanup in err.c and errno.h 2016-12-01 08:55:01 +01:00
Dirk Ziegelmeier
47fd67a35c Remove TODO comments and one check from sockets.c indicating IPV6_V6ONLY socket option handling does not work 2016-11-28 15:56:59 +01:00
goldsimon
b934c3f471 fixed bug #49726: setsockopt() set TCP_NODELAY TCP_KEEPALIVE ... with a listen state TCP will crash 2016-11-28 15:50:59 +01:00
goldsimon
2a882b6387 minor: fixed indent 2016-11-28 12:54:17 +01:00
goldsimon
ca9342c549 fixed bug #49725 (send-timeout: netwonn_write() can return ERR_OK without all bytes being written) 2016-11-28 12:51:45 +01:00
Dirk Ziegelmeier
aea872431c Fix naming of some inet_addr_* macros in inet.h
From inet4_addr_* to inet_addr_* - inet_addr is a "known word", don't change it
2016-11-25 22:13:12 +01:00
Joel Cunningham
5030fa81a0 bug #49684, api_msg: treat non-blocking ERR_MEM as ERR_WOULDBLOCK
This corrects a case in lwip_netconn_do_writemore() where if a
non-blocking socket receives ERR_MEM in a call to tcp_write(), it would
return ERR_MEM, which would result in ENOMEM coming out of the socket
layer

This case can be gracefully handled by returning ERR_WOULDBLOCK since the
socket is already marked as no longer writable and sent_tcp/poll_tcp will
mark the socket as writable again based on available buffer space

This is very similiar to how ERR_MEM is resolved for blocking sockets
2016-11-23 15:03:43 -06:00
Dirk Ziegelmeier
9366c0eaab I decided to keep the "complexity" of handling IPv6 mapped IPv4 addresses out of netconn API.
Only socket API understands this address type now.
2016-11-17 12:41:00 +01:00
Dirk Ziegelmeier
5d5eeca008 Once more: Try fix compile with clang 2016-11-17 09:23:57 +01:00
Dirk Ziegelmeier
4b7e0f50b7 Fix indent in api_lib.c 2016-11-17 09:14:29 +01:00
Dirk Ziegelmeier
44e430ebc2 Fix compile with MSVC 2010 and remove handling for IP6_ADDR_ANY in netconn_connect() - IP6_ADDR_ANY does not make sense in connect() 2016-11-17 09:12:38 +01:00
Dirk Ziegelmeier
180ba72a06 Dual-stack: Use IPv6 mapped IPv4 addresses in receive() and getaddr() only in socket API, not in netconn API.
It is better to present correct IP types in netconn API.
Netconn API now accepts IPv6 mapped IPv4 addresses as well as IPv6 and IPv4 in send(), bind() and connect(), but does NOT map IPv4 to IPv6 mapped IPv4 in getaddr() and receive() functions.
2016-11-17 08:51:07 +01:00
Dirk Ziegelmeier
792224ead0 Try to fix compile error with clang (found by Erik's Travis-CI) 2016-11-17 08:48:55 +01:00
Dirk Ziegelmeier
1712b06a64 Work on dual-stack netconn
IPv6 netconns are created as IPADDR_TYPE_ANY raw/udp/tcp PCBs internally
bind, connect and sendto now accept IPv6 mapped IPv4 addresses or IPv4 addresses as argument
getaddr and receive functions now return IPv6 mapped IPv4 addresses instead of IPv4 addresses
This behavior is close to BSD socket API
2016-11-16 22:58:38 +01:00
Dirk Ziegelmeier
b70ddf7b54 Cleanup unmap_ipv6_mapped_ipv4() macro 2016-11-16 21:37:41 +01:00
Dirk Ziegelmeier
1dd97e7d53 sockets.c, lwip_sendto(): Remove check whether IP address matches socket type. Is checked in lower layers anyway. 2016-11-16 21:37:41 +01:00
Dirk Ziegelmeier
2f37dc0606 api_msg.c: Partly add support for IPv6 mapped IPv4 addresses
- lwip_netconn_do_getaddr(): Convert IPv4 addresses to IPv6 mapped IPv4 addresses
- lwip_netconn_do_send(): Support IPv6 mapped IPv4 addresses
- Not done: connect(), bind()
2016-11-16 21:37:41 +01:00
Dirk Ziegelmeier
ee7a2f346c inet.h: Consistently name some inet <-> ipaddr conversion macros
They operate on ip4_addr_t, not on ip_addr_t
This should be clearly visible in their names
2016-11-16 20:30:13 +01:00
Dirk Ziegelmeier
fdcd8f6faf Fix bug #49578: lwip_socket_drop_registered_memberships API may not work with LWIP_SOCKET_OFFSET 2016-11-11 11:13:25 +01:00
Axel Lin
4dffe521a3 api_msg.c: Trivial code cleanup
Slightly improve readability by testing apiflags with NETCONN_DONTBLOCK.
Also remove an empty else clause.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-10-14 09:20:10 +02:00
sg
0a343948d9 Fix netconn/socket race condition when receiving RST while waiting on recvmbox 2016-10-10 21:35:07 +02:00
Dirk Ziegelmeier
f6e27940bd Make lwIP compile with clang -Wdocumentation -> several documentation fixes 2016-10-09 12:21:39 +02:00
goldsimon
69be49fdc3 Try to fix !defined(LWIP_PROVIDE_ERRNO) 2016-10-07 16:22:33 +02:00
Axel Lin
740182de3c err: Fixup error code range checking in err_to_errno
This also fixes build error in non-debug build because err_strerr is
guarded by LWIP_DEBUG.

Fixes: a1c0a0185b ("bug #48823: posix errors should be removed from arch.h (to new file 'lwip/errno.h'))"
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-10-07 07:41:21 +02:00
Dirk Ziegelmeier
ad3530ee10 One more compile fix in err.c 2016-10-06 20:20:07 +02:00
Dirk Ziegelmeier
86a92543de Try to fix unix build after Simon's errno changes (need sys_arch.h) 2016-10-06 16:01:32 +02:00
goldsimon
a1c0a0185b bug #48823: posix errors should be removed from arch.h (to new file 'lwip/errno.h') 2016-10-06 13:21:00 +02:00
Dirk Ziegelmeier
13fb616bb2 Cleanup hton*/ntoh* function handling and platform abstraction
Let lwip use functions/macros prefixed by lwip_ internally to avoid naming clashes with external #includes.
Remove over-complicated #define handling in def.h
Make functions easier to override in cc.h. The following is sufficient now (no more LWIP_PLATFORM_BYTESWAP):
#define lwip_htons(x) <your_htons>
#define lwip_htonl(x) <your_htonl>
2016-10-06 12:55:57 +02:00
Dirk Ziegelmeier
95754ba95a Another try to fix bug #49264: Crash Error when LWIP_SOCKET_OFFSET is in use 2016-10-04 14:05:56 +02:00
goldsimon
cdc97d2779 Correctly fix bug #49209: netconn_drain() fails to handle 'netconn_aborted' pointer 2016-10-04 12:35:51 +02:00
goldsimon
d9c6badc55 Revert "Fixed bug #49209: netconn_drain() fails to handle 'netconn_aborted' pointer"
This reverts commit 0e2354e658.
2016-10-04 12:35:50 +02:00
Dirk Ziegelmeier
30251b1404 Fix bug #49264: Crash Error when LWIP_SOCKET_OFFSET is in use
Handle LWIP_SOCKET_OFFSET in lwip_socket_drop_registered_memberships, lwip_socket_unregister_membership and lwip_socket_register_membership.
2016-10-04 12:34:53 +02:00
Dirk Ziegelmeier
682b82aad8 Improve documentation: Some words about multiple execution contexts in lwIP 2016-09-29 12:51:45 +02:00
Dirk Ziegelmeier
633696c153 Implement consistent IPx_ADDR_ANYx macro naming between IPv4 and IPv6
- rename IP4_ADDR_ANY to IP4_ADDR_ANY4
- IP4_ADDR_ANY (= IP_ADDR_ANY) is now IPv4 any address in ip_addr_t format
2016-09-28 12:56:57 +02:00
goldsimon
0e2354e658 Fixed bug #49209: netconn_drain() fails to handle 'netconn_aborted' pointer 2016-09-28 12:53:07 +02:00
Dirk Ziegelmeier
aeae4e91db Fix compile when UDP is disabled 2016-09-06 12:30:15 +02:00
Axel Lin
ab8a1a0430 netbuf: Fixup a copule LWIP_ERROR messages
Fix trivial copy-n-paste mistake.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2016-08-31 12:23:12 +02:00
Dirk Ziegelmeier
9078f31544 Minor: memcpy -> MEMCPY / SMEMCPY 2016-08-30 21:56:09 +02:00