Commit Graph

6037 Commits

Author SHA1 Message Date
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
goldsimon
77d0ee0961 tcp: add LWIP_HOOK_TCP_INPACKET_PCB
This hook is called from tcp_input() for all kinds of input pcbs when
selected to receive a pbuf (LISTEN, TIME_WAIT, rest). I can parse or
drop an rx pbuf.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-01 09:19:16 +01:00
goldsimon
0e85582bc0 tcp: introduce ext_args per pcb
This introduces the concept of ext (external/extended) arguments per
tcp_pcb (also for listening pcbs) to store more data than just one
"void *arg" per pcb. The "arg" is for use to applications, whereas
the ext_args may be used by frameworks and leave "arg" untouched.

In addition to a void pointer, callbacks are added to help frameworks
migrate arguments from listen pcb to connection pcb and to free args
when the pcb is freed.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-01 09:19:16 +01:00
goldsimon
ebe782ba16 tcp: centralize freeing tcp pcbs to memp_free
This should make it easier to add debugging messages or other hooks
to the point where tcp pcbs are deallocated.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-01 09:19:15 +01:00
goldsimon
ce79811bce sockets: add hooks to implement additional socket options
LWIP_HOOK_SOCKETS_SETSOCKOPT() and LWIP_HOOK_SOCKETS_GETSOCKOPT()
are introduced to implement additional socket options. The hooks
are always called first and report back if they handled the option
or not.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-01 09:19:15 +01:00
goldsimon
61671d6df0 tcp_out: make some more pointers const 2018-02-01 09:18:24 +01:00
goldsimon
9fb86f6e4b tcp: add a define for maximum option bytes 2018-02-01 09:14:22 +01:00
Axel Lin
2c3c578475 apps/smtp: Fix wrong sizeof for memset s->bodydh
Use sizeof(struct smtp_bodydh_state) to zero all fields of s->bodydh.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-01-31 09:07:48 +08:00
Joel Cunningham
64a351cbe0 tcp_out: remove CHECKSUM_GEN_TCP case from tcp_send_empty_ack
CHECKSUM_GEN_TCP support was moved to tcp_output_control_segment
so we can remove usage of tcphdr and the extra set of #if/#endif

This fixes https://travis-ci.org/yarrick/lwip-merged/builds/335348098
2018-01-30 17:35:40 -06:00
goldsimon
0ee7a39594 tcp: add comments about usage of options 2018-01-30 22:01:54 +01:00
goldsimon
424c33bcb7 tcp_out: combine the tx path of the 4 direct tx functions
tcp_rst, tcp_send_empty_ack, tcp_keepalive and tcp_zero_window_probe
all execute the same instructions to send a segment pbuf.
Combined into tcp_output_control_segment().
2018-01-30 21:50:41 +01:00
goldsimon
9128a51944 tcp_out: make tcp_output_alloc_header generic enough for tcp_rst 2018-01-30 21:46:48 +01:00
goldsimon
1570dd8ad1 tcp_abandon: no need to buffer pcb->local_port 2018-01-30 21:43:18 +01:00
goldsimon
fdbc9f9b32 tcp_out: move around functions to group them together
This file has been a mess regarding the order of the functions.
By moving them around, they can be grouped into functions taking
part in normal data transmission (via unsent/unacked) and control
segments (which are allocated, directly sent and freed).

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-01-30 21:06:44 +01:00
goldsimon
dd6c43ecbd tcp_out: documentation update 2018-01-30 20:49:47 +01:00
goldsimon
ad3937df58 tcp: tiny doc update (mention tcp_output) 2018-01-30 20:20:22 +01:00
goldsimon
c597cfd6ca tcp_create_segment: rename arg 'flags' to 'hdrflags'
The argument name 'flags' is too unspecific because there is another
argument named 'optflags'.
2018-01-30 12:26:13 +01:00
Dirk Ziegelmeier
40997c4a08 Apply (modified) patch #9552: tftp_cleanup() for cleanup and filename buffer zeroing to prevent filename bugs
... without the memset to zero out the filename
2018-01-29 06:59:47 +01:00
goldsimon
83ff2014ae tcp_enqueue_flags: no need to check pcb->snd_queuelen
We only allow SYN or FIN in this functions and FIN shall always come
through, so no need to check pcb->snd_queuelen
2018-01-28 20:57:53 +01:00
goldsimon
d6cf8a3e38 tcp_out: improved some comments 2018-01-28 20:56:52 +01:00
goldsimon
93f9c56c32 fix bug #52976: lwip_ioctl() FIONREAD crash 2018-01-27 14:45:17 +01:00
goldsimon
05ba509e33 mdns: clarify usage of ip_addr_cmp_zoneless() 2018-01-26 06:32:35 +01:00
goldsimon
de68c5bed6 altcp_mbedtls_sndbuf: use mbedtls_ssl_get_record_expansion() 2018-01-25 13:15:49 +01:00
goldsimon
6606c4013f bug #52893: Add 'old_stat' save in LWIP_NSC_IPV6_ADDR_STATE_CHANGED callback message 2018-01-25 13:05:33 +01:00
goldsimon
fe2c249fb7 bug #52937: raw_input() must tell ip4/6_input() if protocol has been received
This also moves "raw_input" and "raw_netif_ip_addr_changed" to a new file
raw_priv.h
2018-01-25 12:51:46 +01:00
goldsimon
ebda5cb04e ip_addr.h: add IP_ADDR_RAW_SIZE() to know the memcpy size of an IP 2018-01-23 06:53:45 +01:00
goldsimon
5b75ad9019 Fix bug #52949: udp_input() checksum error for LWIP_CHECKSUM_CTRL_PER_NETIF 2018-01-22 19:51:45 +01:00
Mike Kleshov
84fcd6290e [patch #9548] Add .json to list of SSI file extensions
Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-01-22 19:49:10 +01:00
Mike Kleshov
76826c1622 [patch #9547] Bring some comments in httpd.h up to date
Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-01-22 19:47:16 +01:00
goldsimon
9dbfa9ca0a lwiperf: enable TCP over IPv6 connections
tested against iperf 2.0.10
redefine LWIPERF_SERVER_IP_TYPE if you don't want both IP versions
2018-01-19 21:08:51 +01:00
goldsimon
a696b2b515 lwiperf: fix testing against iperf 2.0.10 (bug #52901) 2018-01-17 20:54:16 +01:00
goldsimon
a7a8d9273c sockets_stresstest: replace printf with LWIP_DEBUGF, fix unused arg 2018-01-17 19:46:32 +01:00
goldsimon
9cf6bbf573 memp_std.h: make MEMP_PBUF a normal pool
No need to use LWIP_PBUF_MEMPOOL here since this pool never contains
pbufs with payload included.
2018-01-17 12:54:00 +01:00
goldsimon
2fd2b6810e memp_std.h: fix LWIP_PBUF_MEMPOOL element size for MEMP_OVERFLOW_CHECK
The LWIP_PBUF_MEMPOOL define used MEMP_ALIGN_SIZE instead of
LWIP_MEM_ALIGN_SIZE to calculate the element size of PBUF_POOL pbufs.
This is wrong for MEMP_OVERFLOW_CHECK, since MEMP_ALIGN_SIZE adds
MEMP_SANITY_REGION_AFTER_ALIGNED. This should be only added during
pool_base buffer allocation but for PBUF_POOL, it changed the size
of the pool elements.
2018-01-17 12:51:49 +01:00
goldsimon
d12d6abae8 minor whitespace/indentation cleanup 2018-01-17 12:27:17 +01:00
Joel Cunningham
f3c289d966 sockets: add core lock assert to select_check_waiters
Assert the requirement that the core is locked in select_check_waiters
2018-01-16 18:52:45 -06:00