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
a50ba9c748
sockets.c: try to fix debug print (again)
2017-04-20 23:03:49 +02:00
goldsimon
e1f2c8b30c
sockets.c: try to fix debug print
2017-04-20 22:55:56 +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
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
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
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
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
856b49a057
lwip_sendmsg: fix check for unsupported flags
2017-03-29 22:38:16 +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
goldsimon
d71653f049
sockets.c: fix compiling in release mode
2017-03-23 10:44:28 +01:00
goldsimon
a49e040072
sockets: remove select_cb definitions #if !LWIP_SOCKET_SELECT
2017-03-23 08:34:56 +01:00
goldsimon
d9a738d85f
sockets: fix lwip_getsockname/lwip_getpeername for dual-stack: ip_addr_t type "any" (dual) has to be converted to AF_INET6
2017-03-17 08:54:51 +01:00
goldsimon
eb1aadb218
implement udp/raw recvmsg() by moving recvfrom() into a common function taking an array of iovecs... (IP_PKTINFO/in_pktinfo still missing)
2017-03-13 22:31:17 +01:00
goldsimon
cb1a271c61
lwip_recvmsg: MSG_PEEK must be limited to the first iov for TCP
2017-03-11 20:42:59 +01:00
goldsimon
5752b24d38
fix bug #50503 : LWIP_NETCONN_FULLDUPLEX: some LWIP_ERROR paths don't call done_socket()
2017-03-10 11:52:59 +01:00
goldsimon
1b14c2e7b0
sockets: fix printf warning in gcc
2017-03-10 07:56:14 +01:00
goldsimon
2c77560870
My first try at 'recvmsg()', TCP only, for now...
2017-03-09 21:49:55 +01:00
Joel Cunningham
fd9ac30062
Fix dual-stack build failure in lwip_sendmsg
...
This corrects a typo introduced in c9d0192b4aa5753a1a71fa23fc910dcd82d64eb9
that broke the build for dual-stack (IPv4 and IPv6)
2017-03-08 16:34:49 -06:00
goldsimon
c797222407
lwip_sendmsg: implement EMSGSIZE checks
2017-03-07 21:48:59 +01:00
goldsimon
c9d0192b4a
lwip_sendmsg: small performance improvement: netbuf can be allocated on the stack as it is used internally only (see lwip_sendto)
2017-03-07 21:43:23 +01:00
goldsimon
4dd378b126
socket sendto: gracefully handle 'size' not fitting into an u16_t (return EMSGSIZE error) see task #14378
2017-03-07 20:56:37 +01:00
goldsimon
c6c693923e
One more try to fix the build...
2017-03-07 09:45:01 +01:00
goldsimon
53f717338b
sockets: fixed printf format (not reported by mingw port due to -Wno-format)
2017-03-07 08:59:26 +01:00
goldsimon
b71d4477ea
socket tcp performance tweak: handle window update (call into tcpipi_thread) only once per recv for multi-segment receives
2017-03-06 22:22:22 +01:00
goldsimon
f02119af62
lwip_recvfrom: fix tcp socket error handling
2017-03-06 22:13:58 +01:00
goldsimon
04bff63f49
sockets: netconn event callback is only used for select (nonblocking sockets are now implemented at netconn layer) -> add option LWIP_SOCKET_SELECT to reflect this
2017-03-06 22:06:53 +01:00
goldsimon
c77a7fe824
lwip_recv_tcp: fix full-duplex: remove invalid calls to done_socket()
2017-03-06 22:03:02 +01:00
goldsimon
30be7b582e
sockets: remove sock->lastoffset and free unused pbufs instead (using pbuf_free_header)
2017-03-06 21:54:50 +01:00
goldsimon
c295717ce7
sockets: clean up all the if/else in lwip_recvfrom and use new nonblocking features in netconn API: I'm OK with code duplication if it gets more readable :-/
2017-03-06 21:50:42 +01:00
Joel Cunningham
2980f7cc58
Vectorize netconn_write for TCP
...
This commit adds support to the netconn write APIs to take an input of
vectors instead of a single data pointer
This allows vectors sent on a TCP connection via sendmsg to be treated
atomically. The set of vectors is segmented into as much data as can
fit into the send buffer and then the TCP output function is called
Previously, each vector was passed to netconn_write_partly and tcp_write
segmented it into its own packet, which was then it was sent via
tcp_output (if not Nagleing)
This commit adds vector support to lwip_netconn_do_writemore() which
is the meat of the TCP write functionality from netconn/sockets layer.
A new netconn API netconn_write_vectors_partly() takes a set of vectors
as input and hooks up to do_writemore()
This commit also defines IOV_MAX because we are limited to only
supporting 65535 vectors due to choice of u16_t for the vector count
2017-03-02 16:52:14 -06:00
goldsimon
3feb748fee
Simplify lwip_accept() and lwip_ioctl() by relying on nonblocking netconn functions instead of sock->rcvevent
2017-03-02 20:47:02 +01:00
goldsimon
1b3aaef525
lwip_sendmsg/tcp: prevent PSH until all iovecs are enqueued
2017-03-02 09:27:32 +01:00
Dirk Ziegelmeier
9ab2eefc37
Fix documentation in sockets.c
2017-02-26 09:42:06 +01:00
goldsimon
a38e937dd6
fixed close race conditions in lwip_select (for LWIP_NETCONN_FULLDUPLEX)
2017-02-24 21:29:29 +01:00
goldsimon
f4d13d52d3
fixed get_socket, fixed LWIP_SOCKET_OFFSET != 0
2017-02-24 21:23:53 +01:00
goldsimon
8bb43e7388
Added a few missing calls to done_socket()
2017-02-24 21:11:20 +01:00
goldsimon
6786c9f143
Start working on bug #44032 : added sock->fd_used that is != 0 when at least one thread is using a socket
2017-02-24 21:00:01 +01:00
goldsimon
9afe10e23d
make get_socket use tryget_socket, added tryget_socket_unconn in preparation of properly fixing bug #44032
2017-02-24 20:49:18 +01:00