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
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
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
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
Joel Cunningham
c5db278746
sockets: Refactor event_callback()
...
This refactors event_callback() to separate updating socket event
state from processing the select list (to apply socket event change)
Refactoring changes:
1) select_list_cb processing has been moved to a new local function called
select_check_waiters()
2) goto no_select_wakeup has been removed and now we use a flag
to track whether to call select_check_waiters()
3) There is a small functional change for !LWIP_TCPIP_CORE_LOCKING.
We call SYS_ARCH_UNPROTECT after saving events but before calling
select_check_waiters() (which now calls PROTECT before starting the loop).
Before the code held the PROTECT across saving the events and the first
loop iteration, but this didn't protect against anything because each loop
iteration we do an UNPROTECT/PROTECT
4) Better documentation for both LWIP_TCPIP_CORE_LOCKING and
!LWIP_TCPIP_CORE_LOCKING
2017-07-25 15:06:26 -05:00
goldsimon
d01b3177fd
Fix bug #51507 (Keep uses of SYS_ARCH_PROTECT/UNPROTECT in alloc_socket nested)
2017-07-20 21:18:40 +02:00
Joel Cunningham
99e1f37b82
IP_PKTINFO: set msg_controllen upon output
...
This fixes a bug where when writing IP_PKTINFO to msg_control, the
msg_controllen field was not updated with the length written
This bug is exposed by applications that provide a msg_control buffer large
enough for multiple control messages. Then when calling CMSG_NXTHDR, it
returned a next cmsg pointer even though was no additional message
2017-07-20 12:29:56 -05:00
Joel Cunningham
5cd475d91b
docs: remove 'unimplemented' tag from exceptset
...
The exceptset FDs in select() are implemented and record pending socket
errors. This removes the 'unimplemented' tag in documentation
2017-07-18 16:56:02 -05:00
goldsimon
3c371e4d52
Fixed bug #51379 : (Sockets: prevent select_waiting overflow)
2017-07-14 20:16:11 +02:00
goldsimon
c730a404d4
Make ioctl(FIONBIO) take an int*, not a u32_t* to got the *nix way
2017-07-06 20:25:41 +02:00
goldsimon
44f7a3cb0d
work on -Wconversion...
2017-07-05 22:31:58 +02:00
goldsimon
c094fcc086
Try to make gcc work without -Wno-address
2017-06-21 16:07:36 +02:00
goldsimon
11da4ef024
Use ip_addr_debug_print_val instead of ip_addr_debug_print where applicable
2017-06-21 13:26:55 +02:00
goldsimon
82b9f86b45
Fixed bug #51195 (Calling inet_pton() causes buffer overrun on a struct in6_addr)
2017-06-14 22:22:14 +02:00
goldsimon
35ba3a877d
Moved NUM_SOCKETS and struct lwip_sock to sockets_priv.h; added test case for fd_use count with select
2017-06-13 21:07:34 +02:00
goldsimon
85a85906d9
Fix bug #51122 (Mismatched socket->fd_used accounting when using lwip_select)
2017-06-13 20:58:45 +02:00
goldsimon
0bbf6490f5
setsockopt: allow SO_BROADCAST for UDP sockets only
2017-05-12 20:34:16 +02:00
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
79bd47736c
SO_BROADCAST is valid for SOCK_DGRAM only
2017-05-11 20:48:57 +02:00
goldsimon
035bf4dcb0
Fixed bug #50992 : window updated too often
2017-05-10 13:40:17 +02: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
goldsimon
082fe71c0c
fixed compiling sockets.c with LWIP_UDP==0
2017-05-03 09:01:48 +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
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