Commit Graph

6222 Commits

Author SHA1 Message Date
goldsimon
d4c4b0eec5 rename folder 'src/apps/httpd' to 'http'
Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-15 20:13:25 +01:00
goldsimon
58de2af5f2 test/fuzz: add some applications, add an experimental multi-packet mode
The experimental multi-packet mode splits input bytes depending on a length
decoded from the first 2 bytes and does that until the end of input.
To use this mode, compile with "make D=-DLWIP_FUZZ_MULTI_PACKET"

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-15 14:35:08 +01:00
goldsimon
cd1516e2e4 mqtt: rewrote check for topc_len so that coverity is happy... 2018-02-15 09:15:40 +01:00
goldsimon
216f21dcd1 simple whitespace cleanup 2018-02-15 06:41:16 +01:00
Axel Lin
5d5b8fbb46 Fix trivial copy & paste mistake for comment in header files
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-02-14 22:49:12 +08:00
goldsimon
133bf70ab5 mqtt: slightly change some overflow checks 2018-02-14 12:37:35 +01:00
goldsimon
eea95459c9 mqtt: add more length validity checks in mqtt_message_received
This also (but not only) fixes bug #52345 ("MQTT buffer length check seems wrong")
2018-02-14 12:08:15 +01:00
goldsimon
546a8c4860 Revert "vj_compress_tcp: help coverity to see we're not accessing out of bounds (this is a union)"
This reverts commit 2390eb6826.
I've already marked other issues like this as 'invalid', so do this here, too.
Although I don't like the code, there's not much use in fixing this in one place only.
2018-02-14 07:34:05 +01:00
goldsimon
e926779510 netif_alloc_client_data_id: only present if LWIP_NUM_NETIF_CLIENT_DATA
In contrast to netif_get_client_data, netif_alloc_client_data_id() is only
available if LWIP_NUM_NETIF_CLIENT_DATA > 0, not for DHCP etc.

This is correct in netif.c but wrong in netif.h
2018-02-14 07:19:46 +01:00
goldsimon
731336223f mqtt: add comments in mqtt_parse_incoming 2018-02-14 06:54:56 +01:00
Joel Cunningham
618a28fc53 memp: remove include of sockets.h
Socket memory pool types have been migrated to sockets_priv.h so we
no longer need to include sockets.h
2018-02-13 14:04:01 -06:00
goldsimon
2390eb6826 vj_compress_tcp: help coverity to see we're not accessing out of bounds (this is a union) 2018-02-13 12:47:00 +01:00
goldsimon
5ee77262bc mem plug_holes: fix copy& paste error 2018-02-13 12:24:10 +01:00
goldsimon
bcb6819715 dns_compare_name: change check for u16_t overflow
check upper border (0xFFFF) instead of checking for 0 after overflow
2018-02-13 12:23:50 +01:00
goldsimon
d4047ea1d1 Try to fix issues reported by coverity 2018-02-13 12:10:19 +01:00
goldsimon
e20e9bc3d4 Try to fix issues reported by coverity 2018-02-13 12:09:18 +01:00
Dirk Ziegelmeier
d5d635cdce Minor DNS documentation improvement 2018-02-13 10:58:32 +01:00
Axel Lin
47946a29e9 memp: Remove include of lwip/netifapi.h from memp.c
struct netifapi_msg is defined in lwip/priv/api_msg.h rather than
lwip/netifapi.h. Thus remove include of lwip/netifapi.h from memp.c.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-02-13 16:52:18 +08:00
goldsimon
b5e67f142a tcp: LWIP_CHECKSUM_ON_COPY: fix adding data to retx segment
See bug #50914( TCP_CHECKSUM_ON_COPY when adding data to
retransmission): when adding data to an already transmitted segment
that has an uneven length, the checksum was wrong.

To fix this, tcp_output_segment has to restore seg->chksum_swapped
before returning.
2018-02-12 12:38:17 +01:00
goldsimon
7b6d2870ca test: add a unit test for TCP_CHECKSUM_ON_COPY with retransmissions
This triggers bug #50914 (TCP_CHECKSUM_ON_COPY when adding data to
retransmission) when data is added to an already transmitted segment
with an uneven length of tcp data.
2018-02-12 12:34:45 +01:00
goldsimon
cff31ba5de test: enable LWIP_CHECKSUM_ON_COPY and TCP_CHECKSUM_ON_COPY_SANITY_CHECK
To find and verify bug #50914 (TCP_CHECKSUM_ON_COPY when adding data to
retransmission), enable checksum-on-copy for the unit tests.
2018-02-12 12:32:40 +01:00
Dirk Ziegelmeier
093adf8322 Fix typo in MQTT port #define 2018-02-11 11:57:22 +01:00
goldsimon
8fa55e32d2 add MEM_OVERFLOW_CHECK and combine code with MEMP_OVERFLOW_CHECK
This moves untouched memory check and defines from memp.c and memp_priv.h
to mem.c and mem_priv.h (which is new).
2018-02-09 13:44:10 +01:00
goldsimon
010b0210ba netif: ext_callback: make LWIP_NSC_ defines, not an enum; fix mdns accordingly
Re-applied after reverting d6e58d02a6
2018-02-08 12:36:26 +01:00
goldsimon
f201d261b2 Revert "MDNS send probes to verify domain before use"
This reverts commit d6e58d02a6.
Erik seems to have commit this by accident. Let's discuss this first
(see patch #9555)
2018-02-08 12:28:04 +01:00
goldsimon
3cf906e073 Revert "netif: ext_callback: make LWIP_NSC_ defines, not an enum; fix mdns accordingly"
This reverts commit 6934bb4428.
Need to revert commit d6e58d02a6 first, and that one produced merge conflicts.
2018-02-08 12:26:16 +01:00
Joel Cunningham
d785561eae tcpip: guard tcpip_msg enum/struct member with !CORE_LOCKING
enum tcpip_msg_type and struct tcpip_msg have members which are only
used when core locking and/or core locking input are disabled. Remove
these from the union to reduce the size. Remove from enum to prevent
usage when these are options are disabled

A quick sizeof test with MSVC 2013 showed a 4 byte size reduction for
struct tcpip_msg (16 bytes -> 12bytes) for the following configuration:
  LWIP_TCPIP_CORE_LOCKING        1
  LWIP_TCPIP_CORE_LOCKING_INPUT  1
  LWIP_TCPIP_TIMEOUT             0
2018-02-07 16:03:41 -06:00
goldsimon
f7be3d10ae httpd: create "connection" and "content-length" headers when file is ready
see patch #9500
2018-02-07 21:27:42 +01:00
goldsimon
e8d7e82c8c httpd: fix simple typo 2018-02-07 21:19:07 +01:00
goldsimon
f9300c1fb0 netif: ext_callback: clean up netif_set_addr after last change 2018-02-07 20:37:29 +01:00
goldsimon
6934bb4428 netif: ext_callback: make LWIP_NSC_ defines, not an enum; fix mdns accordingly 2018-02-07 20:35:49 +01:00
Joel Cunningham
030ffdee82 sockets: remove ERR_CLSD case after data receive
With the changes introduced in b1b6275110
it's no longer possible to get ERR_CLSD from netconn_recv_tcp_pbuf_flags
after we've received data because of the NETCONN_NOFIN flag, so remove
handling for this case. Further the NETCONN_EVT_RCVPLUS stays active in
netconn_recv_data_tcp when the NETCONN_NOFIN flag is used
2018-02-05 13:50:16 -06:00
goldsimon
b1b6275110 socket/netconn recv: FIN should only be reported once
FIN should only be reported once (as '0' for sockets, as 'ERR_CLSD' for
netconns). Before this change, ERR_CLSD was returned forever...

This is the 2nd try. First try (commit ebcae98ae6)
was buggy in that it could drop the FIN if it was read together with data
(reverted in commit ebcae98ae6).

This version fixes this by adding an apiflag and a netconn flag to keep
track of this.
2018-02-04 20:16:53 +01:00
goldsimon
fe828634ac socket unit test: check receiving FIN together with data works 2018-02-04 20:14:02 +01:00
goldsimon
dc882801bb tcp: document TCP_EVENT_ERR exception for SYN_RCVD 2018-02-04 14:19:39 +01:00
goldsimon
2a4dd0dc7b altcp: priority-based pcb/conn allocation required
altcp_tcp_new_ip_type: allocate the tcp pcb first to invoke the
priority handling code if we're out of pcbs
2018-02-04 14:00:23 +01:00
goldsimon
f9bc3cae5d docs: make hook documentation a little nicer 2018-02-04 13:36:41 +01:00
goldsimon
c6b5527710 Improve LWIP_ASSERT_CORE_LOCKED documentation a bit 2018-02-04 13:20:55 +01:00
goldsimon
9d087ad2d2 Add LWIP_ASSERT_CORE_LOCKED() to ppp (see task #14780)
Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-03 22:13:32 +01:00
goldsimon
ea2e628ac3 httpd: get_http_headers: refactor decision for add_content_len 2018-02-03 21:58:45 +01:00
goldsimon
1a75112b47 httpd: ensure hs->keepalive is 0 if content length is not sent
Connections for custom files without the persistent flag were not
closed without this change.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-03 21:53:44 +01:00
goldsimon
053a5e6e13 httpd: get_http_headers: fix content length check for custom files
Headers are never included here or else get_http_headers would not
have been called.

As a result, custom files need to set FS_FILE_FLAGS_HEADER_PERSISTENT
in file->flags if file->len is the correct length of the file.

See also patch #9500

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-03 21:51:33 +01:00
goldsimon
d5d30d49f2 httpd: check that file data is present when dynamic read is disabled
Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-02 21:31:36 +01:00
Erik Ekman
23c933fd16 Fix annotation in function documentation
clang failed to build:

../../../../lwip/src/include/lwip/tcp.h:180:11: error: parameter 'ERR_OK' not found in the function declaration [-Werror,-Wdocumentation]
 * @param ERR_OK if OK, any error if connection should be dropped
          ^~~~~~
2018-02-02 11:13:35 +01:00
Jens Nielsen
d6e58d02a6 MDNS send probes to verify domain before use 2018-02-02 11:10:09 +01:00
goldsimon
6706b3778e httpd: add "struct file*" parameter to httpd_cgi_handler() callback 2018-02-02 09:29:52 +01:00
Giuseppe Modugno
ab281cb750 httpd: move httpd_cgi_handler() call
This patch moves in advance httpd_cgi_handler() call, before assigning
variables like hs->file and hs->left.

In this way, CGI handler could prepare the reply data and set the
"file properties", like file->data and file->len. At the exit, hs->file
and hs->left is correctly assigned.

The handler prototype says it can't access file pointer, however it is
simple to obtain it after setting LWIP_HTTPD_FILE_STATE that enables a
"file state" pointer. It is sufficient to assign file->state to file
itself in fs_open_custom().

For example, I have the request GET /login.cgi?user=admin&pwd=admin and
I have to reply with some JSON data. The answer depends on parameters
user and pwd passed in the query string.
2018-02-02 09:12:42 +01:00
goldsimon
7edbd95b50 tcp_out: fix unused parameter when all options are off 2018-02-02 09:01:21 +01:00
Axel Lin
31c71fee46 doc/savannah.txt: Use RSA instead of DSA
The documentation on savannah recommends using only RSA keys, not DSA.
(reference http://savannah.gnu.org/maintenance/SshAccess/)
Thus update the doc/savannah.txt to us RSA instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Simon Goldschmidt <goldsimon@gmx.de>
2018-02-02 12:29:47 +08:00
goldsimon
fa9082116f tcp: add 2 hooks to add custom options to outgoing tcp segments
Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-01 09:31:15 +01:00