Commit Graph

621 Commits

Author SHA1 Message Date
Dirk Ziegelmeier
18bb74e5c5 Decouple tcpip.c/tcpip_priv.h from PPP API
PPP API can now be moved to netif/ppp subdir
2016-03-08 19:41:32 +01:00
Dirk Ziegelmeier
af1978fa4e Implement generic API message handling
Add generic tcpip_send_api_msg function
Let netif API and netconn API use it
Decouple tcpip.c and tcpip_priv.h from netif API
2016-03-08 19:41:32 +01:00
Joel Cunningham
80cc988f2f Optimize sendmsg UDP pbuf chain creation
This commit optimizes the sendmsg UDP pbuf chain creation by not
allocating/freeing a netbuf per io vector and instead building a pbuf
chain directly in the sockets layer
2016-03-07 09:26:58 -06:00
sg
076795562e fixed typo in one of the last commits 2016-03-06 20:59:50 +01:00
sg
375ec36246 ERR_IF is not necessarily a fatal error (fixes bug #46338: UDP netconns block after fatal error) 2016-03-05 16:15:04 +01:00
Dirk Ziegelmeier
bcab7fef84 netifapi.c: Fix compile when IPv4 is not enabled 2016-03-05 15:55:53 +01:00
Dirk Ziegelmeier
f4fbc90217 netifapi: Do not pass NULL pointers for IP addresses to subsequent functions
Same as in my last commits - this avoids errors in lwIP code where ip addresses are dereferenced (e.g. for IP type checking) without handling thinking about NULL pointers.
2016-03-05 14:35:29 +01:00
Dirk Ziegelmeier
094cdf1c7b netconn: Create API macros to get/set IPV6ONLY flag 2016-03-04 23:06:33 +01:00
Dirk Ziegelmeier
bd0b51c9ef Fix my previous netconn_do_listen changes in lwip_netconn_do_listen 2016-03-03 23:16:01 +01:00
Dirk Ziegelmeier
bee5515e9a netconn API: Reimplement dual-stack API to be socket-like.
When IPv6 ANY address is used and the NETCONN_FLAG_IPV6_V6ONLY is NOT set, bind/listen on/to IP_ANY_TYPE
2016-03-03 22:52:04 +01:00
Dirk Ziegelmeier
0a7f404d09 api_lib.c: Don't propagate NULL pointers as ip address to subsequent functions 2016-03-03 22:49:55 +01:00
Dirk Ziegelmeier
0c673b6a44 Implement new style TCP dual-stack in netconn API 2016-03-02 23:46:22 +01:00
Dirk Ziegelmeier
5404ce3c0a Implement support for UDP IP_ANY_TYPE in netconn API 2016-02-29 19:31:19 +01:00
goldsimon
81c8121551 minor: fixed compiler warning "unary minus operator is applied to an unsigned expression" 2016-02-26 15:23:04 +01:00
Joel Cunningham
8cb64698aa Allow backlog to be updated
This commit adds support to the sockets and netconn layer to update the
backlog by calling listen when the netconn is already in the listen state.
When backlog is not enabled, the call returns successfully

This commit also introduces a macro for setting the backlog value that
prevents a 0 sized (invalid) backlog
2016-02-25 15:19:52 -06:00
Joel Cunningham
2a8398dfb8 Fix bug in FIONREAD handling in LINUXMODE
Fix a bug in the socket API's ioctl for FIONREAD. If the socket's
lastdata was assigned the function returned without error but did not
update the argument pointer.

The cast type for argp was also changed to int to conform with the
other SO_RCVBUF handling.
2016-02-25 12:53:12 -06:00
Dirk Ziegelmeier
9a4d7b9956 Use netif_input_fn typedef instead of creating a new one in tcpip.h 2016-02-22 21:10:50 +01:00
Dirk Ziegelmeier
fe8d2ba72f Eliminate tcpip_pppos_input function 2016-02-22 21:00:00 +01:00
Dirk Ziegelmeier
777e667f08 Add generic tcpip_inpkt function that can be called to make last changes really usable 2016-02-22 20:18:10 +01:00
Dirk Ziegelmeier
fa6f068fd1 Eliminate TCPIP_MSG_INPKT_PPPOS message type.
Fix my last commit, I accidentally unchecked the wrong file in commit dialog
2016-02-22 17:47:01 +01:00
Dirk Ziegelmeier
880f1008d6 Together with Simon: Eliminate last instances of isipv6 member in pcbs;
Don't allow NULL pointers (IPv4 ANY) in connect() and sendto() functions as destinations since this does not make sense.
2016-02-22 13:03:51 +01:00
Joel Cunningham
ea94549cb2 Optimize lwip_selscan()
This makes a couple of simple re-arrangements in lwip_selscan() that
should improve performance in the following ways:

  1) The old code linearly walked all sockets to maxfd regardless of
     whether they were set in the fd set. The process involved
     acquiring sys arch protect, looking up the socket, and then
     checking if the socket was present in any of the fd sets. On
     systems with lots of sockets and a heavy SYS_ARCH_PROTECT
     infrastructure (a mutex) this can result in a lot of extra work.
     Now we skip this process for any fd that is not in the input sets
  2) If the socket from tryget_socket() is NULL we no longer continue
     and compare the input fd sets with a zeroed out set of events
  3) We no longer need to zero out our event sets because they are
     only accessed when tryget_socket() is successful

lwip_selscan() is called at most once per select call and sometimes up to three times
2016-02-18 13:17:45 -06:00
sg
9a97a80efc Fixed bug #47154 lwip_netconn_do_writemore doesn't clear conn->write_offset on fatal/routing error. 2016-02-18 19:46:20 +01:00
Joel Cunningham
9dd1c81d41 Update lwip_selscan documentation
lwip_selscan() documentation indicated exceptset is not used, which is no
longer accurate
2016-02-12 15:00:41 -06:00
Dirk Ziegelmeier
78a36df901 Netconn: Fix potential NULL pointer dereference (found by Coverity) 2016-02-10 20:39:12 +01:00
Joel Cunningham
11faa8149e Fix blocking close with LWIP_SO_SNDTIMEO
This fixes a bug in close when LWIP_SO_SNDTIMEO is enabled, but
the option is not in use on the socket

A simple mis-typed comparison against zero would cause the close_timeout
to get set to zero if conn->send_timeout was 0

The intended check was to over-ride the default close timeout if a
send timeout had been specified via SO_SNDTIMEO
2016-01-13 22:20:52 +01:00
Axel Lin
031de097db Trivial comment fix for lwip_netconn_do_disconnect()
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2016-01-04 11:54:21 +01:00
Axel Lin
a3bccae173 Catch tcpip_callback call failure
tcpip_callback_with_block() can fail with ERR_MEM or ERR_VAL, and in the
error paths the code does not post the msg to the mailbox thus the
sys_sem_wait() call might wait forever. Fix it by testing return value of
tcpip_callback() and return error immediately.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-12-05 21:41:27 +01:00
Axel Lin
bd4c4b5959 Use SYS_ARCH_SET macro at appropriate places
Use SYS_ARCH_SET to simplify the code a bit.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-12-02 22:51:08 +01:00
goldsimon
8010d6706e fixed bug #46471: lwip_accept() leaks socket descriptors if new netconn was already closed because of peer behavior 2015-11-19 07:33:55 +01:00
goldsimon
98b9d31f24 Fixed compiling with LWIP_TCP==0 2015-11-16 09:37:56 +01:00
Axel Lin
ecf9d25ed0 api_msg_c: remove superfluous NETCONN_SET_SAFE_ERR call before TCPIP_APIMSG_ACK
The TCPIP_APIMSG_ACK will call NETCONN_SET_SAFE_ERR for both
LWIP_TCPIP_CORE_LOCKING and !LWIP_TCPIP_CORE_LOCKING cases.
So remove superfluous NETCONN_SET_SAFE_ERR call before TCPIP_APIMSG_ACK.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2015-11-16 09:12:29 +01:00
sg
f518c6578c fixed bug #46321: Synchronization bug around lwip_select() and tcpip_thread() with thread-local semaphores 2015-10-29 22:20:21 +01:00
sg
2dec8f449a minor: fixed typo: even_callback -> event_callback 2015-10-29 22:18:41 +01:00
sg
f278b27119 pppapi/ppos: include tcpip_priv.h, not tcpip.h 2015-10-11 13:37:25 +02:00
Sylvain Rochet
37bb0b89f0 all: trivial include changes related to the new "lwip/priv/" include directory 2015-10-10 22:46:47 +02:00
sg
c12fa7b4c4 started to move "private" header files containing implementation details to "lwip/priv/" include directory to seperate the API from the implementation. 2015-10-09 21:58:58 +02:00
sg
fc1db87318 Fixed compiling api with LWIP_NETCONN_SEM_PER_THREAD==1 && LWIP_MPU_COMPATIBLE==1 2015-10-09 21:00:21 +02:00
goldsimon
b401f42520 minor: fixed coding style (lwip style) 2015-10-07 10:03:12 +02:00
sg
2b971400fa minor: coding style 2015-10-06 21:57:40 +02:00
sg
22df34fc70 minor/coding style: removed spaces before line ending (from file header) 2015-10-06 21:13:15 +02:00
sg
490581a0eb minor/coding style: removed spaces before line ending 2015-10-06 21:08:28 +02:00
goldsimon
5b1b430403 sockets ERR_TO_ERRNO_TABLE_SIZE: use LWIP_ARRAYSIZE() 2015-10-02 10:07:45 +02:00
Dirk Ziegelmeier
ae7eeda88a dns_found_callback should take const IP addr 2015-09-30 22:19:47 +02:00
goldsimon
dbe703cfb0 netdb: fixed warning about pointless comparison 2015-09-28 08:10:53 +02:00
goldsimon
5ad743e182 FD_SET: dump NULL-check that hides usage error, dump non-standard FD_SET_VAL 2015-09-24 15:21:03 +02:00
goldsimon
c71723101a Removed ip_2_ip4/6_c const macros again now that ip_2_ip4/6 macros keep the original const'ness 2015-09-24 14:38:52 +02:00
goldsimon
f85737bf29 Fixed const warning in lwip_writev 2015-09-24 09:30:00 +02:00
Joel Cunningham
cc4d09423a Add writev function
This commit adds compatibility with POSIX writev according to the Open
Group specification:
http://pubs.opengroup.org/onlinepubs/009695399/functions/writev.html

Implementation maps to sendmsg in the same manner that write() maps to
send()
2015-09-23 15:52:28 -05:00
Sylvain Rochet
83cddd8941 PPP: more const and mixed u_char/char types fixes 2015-09-18 20:11:09 +02:00