summaryrefslogtreecommitdiff
path: root/src/api/api_msg.c
AgeCommit message (Collapse)Author
2019-02-18Fix bug #55513: Uninitialized variable in struct netconnDirk Ziegelmeier
using patch from Karol Domagalski (cherry picked from commit 926e39935517acc16856ddd44598b3f7815efeba)
2018-07-18Revert "Test / RFC: Reformat a few files using clang-format"Dirk Ziegelmeier
This reverts commit 8b4a8159a898795ef0fc9226dae1ce66531ad487. We do not want to do this shortly before a release. Reformatting (buggy reformatting) may introduce new bugs.
2018-07-17Test / RFC: Reformat a few files using clang-formatDirk Ziegelmeier
Does it compile? Does it look good (enough)?
2018-06-20fix compiling with LWIP_NOASSERT definedSimon Goldschmidt
See bug #54157
2018-04-18LWIP_NETCONN_FULLDUPLEX: unblock rx threads on closegoldsimon
Threads blocked on the rx mbox are counted and on close, one "netconn closed" message per thread is posted to the mbox to ensure all threads are woken. The netconn can then be safely deleted. In socket API, "fd_used" and "fd_free_pending" help with auto-deleting the netconn. Signed-off-by: goldsimon <[email protected]>
2018-04-18sockets: change closing: netconn is freed when socket is closed, not beforegoldsimon
This is necessary to implement fullduplex sockets that are closed asynchronously: the netconn in the socket must not be freed before all threads have given up using it. We now call the first part of 'netconn_delete()' (moved to 'netconn_prepare_delete()') from lwip_close() and only actually end up calling 'netconn_free()' from 'free_socket()', which might be called later if LWIP_NETCONN_FULLDUPLEX is enabled. Signed-off-by: goldsimon <[email protected]>
2017-12-24Use pbuf_clone to replace pbuf_alloc+pbuf_copyAxel Lin
Use pbuf_clone() to simplify the code a bit. Signed-off-by: Axel Lin <[email protected]>
2017-11-15fixed bug #52403: netconn: FIN may be sent instead of RST when TCP netconn ↵goldsimon
is closed with pending data in recv_mbox
2017-10-29docs: replace old reference to TCPIP_APIMSG with netconn_apimsgJoel Cunningham
2017-09-17Reformat api_msg.c using astylercDirk Ziegelmeier
2017-08-24api_msg: Remove superfluous NETIF_NO_INDEX checkingAxel Lin
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 <[email protected]> Signed-off-by: Dirk Ziegelmeier <[email protected]>
2017-08-21Add netconn_join_leave_group_netif() that takes netif index as argumentDirk Ziegelmeier
2017-08-01docs: update remaining api_msg_msg referencesJoel Cunningham
This updates some remaining references to the old struct api_msg_msg (renamed to struct api_msg) in comment blocks
2017-07-05work on -Wconversion...goldsimon
2017-06-20netconn: switch gethostbyname to use tcpip_send_msg_wait_sem (task #14523)Joel Cunningham
This switches netconn_gethostbyname to use tcpip_send_msg_wait_sem to take advantage of core locking support when enabled. tcpip_send_msg_wait_sem handles blocking for the non-core locking case, so we can remove the manual blocking in netconn_gethostbyname. For the core locking case, we need to block if waiting on DNS callback. To achieve this, we unlock the core and wait in lwip_netconn_do_gethostbyname. This is the similar approach that netconn_write takes when it needs to block to continue the write (see lwip_netconn_do_write) This improves performance in the core locking case and is no change for the non-core locking case
2017-05-31Map {tcp, udp, raw}_bind_netif() functions to netconn APIDirk Ziegelmeier
2017-04-25sockets: task #14247, add CMSG and IP_PKTINFOJoel Cunningham
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-20lwip_netconn_do_close_internal: 'close' -> 'shut_close': don't override ↵goldsimon
global function names (why is this reported only now?)
2017-04-20netconn_tcp_recvd: take size_t, not u32_tgoldsimon
2017-04-19Try to fix compile without TCP (reported by Axel Lin)Dirk Ziegelmeier
2017-04-18netconn_drain(): use lwip_netconn_is_err_msg() on acceptmbox, too.goldsimon
2017-04-18api_msg: Use lwip_netconn_is_err_msg instead of NULL test in netconn_drain()Axel Lin
The NULL test no longer work after commit e0a2472706ee, it needs to test with lwip_netconn_is_err_msg() instead. Fixes: e0a2472706ee ("netconn/sockets: remove fatal error handling, fix asynchronous error handling, ensure data before RST can be received") Signed-off-by: Axel Lin <[email protected]>
2017-04-12netconn/sockets: remove fatal error handling, fix asynchronous error ↵goldsimon
handling, ensure data before RST can be received
2017-03-22api_msg:accept_function(): fix typogoldsimon
2017-03-22Possible null-pointer dereferenceMikhail Lappo
In assertion the pointer that is potentialy null is dereferenced. The check for null was located after.
2017-03-22Apply [patch #9287] Possible null-pointer dereference from Mikhail Lappo in ↵Dirk Ziegelmeier
a modified way Moved the debug output to a location where we know that newpcb != NULL Fixes possible NULL pointer dereferencing in debug message output
2017-03-04do_writemore: fix blocking bugJoel Cunningham
A bug was introduced in the atomic vector feature for blocking netconns where if we couldn't write the entire vector due to send buffer being full (write_more is 0), we would not update the vector state and then when sent_tcp() is called, it would actually re-send the previous vector and if additional calls were required to finish the write, msg.w.offset would eventually exceed msg.w.len, This was found by testing "stats" from the shell and hitting the LWIP_ASSERT in do_writemore() that checks offset < len The fix simply updates the vector state after every ERR_OK return from tcp_write(). While not all cases (non-blocking sockets) need to update the state in this case, it keeps the logic simple and also makes debugging simpler because you don't have stale vector state at any point
2017-03-02Vectorize netconn_write for TCPJoel Cunningham
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-02-24lwip_netconn_do_writemore() cleanupsJoel Cunningham
This commit makes a couple of cleanups discussed in patch #8882: 1) msg.w.offset should not be set to 0 in the error case. It is only valid when err == ERR_OK 2) Remove out-of-date comment which indicated the entire write had completed (not true for non-blocking write) This also updates the documentation on offset to include that offset is only valid when err == ERR_OK
2017-02-17Move write_offset from struct netconn to struct api_msgJoel Cunningham
This moves the write_offset variable from struct netconn to struct api_msg This optimizes the storage by only having the space claimed when it is needed (during a netconn_write_partly() call) and not throughout the lifetime of the netconn This also reduces code space/execution by not having to separately manage clearing/checking write_offset from the current_msg pointer Lastly, we also save execution by using msg.w.offset as the output rather than marshaling the result to msg.w.len. Previously, len was used as input length of dataptr and output for the write operation. netconn_write_partly() also has access to msg.w.offset, so we can use that
2017-02-16LWIP_NETCONN_FULLDUPLEX: fixed shutdown during write (bug #50274)sg
2017-01-11Minor correction to last patch: Avoid #including socket.h in api_msg.cDirk Ziegelmeier
2017-01-11lwip: fix broken default ICMPv6 handling of checksums.Knut Andre Tidemann
ICMPv6 should always have checksum generated for it as per RFC 3542 chapter 3.1.
2016-12-31added function tcp_listen_with_backlog_and_err() to get the error reason ↵sg
when listening fails (bug #49861)
2016-11-23bug #49684, api_msg: treat non-blocking ERR_MEM as ERR_WOULDBLOCKJoel Cunningham
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-17Once more: Try fix compile with clangDirk Ziegelmeier
2016-11-17Try to fix compile error with clang (found by Erik's Travis-CI)Dirk Ziegelmeier
2016-11-16Work on dual-stack netconnDirk Ziegelmeier
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-16Cleanup unmap_ipv6_mapped_ipv4() macroDirk Ziegelmeier
2016-11-16api_msg.c: Partly add support for IPv6 mapped IPv4 addressesDirk Ziegelmeier
- 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-10-14api_msg.c: Trivial code cleanupAxel Lin
Slightly improve readability by testing apiflags with NETCONN_DONTBLOCK. Also remove an empty else clause. Signed-off-by: Axel Lin <[email protected]>
2016-10-09Make lwIP compile with clang -Wdocumentation -> several documentation fixesDirk Ziegelmeier
2016-10-04Correctly fix bug #49209: netconn_drain() fails to handle 'netconn_aborted' ↵goldsimon
pointer
2016-10-04Revert "Fixed bug #49209: netconn_drain() fails to handle 'netconn_aborted' ↵goldsimon
pointer" This reverts commit 0e2354e658d9dc193d60048a8394517a41ca64ff.
2016-09-28Fixed bug #49209: netconn_drain() fails to handle 'netconn_aborted' pointergoldsimon
2016-05-23Fix several doxygen errors all over the codeDirk Ziegelmeier
2016-04-05fixed bug# 43739 (Accept not reporting errors about aborted connections): ↵sg
netconn_accept() returns ERR_ABRT (sockets: ECONNABORTED) for aborted connections, ERR_CLSD (sockets: EINVAL) if the listening netconn is closed, which better seems to follow the standard
2016-03-25Fixed possible problems with tcp_backlog_delayed/tcp_backlog_acceptedsg
2016-03-23call accept-callback with ERR_MEM when allocating a pcb fails on passive ↵sg
open to inform the application about this error; ATTENTION: applications have to handle NULL pcb in accept callback!
2016-03-22tcp: changed accept handling to be done internally: the application does not ↵sg
have to call tcp_accepted() any more. Instead, when delaying accept (e.g. sockets do), call tcp_backlog_delayed()/tcp_backlog_accepted() (fixes bug #46696)