Commit Graph

5059 Commits

Author SHA1 Message Date
Dirk Ziegelmeier
13ffc86aef Start working task #14494: Implement SO_BINDTODEVICE
Implement binding TCP, UDP and RAW PCBs to a netif
2017-05-02 09:39:48 +02:00
Dirk Ziegelmeier
20fed63297 Add custom pbuf usage example to pbuf_alloced_custom() docs 2017-04-28 13:19:32 +02:00
Dirk Ziegelmeier
83d0607acf Add PBUF_NEEDS_COPY macro to documentation 2017-04-27 19:25:19 +02:00
goldsimon
1add8c14ca netif: tiny cleanup to last commit 2017-04-27 14:12:13 +02:00
goldsimon
975e29d76e fixed copy&paste error :-) 2017-04-27 12:46:14 +02:00
Dirk Ziegelmeier
1aa24ee21b Add new DHCP hooks to DHCP docs 2017-04-27 12:42:14 +02:00
Dirk Ziegelmeier
a09a8e4a06 Some documentation updates and fixes
Dedicated Zero-copy RX page
Fix doxygen warnings
2017-04-27 12:41:08 +02:00
goldsimon
6aac9377ee Clean up LWIP_NETIF_HWADDRHINT a bit: create a struct holding the hint(s) and pass a pointer to that struct around. That way we are free to add more hints if required (e.g. see task #11620) 2017-04-27 12:39:54 +02:00
Axel Lin
4c9b316e6b pbuf: Fix allocate zero length pbuf
Current code fails to allocate zero length pbuf (e.g. for PBUF_RAW PBUF_POOL),
fix it.

Fixes: eb269e61b5 ("First step to clean up pbuf implementation: add pbuf_alloc_reference() to allocate pbufs referencing external payload; move member initialization to common function; simplify PBUF_POOL chain allocator")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-04-26 20:15:22 +02:00
Joel Cunningham
fc7a68b5af sockets: fix CMSG alignment
This changes the CMSG alignment macros to ensure struct cmsghdr and data
are on a word (double word on 16-bit arch) aligned boundary

We need to ensure at least 32-bit alignment for 16-bit systems because
socklen_t could be 32-bit due to our definition
2017-04-26 08:39:44 -05:00
Dirk Ziegelmeier
c686261e1e Minor whitespace cleanup in ip.h 2017-04-26 12:28:54 +02:00
goldsimon
728aaeb528 Try to fix alignment warnings in CMSG_NXTHDR() 2017-04-26 08:55:07 +02:00
goldsimon
eac45ca284 Try to fix alignment warnings when assigning CMSG_DATA() to some struct pointer 2017-04-26 08:43:56 +02:00
goldsimon
eb269e61b5 First step to clean up pbuf implementation: add pbuf_alloc_reference() to allocate pbufs referencing external payload; move member initialization to common function; simplify PBUF_POOL chain allocator 2017-04-25 23:04:12 +02:00
goldsimon
e57552d401 pbuf_alloc_copy -> pbuf_clone 2017-04-25 22:02:07 +02:00
goldsimon
2fef874494 task #14270: DHCP should support user-defined additional options: added two hooks for adding and parsing user defined DHCP options 2017-04-25 20:18:59 +02:00
Axel Lin
471daba011 tcp_out: Fix LWIP_NETIF_TX_SINGLE_PBUF guard for not executing phase 2
This fixes build error if LWIP_NETIF_TX_SINGLE_PBUF==1.

Fixes: dd811bca06 ("Fix bug #50694 (TX exist more pbufs after enable LWIP_NETIF_TX_SINGLE_PBUF) by not executing phase 2 for LWIP_NETIF_TX_SINGLE_PBUF==1")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-04-25 20:17:47 +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
ca961b9bc2 minor whitespace cleanups only 2017-04-25 12:07:28 +02:00
goldsimon
d02bc6481f Fixed bug #50816 (netif_add() prototype depends on configuration) by adding a new function netif_add_noaddrthat doesn't change 2017-04-25 12:05:05 +02:00
goldsimon
135d506065 minor whitespace fixes only 2017-04-25 12:03:52 +02:00
goldsimon
dd811bca06 Fix bug #50694 (TX exist more pbufs after enable LWIP_NETIF_TX_SINGLE_PBUF) by not executing phase 2 for LWIP_NETIF_TX_SINGLE_PBUF==1 2017-04-25 11:18:36 +02:00
goldsimon
4b68605276 Clarify LWIP_NETIF_TX_SINGLE_PBUF (drivers might still get chained pbufs and have to take care of that, e.g. by using pbuf_alloc_copy) 2017-04-25 10:09:32 +02:00
goldsimon
dcb2cb99a1 Added 'pbuf_alloc_copy' e.g. as a single function for use with non scatter-gather drivers 2017-04-25 10:08:31 +02:00
Dmitry
42eb98c9fc Fix bugs in httpd with "LWIP_HTTPD_CUSTOM_FILES && LWIP_HTTPD_DYNAMIC_FILE_READ" when SSI tags (from '<' to '>' when they span from one read to the next or end at one read buffer) - bugs #50844 aqnd #50845
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-04-24 22:33:17 +02:00
goldsimon
9c6da979ca fixed copy&paste error in last change to lwip_itoa() 2017-04-24 13:33:43 +02:00
goldsimon
16a71473c1 Better fix for bug #50838 (mem.c needs SYS_ARCH_PROTECTION around MEM_STATS): only lock where necessary 2017-04-24 12:23:05 +02:00
goldsimon
bd483fa229 Revert "Fixed bug #50838 (mem.c needs SYS_ARCH_PROTECTION around MEM_STATS)"
This reverts commit 3770adccfd.
2017-04-24 10:29:46 +02:00
Dirk Ziegelmeier
b71878f02e Fix bug #50739: 6lowpan - IPHC de-compression bug
Apply fix provided by Aigner B.
2017-04-21 22:30:23 +02:00
Dirk Ziegelmeier
13f51a0318 Fix bug #50824: Bug in SNTP POLL mode
Ignore all broken packets
Stop timeouts only when correct packet is received
2017-04-21 22:10:52 +02:00
Joel Cunningham
ad779e5c9c doc: clarify RST handling comment
This clarifies the documentation around RST handling to document
the approach follows RFC 5961 and is not a standards violation
2017-04-21 09:27:54 -05:00
goldsimon
f4730e78f8 sntp: use randomized startup delay ([0..5] seconds) by default (if LWIP_RAND is available) 2017-04-21 13:14:48 +02:00
goldsimon
65b8316459 sntp_opts.h: adapt comment to RFC errata 2017-04-21 13:14:03 +02:00
goldsimon
554f5d7f9e sntp: fix SNTP_LI_* bits; fix todo comment 2017-04-21 13:13:56 +02:00
goldsimon
84461e90e2 mqtt: fix shadowing global 'dup' 2017-04-21 07:23:32 +02:00
goldsimon
a50ba9c748 sockets.c: try to fix debug print (again) 2017-04-20 23:03:49 +02:00
Joel Cunningham
de90d03e48 tcp: task #14128 - Appropriate Byte Counting support
This commit adds TCP Appropriate Byte Counting (ABC) support based on
RFC 3465

ABC replaces the previous congestion window growth mechanism and has been
configured with limit of 2 SMSS.  See task #14128 for discussion on
defaults, but the goal is to mitigate the performance impact of delayed
ACKs on congestion window growth

This commit also introduces a mechanism to track when the stack is
undergoing a period following an RTO where data is being retransmitted.

Lastly, this adds a unit test to verify RTO period tracking and some
basic ABC cwnd checking
2017-04-20 15:59:24 -05:00
goldsimon
e1f2c8b30c sockets.c: try to fix debug print 2017-04-20 22:55:56 +02:00
goldsimon
2358a5ac32 lwip_netconn_do_close_internal: 'close' -> 'shut_close': don't override global function names (why is this reported only now?) 2017-04-20 22:52:27 +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
1ada106d61 netconn_tcp_recvd: take size_t, not u32_t 2017-04-20 22:34:12 +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
goldsimon
b93572dca8 Document struct netvector 2017-04-20 22:00:07 +02:00
goldsimon
131d656c23 lwip_itoa: check 'bufsize' instead of ignoring it; ensure code is not stolen from GPL 2017-04-20 21:57:03 +02:00
goldsimon
3770adccfd Fixed bug #50838 (mem.c needs SYS_ARCH_PROTECTION around MEM_STATS) 2017-04-20 21:44:00 +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
Dirk Ziegelmeier
32aa9a41e2 Apply patch from Kudratov Olimjon: Array index used before limits check
while ((q != NULL) && (options[offset] != DHCP_OPTION_END) && (offset < offset_max)) {
should be
while ((q != NULL) && (offset < offset_max) && (options[offset] != DHCP_OPTION_END)) {

See https://jira.reactos.org/browse/CORE-8978 for more info.
2017-04-19 06:35:07 +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
0952e618bd netconn_drain(): use lwip_netconn_is_err_msg() on acceptmbox, too. 2017-04-18 10:54:40 +02:00
Axel Lin
0b2a652317 api_msg: Use lwip_netconn_is_err_msg instead of NULL test in netconn_drain()
The NULL test no longer work after commit e0a2472706, it needs to test with
lwip_netconn_is_err_msg() instead.

Fixes: e0a2472706 ("netconn/sockets: remove fatal error handling, fix asynchronous error handling, ensure data before RST can be received")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-04-18 10:47:42 +02:00
Joel Cunningham
f28c1c851b loopif: set pbuf if_idx during poll
This sets the pbuf's if_idx during the loopif poll function (the
equivalent netif input function).  This was found during IP_PKTINFO
development where p->if_idx is read and was uninitialized
2017-04-15 11:31:38 -05:00
goldsimon
bf01941b23 opt.h: provide LWIP_NUM_SYS_TIMEOUT_INTERNAL as default value for MEMP_NUM_SYS_TIMEOUT that can be extended by local lwipopts.h 2017-04-12 21:52:34 +02:00
goldsimon
dfc57f0289 mqtt: move struct mqtt_client_s and inner structs to new file mqtt_priv.h (to hide it from apps but provide it for tests) 2017-04-12 21:50:58 +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
26d3466f50 Add macro ETH_ADDR() to initialize a struct eth_addr with its 6 bytes and taking care of correct braces 2017-04-11 08:49:15 +02:00
Dirk Ziegelmeier
8695e6e6cb Fixup BRIDGEIF_INITDATA2 macro 2017-04-07 08:59:26 +02:00
Dirk Ziegelmeier
7ba5cc3d52 Improve bridgeif doxygen docs 2017-04-07 08:01:38 +02:00
Joel Cunningham
557a11047d Patch #9307: Replace mem_malloc+memset with mem_calloc
Aside from reducing source code, on systems which use MEM_LIBC_MALLOC,
this has the potential to improve performance depending on the underlying
memory allocator

See http://stackoverflow.com/questions/2688466/why-mallocmemset-is-slower-than-calloc
2017-04-05 14:53:24 -05:00
goldsimon
b34f2d5605 altcp: allocate altcp_pcbs from a pool, not from heap (new option MEMP_NUM_ALTCP_PCB defaults to MEMP_NUM_TCP_PCB) 2017-04-05 12:18:48 +02:00
Dirk Ziegelmeier
0f4ad57033 Fix build error in bridgeif.c 2017-04-05 08:11:37 +02:00
goldsimon
9c78909857 bridgeif: sanity-check init_data->max_ports <= BRIDGEIF_MAX_PORTS 2017-04-04 22:12:38 +02:00
goldsimon
77df9ccd5a bridgeif: fix that max_fdb_static_entries was used to init dynamic FDB 2017-04-04 22:09:31 +02:00
goldsimon
2a30fedbea fix passing NULL to netif_set_gw & netif_set_netmask (or netif_set_addr or netif_add) (broken on 18.03.2017 by 2d9ef2215b) 2017-04-04 22:08:37 +02:00
goldsimon
97f4033a8a bridgeif: improve documentation 2017-04-04 21:54:52 +02:00
goldsimon
8ed2bd4771 bridgeif: gracefully handle out-of-memory in bridgeif_fdb_init 2017-04-04 21:54:30 +02:00
goldsimon
e65a0950b2 mem_calloc: check for mem_size_t overflow when multiplying 2 mem_size_t input values 2017-04-04 21:52:01 +02:00
Dirk Ziegelmeier
6559ffd848 Fix C++ style comment in altcp_tls_mbedtls.c 2017-03-31 13:05:04 +02:00
goldsimon
33466ee6a8 dhcp_parse_reply: return ERR_VAL instead of asserting on offset-out-of-pbuf 2017-03-30 22:30:27 +02:00
goldsimon
1c57c84200 vj_uncompress_uncomp: copy from/to bigger buffers (used for checks before) instead of cs->cs_ip and ip; just to help static code analysis to see this is correct ;-) 2017-03-30 21:54:42 +02:00
goldsimon
aa0601a66d snmp_asn1_dec_tlv: explicitly check 'length_bytes > pbuf_stream->length' (for clarity, even if it would fail in pbuf_stream later) 2017-03-30 21:31:44 +02:00
goldsimon
3aa854409a pbuf_copy_partial: remove double-check of 'buf' and 'dataptr' 2017-03-30 21:29:53 +02:00
goldsimon
4313bf2a74 altcp_tls_mbedtls: fix TX when lower write returns ERR_MEM 2017-03-30 14:55:37 +02:00
goldsimon
51dbd1a7c0 altcp: added altcp_get_port() 2017-03-30 14:19:31 +02:00
Dirk Ziegelmeier
4a7569fc2d SNMP traps: Fix ignored return values 2017-03-30 13:01:10 +02:00
Dirk Ziegelmeier
132c285fd4 SNMP. Fix several ignored return values 2017-03-30 12:50:32 +02:00
Dirk Ziegelmeier
2673e635a3 Fix community string length copying - correctly handle long strings 2017-03-30 11:09:35 +02:00
Dirk Ziegelmeier
8d149e63a6 SNMP: strcpy -> strncpy, strlen -> strnlen 2017-03-30 08:57:53 +02:00
Joel Cunningham
c722261142 tcp: bug #50614: move unsent queue check/pcb->snd_buf update
This commit corrects what looks like an ancient incorrect organization
of the logic for processing an ACK which acks new data.  Once moved,
we can also change to using TCP_SEQ_LEQ on ackno instead of TCP_BETWEEN
because ackno has already been checked against snd_nxt

The work of checking the unsent queue and updating pcb->snd_buf (both
steps required for new data ACK) should be located under the conditional
that checks TCP_SEQ_BETWEEN(ackno, pcb->lastack+1, pcb->snd_nxt)

The comment following the unsent queue check/pcb->snd_buf update even
indicates "End of ACK for new data processing" when the logic is clearly
outside of this check

From what I can tell, this mis-organization isn't causing any incorrect
behavior since the unsent queue checked that ackno was between start of
segment and snd_nxt and recv_acked would be 0 during pcb->snd_buf update.
Instead this is waisted work for duplicate ACKS (can be common) and other
old ACKs
2017-03-29 16:24:54 -05:00
goldsimon
720f9b3a0b fix compiling altcp_tls_mbedtls sources/headers if mbedtls is not available 2017-03-29 23:02:16 +02:00
goldsimon
856b49a057 lwip_sendmsg: fix check for unsupported flags 2017-03-29 22:38:16 +02:00
goldsimon
5d600f72d2 bridgeif_input: check netif != NULL before calling netif_get_client_data() 2017-03-29 22:27:00 +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
Dirk Ziegelmeier
33e3ee0790 Clarify LWIP_ALTCP_TLS usage a bit 2017-03-29 08:52:19 +02:00
Dirk Ziegelmeier
8fd90ea136 improve mqtt documentation 2017-03-29 08:43:27 +02:00
Dirk Ziegelmeier
fbcdb4d9f1 Fix function name in altcp.c 2017-03-29 08:22:35 +02:00
Dirk Ziegelmeier
2ca717e18d altcp_tls.h: Document ARM mbedtls port 2017-03-28 21:34:00 +02:00
Dirk Ziegelmeier
40df1474cc SNMP: Advertise SNMPv3 support 2017-03-28 21:33:37 +02:00
Dirk Ziegelmeier
3266511ebb Improve documentation, add TLS stuff 2017-03-28 21:25:49 +02:00
Dirk Ziegelmeier
9b6192bd65 Create smtp_opts.h and add SMTP client to doxygen docs 2017-03-28 21:14:56 +02:00
Dirk Ziegelmeier
f7ac739022 Correct a few header #include guards 2017-03-28 20:44:39 +02:00
Dirk Ziegelmeier
b9dffc5e4b Filelists.mk: Move all mbedtls related files to own section 2017-03-28 20:42:21 +02:00
Dirk Ziegelmeier
3826bcceab Move SMTP from contrib to main lwIP rep - with TLS support, it becomes useful again 2017-03-28 20:40:47 +02:00
Dirk Ziegelmeier
38651b8069 Cleanup #include structure of altcp_tls a bit
(as discussed with Simon today)
2017-03-28 20:31:25 +02:00
goldsimon
b09b3fa4e6 altcp_tcp: some more debug checks 2017-03-28 16:20:20 +02:00
goldsimon
898d3832a7 more fixes for !LWIP_ALTCP: move mqtt client struct definitions to mqtt.c 2017-03-28 14:12:22 +02:00
goldsimon
537c258efa httpd/altcp: add forgotten functions 2017-03-28 14:04:40 +02:00
Dirk Ziegelmeier
7599706808 One more try to fix mqtt.c 2017-03-28 12:30:26 +02:00
Dirk Ziegelmeier
1c5237b6c4 Try to fix build of mqtt after ALTCP_TLS changes 2017-03-28 11:48:01 +02:00
goldsimon
8b6b270287 mqtt: clean up struct prototypes a bit 2017-03-28 09:20:59 +02:00
goldsimon
8673610f3f mqtt: add TLS support 2017-03-28 09:19:32 +02:00
goldsimon
26a6e034fc mqtt: convert to altcp API 2017-03-28 09:14:35 +02:00
goldsimon
1dfe916808 altcp_tcp: use 'void* state' to store tcp_pcb, not 'altcp_pcb* inner_conn' 2017-03-28 09:09:13 +02:00
goldsimon
881ab3011e mqtt: pass client_user/client_pass to server if != NULL 2017-03-27 22:25:26 +02:00
goldsimon
ca43e64d35 minor: fixed typo in doc 2017-03-27 12:23:02 +02:00
Daniel Elstner
751ee7a534 SNTP: Implement round-trip delay compensation
Introduce a new configuration define SNTP_COMP_ROUNDTRIP to compensate
for network round-trip delays when setting the system clock from SNTP.
Note that this feature requires compiler support for 64-bit arithmetic.
2017-03-27 10:43:03 +02:00
Daniel Elstner
cc77b308a4 SNTP: Unify timestamp extraction from response packet
Avoid piecemeal invocation of pbuf_copy_partial() for each SNTP header
field. The new code may sometimes copy more than necessary, but the
complexity is reduced.
2017-03-27 10:43:02 +02:00
Daniel Elstner
2fa9cd8530 SNTP: Streamline timestamp handling
Generalize the NTP timestamp conversion arithmetic, and provide hooks
for using native NTP timestamps when setting or getting the system
clock time. Convert microseconds to a fraction as needed when getting
the system time.
2017-03-27 10:43:01 +02:00
Daniel Elstner
9323ad3211 arch: Optionally support 64-bit integers 2017-03-27 10:43:00 +02:00
goldsimon
596bddac47 altcp: added raw tcp fallback for altcp_get_ip() #if !LWIP_ALTCP 2017-03-26 22:29:18 +02:00
goldsimon
425b2dda61 altcp_get_ip: added altcp_get_ip(), added default functions that only defer a call to the inner_conn (moved from tls_mbedtls to generic altcp) 2017-03-26 22:26:40 +02:00
goldsimon
1ab89ed5e6 bridgeif: fixed IPv6-only build 2017-03-26 20:52:05 +02:00
goldsimon
6add16e36b altcp_tls_mbedtls: fixed memory leak introduced by delayed deallocation 2017-03-25 20:35:46 +01:00
goldsimon
0581a77731 Prepare altcp_tls_mbedtls for TLS clients (not fully tested yet) 2017-03-24 15:25:43 +01:00
goldsimon
540b527cf4 remove LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS config option (this is implicitly done via #ifdef LWIP_RAND) 2017-03-24 14:29:06 +01:00
goldsimon
a2bc02d682 altcp_tls_mbedtls: improve sent/recved handling 2017-03-23 22:04:36 +01:00
goldsimon
1ddb125e2c altcp_tls_mbedtls_mem: fix compiling for sizeof(mem_size_t) < sizeof(size_t) 2017-03-23 12:15:54 +01:00
goldsimon
d71653f049 sockets.c: fix compiling in release mode 2017-03-23 10:44:28 +01:00
Dirk Ziegelmeier
819224f0e5 Fix bug #50618: dhcp_remove_struct() macro does not work
Patch by Benjamin Silvestre
2017-03-23 09:52:13 +01:00
goldsimon
a49e040072 sockets: remove select_cb definitions #if !LWIP_SOCKET_SELECT 2017-03-23 08:34:56 +01:00
goldsimon
5149141790 altcp_tls: remove declarations #if !LWIP_ALTCP_TLS 2017-03-23 08:34:36 +01:00
goldsimon
1e26652d2e renamed altcp_mbedtls files to altcp_tls_mbedtls 2017-03-23 08:34:02 +01:00
Dirk Ziegelmeier
ab736a4764 Add altcp to doxygen docs 2017-03-22 23:32:32 +01:00
Dirk Ziegelmeier
7e12240af3 Improve TCP documentation a bit 2017-03-22 23:32:17 +01:00
Dirk Ziegelmeier
d04dc46ccb Add altcp_tls to Filelists.mk
Some compile fixes in altcp_mbedtls.c
2017-03-22 23:09:48 +01:00
Dirk Ziegelmeier
060a47f88a Add altcp to Filelists.mk
Some compile fixes in altcp_tcp.c and httpd.c
2017-03-22 22:57:50 +01:00
Mikhail Lappo
7eba14cb76 Possible null-pointer dereference
The value should be dereferenced after
assertion is performed. This can lead
to crash
2017-03-22 22:50:16 +01:00
Mikhail Lappo
08cb949aea Fread return value unused
Assert that fread was able to read
specified amount of chunks
2017-03-22 22:47:15 +01:00
goldsimon
8360054884 sanity check hdr_buf size 2017-03-22 22:46:49 +01:00
Mikhail Lappo
89b6fa479e Possible out of bound exception
hdr_buf has size of 4096. Makes sense to assert that
we do not exceed this size before copying there
2017-03-22 22:45:06 +01:00
goldsimon
d386374449 httpd: add support for https 2017-03-22 22:42:09 +01:00
goldsimon
afaa7d9561 httpd: prepare for https: move initialization code to shared function 2017-03-22 22:41:24 +01:00
goldsimon
2f3b00efb4 httpd: convert to altcp API (a simple search & replace...) 2017-03-22 22:33:50 +01:00
goldsimon
967d4fc3b0 LWIP_ALTCP: default to off for maximum backwards compatibility... 2017-03-22 22:33:23 +01:00
goldsimon
c18393b52b altcp: added 'addrinfo' and 'tcp_state' functions 2017-03-22 22:29:11 +01:00
goldsimon
a46664eab2 Add opts header for altcp_tls 2017-03-22 21:40:32 +01:00
goldsimon
82d9e45f74 Add protoypes for TLS connections for the new altcp API + an implementation doing HTTPS (server mode for now) with mbedTLS (ATTENTION: this might not be coded secure enough for productive use yet!) 2017-03-22 21:33:05 +01:00
goldsimon
e8e247f22e Add "application layered TCP connection API (altcp)"
altcp is an abstraction layer that prevents applications linking against the
tcp.h functions but provides the same functionality. It is used to e.g. add
SSL/TLS or proxy-connect support to an application written for the tcp callback
API without that application knowing the protocol details.
Applications written against the altcp API are directly linked against the
tcp callback API for LWIP_ALTCP==0, but then cannot use layered protocols.
2017-03-22 21:31:14 +01:00
goldsimon
d58457de43 tcp: move some higher level definitions from tcp.h to new file tcpbase.h (in preparation for altcp API) 2017-03-22 21:15:46 +01:00
goldsimon
ee5021deb1 tftp_server: fix bogus comment lines in file header 2017-03-22 21:14:36 +01:00
goldsimon
ba20cd229e api_msg:accept_function(): fix typo 2017-03-22 21:12:09 +01:00
Mikhail Lappo
eba1b971c0 Possible null-pointer dereference
In assertion the pointer that is potentialy
null is dereferenced. The check for null was
located after.
2017-03-22 15:50:34 +01:00
Dirk Ziegelmeier
9e20fe2cfb Apply [patch #9287] Possible null-pointer dereference from Mikhail Lappo in 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-22 14:58:13 +01:00
goldsimon
c3912e35f6 httpd: regenerate example fs (fsdata.c) with current makefsdata 2017-03-21 13:06:26 +01:00
goldsimon
ec24a2a4e8 Revert "httpd: regenerate example fs (fsdata.c) with current makefsdata"
This reverts commit 66fb52ff5c.
2017-03-21 12:57:56 +01:00
goldsimon
66fb52ff5c httpd: regenerate example fs (fsdata.c) with current makefsdata 2017-03-20 22:19:54 +01:00
goldsimon
d11292505b httpd: use capital 'T' for content types, add more content types, provide the possibility to add more content types at compile time (HTTPD_ADDITIONAL_CONTENT_TYPES) 2017-03-20 22:19:05 +01:00
Dirk Ziegelmeier
2d9ef2215b Fix bug #50576: LWIP_NSC_IPV4_GATEWAY/NETMASK/SETTINGS_CHANGED should check if the setting is actually being changed 2017-03-18 15:30:20 +01:00
goldsimon
aef2accfa3 try to satisfy clang's '-Wempty-body' 2017-03-17 11:22:30 +01:00
goldsimon
3fd8440ab9 memp.h: added missing include 2017-03-17 08:55:10 +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
fc47f846ed Fix and improve sockets unit test and unit test sys_arch (with a little help of tcpip.c) 2017-03-16 22:49:38 +01:00
goldsimon
8313c4d870 tried to add basic socket unit tests (nonsense only for now); made LOCK_TCPIP_CORE()/UNLOCK_TCPIP_CORE() overridable for that 2017-03-16 21:52:30 +01:00
goldsimon
2d8e17aa89 sockets: guard declaration of 'lwip_select()' with LWIP_SOCKET_SELECT==1 2017-03-16 09:18:53 +01:00
goldsimon
e71dbec587 bridgeif: fix compiling with NO_SYS==1 by changing default value of BRIDGEIF_PORT_NETIFS_OUTPUT_DIRECT 2017-03-16 09:18:28 +01:00
Dirk Ziegelmeier
d9b279d150 Cleanup documentation a bit: rename "Addons" to "NETIFs" - its a more appropriate name 2017-03-15 20:03:55 +01:00
Dirk Ziegelmeier
6328da87aa Add bridge interface to documentation 2017-03-15 19:58:32 +01:00
goldsimon
2dcf31d6b1 bridgeif: better separation between bridgeif and fdb (todo: move fdb to contrib?), tried to fix the build for LWIP_NUM_NETIF_CLIENT_DATA==0 2017-03-15 16:50:55 +01:00
goldsimon
946b231516 lwip_init(): at least IAR warns about "LWIP_UNUSED_ARG(a)" accessing an uninitialized variable... Try to fix this by initializing it (it will be optimized away anyway) 2017-03-15 16:47:59 +01:00
goldsimon
51a07661cc Added a simple multi-netif 802.1d bridge implementation to show that a multi-port netif works (see task #14369) 2017-03-15 12:31:12 +01:00
Dirk Ziegelmeier
1f1f2e1c46 Try to fix line endings of tftp_server.c in git rep 2017-03-14 09:12:25 +01:00
goldsimon
754e49643f set version to 2.0.3.dev now that 2.0.2 is released 2017-03-14 09:06:06 +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
Dirk Ziegelmeier
59973c96e4 Fix bug #50534: TFTP server does not copy terminating null of filename
Patch by David Rodgers
2017-03-13 21:26:06 +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
Dirk Ziegelmeier
1371400c2b mdns_domain_add_label_base should be static 2017-03-11 10:41:47 +01:00
goldsimon
7bcb4eafec mdns: minor(?) stack usage and performance improvement by letting mdns_readname_loop() copy from pbuf to struct (instead of pbuf->buffer->struct) 2017-03-10 23:00:46 +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
goldsimon
7ffe5bfb3c tcp: watch out for pcb->nrtx overflows and tcp_backoff indexing overflow 2017-03-09 13:29:41 +01:00
David van Moolenbroek
5827c168c2 tcp: do not keep sending SYNs when getting ACKs
If a locally generated TCP SYN packet is replied to with an ACK
packet, lwIP immediately sends a RST packet followed by resending the
SYN packet.  This is expected, but on loopback interfaces the resent
SYN packet may immediately get another ACK reply, typically when the
other endpoint is in TIME_WAIT state (which ignores the RSTs).  The
result is an endless loop of SYN, ACK, RST packets.

This patch applies the normal SYN retransmission limit in this
scenario, such that the endless loop is limited to a brief storm.
2017-03-09 13:22:49 +01:00
Joel Cunningham
b90a54f989 bug #50476: initialize ssthresh to TCP_SND_BUF
This commit changes ssthresh to be the largest effective congestion
window (amount of in-flight data). This follows the guidance of RFC
5681 which recommends setting ssthresh arbitrarily high.

LwIP was previously using the receive window value at the end of the
3-way handshake and in the case of an active open where the receiver
used window scaling and/or window auto-tuning, this resulted in a very
small ssthresh value even though the window ramped up once the connection
was established
2017-03-08 16:36:35 -06:00
Joel Cunningham
fd9ac30062 Fix dual-stack build failure in lwip_sendmsg
This corrects a typo introduced in c9d0192b4a
that broke the build for dual-stack (IPv4 and IPv6)
2017-03-08 16:34:49 -06:00
Sylvain Rochet
e16d10ade6 PPP: remove unused and confusing return values other than ERR_OK for ppp_connect and ppp_listen
User should not use ppp_connect or ppp_listen return value to retry
later, it must wait for the callback to be called. This is primarily
done this way to have a consistent behavior with and without the
holdoff feature.

Remove returned error value from PPP link level API connect and listen
callbacks because we are not using them anymore, then make ppp_connect
or ppp_listen to always return ERR_OK, thus we are not breaking the PPP
user API.

We don't need the return code here, all PPP link level drivers can't
fail at all (e.g. PPPoS) or retry if necessary (PPPoE and PPPoL2TP).
2017-03-08 22:17:40 +01:00
goldsimon
aff1935e40 arch.h: include <limits.h> if it exists (at least INT_MAX is used) 2017-03-08 20:30:48 +01:00
goldsimon
c9efb7a72c added missing define for MSG_NOSIGNAL 2017-03-08 19:57:10 +01: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
270fdfff07 netconn_write_vectors_partly() watch out for overflow of data to send (must fit into INT_MAX for sockets) 2017-03-07 21:30:03 +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
5c33efe430 minor: indentation fix 2017-03-07 20:37:52 +01:00
goldsimon
194803a3a7 netbuf: correctly reset netbuf checksum for LWIP_CHECKSUM_ON_COPY==1 2017-03-07 20:37:06 +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
f0bc2fa968 netconn_tcp_recvd should take u32_t, not u16_t (as used in msg) 2017-03-06 22:20:41 +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