Axel Lin
61e90d9fc0
Use pbuf_clone to replace pbuf_alloc+pbuf_copy
...
Use pbuf_clone() to simplify the code a bit.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-12-24 12:50:30 +01:00
goldsimon
b07a481f66
Fix bug #52686 (pointer 'to' checked for NULL in lwip_sendto() may be dereferenced)
...
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-12-18 20:09:44 +01:00
Axel Lin
32788f2c74
sockets.c: use udp_is_flag_set() instead of udp_flags()
...
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-11-23 22:12:41 +01:00
Joel Cunningham
ebcae98ae6
Revert "socket/netconn recv: FIN should only be reported once (as '0' for sockets, as 'ERR_CLSD' for netconns)"
...
This reverts commit db3a4e31586f8614b0a27b482406b0c212a4e08a.
See description of regression in bug #52417
2017-11-20 13:54:11 -06:00
Joel Cunningham
6af3b4accc
netconn: Add LWIP_HOOK_NETCONN_EXTERNAL_RESOLVE (patch #9427 )
...
This adds a new hook allowing an external DNS resolver to be hooked into
netconn_gethostbyname(). The hook can handle some or all of the queries
One use case for this hook is to run mDNSResponder in the same system as LwIP
(mDNSResponder also uses LwIP's socekt APIs) and have it handle .local queries
while LwIP stack handles unicast DNS queries
2017-11-20 09:59:35 -06:00
goldsimon
2aed2fc215
sockets: prevent nested SYS_ARCH_PROTECT() for LWIP_NETCONN_FULLDUPLEX==1
2017-11-19 14:37:29 +01:00
goldsimon
f5c37c8cbb
Fix broken MSG_PEEK on TCP sockets (post-2.0.3 bug)
...
MSG_PEEK on TCP sockets was broken since commit b71d4477eab7c19c34e57e5c9a1f8add63de7879
from 06.03.2017: recv hung in an endless loop and tcp_recved() was called for peeked data
(which would result in a too large window advertised).
Aded TCP MSG_PEEK to socket unit tests
2017-11-18 13:34:20 +01:00
goldsimon
db3a4e3158
socket/netconn recv: FIN should only be reported once (as '0' for sockets, as 'ERR_CLSD' for netconns)
2017-11-17 21:22:53 +01:00
Dirk Ziegelmeier
b0344518e8
sockets.c: Don't rely on #defines in socket.h to be in sync with ip.h
...
Map SO_* to SOF_* #defines
2017-11-17 09:41:26 +01:00
Joel Cunningham
c47d161d4a
netifapi: add thread safe ARP APIs (task #14724 )
...
This adds thread safe netifapi ARP cache APIs for add/remove
2017-11-16 13:59:33 -06:00
goldsimon
245a6835f3
fixed bug #52403 : netconn: FIN may be sent instead of RST when TCP netconn is closed with pending data in recv_mbox
2017-11-15 21:12:15 +01:00
Joel Cunningham
d39e8cd827
docs: replace old reference to TCPIP_APIMSG with netconn_apimsg
2017-10-29 16:52:03 -05:00
Joel Cunningham
b18e6a8734
sockets: fix missing break regression in event_callback
...
During the refactoring in c5db278746daedcc6566822992f3f33ce3801470, the
previous gotos were removed, but the lack of break statements in
NETCONN_EVNT_RCVMINUS and NETCONN_EVT_SENDMINUS was overlooked, leading
to incorrect fall through behavior
2017-10-23 09:05:57 -05:00
Joel Cunningham
22dacc38c0
Revert "Fix two bad "fall-through" code"
...
This reverts commit a7f2ef4aec3cec5add28f35e9543f043732382e5.
The fall through is actually a regression
2017-10-23 08:59:43 -05:00
Dirk Ziegelmeier
a7f2ef4aec
Fix two bad "fall-through" code
2017-10-22 21:26:57 +02:00
Dirk Ziegelmeier
33ce04019d
Move API description text from rawapi.txt to doxygen docs
2017-10-20 18:44:58 +02:00
Nate Karstens
1960937df3
Enable support for MSG_DONTWAIT in lwip_recvmsg()
...
Enables support for MSG_DONTWAIT in lwip_recvmsg(). Support already
exists in lwip_recv_tcp() and lwip_recvfrom_udp_raw(); these are both
accessible from lwip_recvfrom(), which already supports MSG_DONTWAIT.
Signed-off-by: Nate Karstens <nate.karstens@garmin.com>
Signed-off-by: Joel Cunningham <joel.cunningham@me.com>
2017-10-19 13:55:25 -05:00
goldsimon
cf07fddf96
lwip_poll_dec_sockets_used: remove unused SYS_ARCH_DECL_PROTECT(lev);
2017-10-19 06:52:33 +02:00
Joel Cunningham
8d04f3d622
docs: correct LWIP_IPV6_MLD reference on #endif comment
2017-10-18 11:48:00 -05:00
Our Air Quality
4d21d8da23
Allow LWIP_SOCKET_OFFSET with an external FD_SET
...
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-10-16 17:07:17 +02:00
Joel Cunningham
0882e0ba89
sockets: poll clean ups
...
This makes the following poll cleanups:
1) Add LWIP_ERROR in lwip_poll to check for invalid fds/nfds combinations.
This fixes a possible a NULL fds dereference in lwip_poll_scan()
2) Use has_ copies of the socket events in lwip_poll_should_wake() rather
passing the sock pointer and accessing socket after leaving the critical
section
2017-10-16 08:06:31 -05:00
goldsimon
68d75a58df
sockets: adapt poll to LWIP_MPU_COMPATIBLE; make LWIP_SOCKET_POLL and LWIP_SOCKET_SELECT independent options
2017-09-21 22:18:55 +02:00
Kalle Olavi Niemitalo
1152fd02c0
New sockets function: lwip_poll
...
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-21 21:50:36 +02:00
goldsimon
333f1bf2bd
Fix compiling with LWIP_SOCKET_SELECT==0
2017-09-21 21:49:31 +02:00
Kalle Olavi Niemitalo
983eb8ebb4
Move select_cb list handling to functions (prepare for adding "poll")
...
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-21 21:10:08 +02:00
Dirk Ziegelmeier
438cfd3f14
Reformat sockets.c using astylerc
2017-09-17 17:50:24 +02:00
Dirk Ziegelmeier
fa33db1448
Reformat tcpip.c using astylerc
2017-09-17 17:50:24 +02:00
Dirk Ziegelmeier
dc9115334e
Reformat netifapi.c using astylerc
2017-09-17 17:50:24 +02:00
Dirk Ziegelmeier
771ac7ac44
Reformat netdb.c using astylerc
2017-09-17 17:50:24 +02:00
Dirk Ziegelmeier
bfae233e3e
Reformat netbuf.c using astylerc
2017-09-17 17:50:24 +02:00
Dirk Ziegelmeier
3d60024f9b
Reformat if_api.c using astylerc
2017-09-17 17:50:24 +02:00
Dirk Ziegelmeier
75847c8b4d
Reformat err.c using astylerc
2017-09-17 17:50:24 +02:00
Dirk Ziegelmeier
2b977a4a6a
Reformat api_msg.c using astylerc
2017-09-17 17:50:24 +02:00
Dirk Ziegelmeier
30152cea78
Reformat api_lib.c using astylerc
2017-09-17 17:50:24 +02:00
Joel Cunningham
5c0054d8ee
Remove double free on select_cb (bug #51990 )
...
This was left over after the refactoring in 92b6f83eb29c8ae697a641b7a14960decd35a6f0
2017-09-13 16:51:03 -05:00
goldsimon
92b6f83eb2
Slightly rework the fix for bug #51990 : allocate select_cb only if we actually need to wait
2017-09-12 21:37:48 +02:00
David Lockyer
72a00ca79c
Fixed bug #51990 : Calling select() from different threads with MPU enabled triggers memory protection fault
...
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-12 21:19:54 +02:00
Joel Cunningham
445eef2b0e
sockets: add readv() implementation (task #14610 )
...
Adds an implementation of readv() that calls recvmsg()
See http://pubs.opengroup.org/onlinepubs/009695399/functions/readv.html
2017-09-11 14:48:33 -05:00
goldsimon
e749678eed
Fix function signature of fcntl() for LWIP_COMPAT_SOCKETS == 2 && LWIP_POSIX_SOCKETS_IO_NAMES (see bug #51701 )
2017-08-25 22:07:14 +02:00
Axel Lin
2e4867fcde
api_msg: Remove superfluous NETIF_NO_INDEX checking
...
netif_get_by_index() returns NULL if idx is NETIF_NO_INDEX.
So remove the superfluous NETIF_NO_INDEX checking for msg->msg.jl.if_idx
before calling netif_get_by_index().
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-08-24 08:59:49 +02:00
Dirk Ziegelmeier
b9d3812ee8
Add assertion that netif index is within sane range in sockets.h.
...
We can assert here since lwIP only supports <= 255 netifs due to netif index being an u8_t.
2017-08-21 21:27:12 +02:00
Dirk Ziegelmeier
fa51a7225a
lwip_socket_drop_registered_mld6_memberships: Fix if_idx got lost :-(
2017-08-21 09:46:08 +02:00
Dirk Ziegelmeier
6082251854
Use netconn_join_leave_group_netif() in sockets.c, lwip_socket_drop_registered_mld6_memberships to avoid threading issues (reported by Joel Cunningham)
2017-08-21 09:43:34 +02:00
Dirk Ziegelmeier
f457769fe8
Add netconn_join_leave_group_netif() that takes netif index as argument
2017-08-21 09:42:57 +02:00
Dirk Ziegelmeier
d0e0afb46a
sockets.c, lwip_socket_drop_registered_mld6_memberships: Remove membership from socket_ipv6_multicast_memberships even if netif cannot be found
2017-08-21 09:30:23 +02:00
Joel Cunningham
3bdb34886c
sockets IPv6: cast interface index to u8_t
...
Interface indexes are u8_t internally so cast from sockets int representation to u8_t
This was found with MSVC 2013:
1>lwip\src\api\sockets.c(3190): warning C4242: 'function' : conversion from 'const unsigned int' to 'u8_t', possible loss of data
1>lwip\src\api\sockets.c(3698): warning C4242: 'function' : conversion from 'unsigned int' to 'u8_t', possible loss of data
2017-08-17 08:54:50 -05:00
Dirk Ziegelmeier
339ec17cf0
Fixup my last commit
2017-08-16 17:41:46 +02:00
Dirk Ziegelmeier
e58e398267
Implement IPv6 IPV6_JOIN_GROUP/IPV6_LEAVE_GROUP socket options
2017-08-16 17:41:46 +02:00
Dirk Ziegelmeier
0cf405e24f
Fix that the socket option IPV6ONLY can only be set on TCP sockets
...
Reported by Andrej Butok
2017-08-10 09:14:31 +02:00
goldsimon
47f55b02bf
Finally fix bug #50088 (socket/netconn: data before RST should be readable) and added a unit test for it
2017-08-03 22:28:50 +02:00