Commit Graph

5807 Commits

Author SHA1 Message Date
Benjamin Aigner
10209ee788 Added a RFC7668 netif.
Works as expected, but some features are not implemented yet.

(See patch #9364: RFC7668 - 6lowpan over Bluetooth Low Energy -- a new netif)
(I've change the file names only; sg)

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-23 13:07:31 +01:00
Dirk Ziegelmeier
f595445ec0 Some fixes to DHCPv6 documentation 2018-02-23 12:54:51 +01:00
Dirk Ziegelmeier
aa04944ae0 Add DHCPv6 to documentation 2018-02-23 12:35:45 +01:00
goldsimon
d2ee10977f dhcp6: try to fix docs (clang complains) 2018-02-23 10:26:19 +01:00
goldsimon
7ad680c2bf Try to fix dhcp6.c on travis 2018-02-23 09:54:04 +01:00
goldsimon
7d007cfee5 DHCPv6: make LWIP_IPV6_DHCP6_STATELESS==LWIP_IPV6_DHCP6 by default 2018-02-23 09:26:46 +01:00
goldsimon
8600259a78 tiny cleanup in dhcp.c 2018-02-22 22:33:48 +01:00
goldsimon
76a13054ee add initial support for stateless DHCPv6
Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-22 22:33:16 +01:00
goldsimon
37b4494921 http_client: fix function documentation 2018-02-22 09:55:32 +01:00
goldsimon
0ee0393936 fix compiling http_client and altcp_proxyconnect with gcc 2018-02-22 09:12:51 +01:00
Axel Lin
fe3bb8bb78 etharp: Remove superfluous assert checking in free_etharp_q
The same checking is done while iterating the list in the while loop.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-02-22 11:27:29 +08:00
Axel Lin
e93cecf527 Fix build error for http files
The HTTPDFILES is renamed to HTTPFILES now.

Fixes: 1f0867299d ("add new http files to Filelists.mk")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-02-22 09:21:33 +08:00
goldsimon
1f0867299d add new http files to Filelists.mk 2018-02-21 22:17:51 +01:00
goldsimon
7b9e145fc5 http_client: change user-agent and make it overridable 2018-02-21 20:18:29 +01:00
goldsimon
2753eb1fb1 add an altcp layer for http proxy connect (e.g. to tunnel TLS through a http proxy)
Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-21 20:18:05 +01:00
goldsimon
a0e900dd02 makefsdata: update usage output to code 2018-02-21 14:42:47 +01:00
goldsimon
325cdf3c0b altcp_tls_mbedtls: restructure upper callbacks to prevent double-free
This fixes bug #53192: use-after-free in altcp_mbedtls

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-21 14:20:34 +01:00
goldsimon
a7b43dae49 altcp: default shutdown for both sides is close 2018-02-21 12:50:42 +01:00
goldsimon
d66c0e3381 altcp: mbedtls: move freeing state->rx from close to dealloc (catch-all) 2018-02-20 22:12:11 +01:00
goldsimon
bcff67b00e altcp_tls_alloc: need to close inner conn instead of freeing it 2018-02-20 17:08:00 +01:00
goldsimon
3bd87e3815 doc: altcp: keep altcp_alloc/altcp_free out of the docs
Those functions are for implementing altcp layers, not for applications
2018-02-20 14:08:04 +01:00
Dirk Ziegelmeier
333fff3e66 Improve altcp allocator documentation 2018-02-20 13:31:27 +01:00
Dirk Ziegelmeier
fc3c186289 Improve altcp allocator documentation 2018-02-20 13:25:50 +01:00
goldsimon
3a41f4fe8a altcp_alloc: add to Filelists.mk 2018-02-20 11:21:32 +01:00
Axel Lin
e9bd31b190 icmp6: Fix "LWIP_ICMP6_DATASIZE" redefined build warning if it was set to 0
Need to undefine LWIP_ICMP6_DATASIZE before change the setting.
While at it, also remove the unneeded #ifndef LWIP_ICMP6_DATASIZE
checking because it is set in lwip/opt.h.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-02-20 17:54:49 +08:00
Axel Lin
a894140bb0 igmp: Use angle brackets for including string.h
Use angle brackets(<>) for including system header files.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-02-20 15:20:14 +08:00
goldsimon
842b9f4429 altcp: simplify creating different types by adding an allocator concept
This is done with an example in the http_client

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-19 21:41:48 +01:00
Dirk Ziegelmeier
5b33d33e34 Add HTTP client to documentation 2018-02-19 09:01:44 +01:00
Dirk Ziegelmeier
2501913cde Move ethernetif.c from lwIP main rep to contrib examples directory where it has a chance to be actually found by users 2018-02-19 07:46:56 +01:00
Dirk Ziegelmeier
47c55c3d96 Improve documentation for 6LOWPAN and SLIPIF 2018-02-18 17:49:54 +01:00
goldsimon
ef29f2d401 http_client: httpc_tcp_recv did not return inner_conn's recv return value
Signed-off-by: goldsimon <goldsimon@gmx.de>
Reported-by: Our Air Quality <info@ourairquality.org>
2018-02-18 09:02:00 +01:00
goldsimon
b5448a86fd ip4_reass: free datagram entry if p == NULL 2018-02-18 08:55:11 +01:00
Dirk Ziegelmeier
5b459c1282 dns.h depends on err.h 2018-02-17 16:53:03 +01:00
goldsimon
2b09c18c4e altcp_tls.h: minor whitespace cleanup 2018-02-16 13:59:00 +01:00
goldsimon
2648d30843 altcp_tls_mbedtls.c: tiny function rename 2018-02-16 13:57:38 +01:00
goldsimon
bd656efd64 http client: add https support, fix parsing header with chained pbufs 2018-02-16 12:29:40 +01:00
goldsimon
e87392cc85 http client: fix proxy support 2018-02-16 09:18:35 +01:00
goldsimon
3dafa72ec8 apps: add http client
Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-15 22:10:29 +01:00
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
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
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
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
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
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
goldsimon
8a27408eb2 altcp_tls_mbedtls: hide allocation strategy in altcp_tls_create_config() 2018-01-16 21:41:44 +01:00
David Girault
42f14a96fb altcp_tls: avoid use of static in altcp_tls_config
cert and pkey are allocated with the altcp_tls_config structure.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-01-16 21:03:43 +01:00
David Girault
c7106cc57f altcp_tls: fix pbuf leaked when handshake failed
Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-01-16 20:56:15 +01:00
goldsimon
30ddfe1a98 Make LWIP_VERSION work with the preprocessor again. 2018-01-16 20:37:10 +01:00
Dirk Ziegelmeier
51369854b5 Fix bug #52911: SNMPv3 time window check is not the same as RFC3414 2018-01-16 13:30:31 +01:00
goldsimon
2fd83c9d2e lwiperf: fix double-free of pbufs on recv error 2018-01-16 06:54:28 +01:00
Dirk Ziegelmeier
330793d94d Fix bug #52880: ethernet_output() Compile error. 2018-01-14 09:24:41 +01:00
goldsimon
28c8693683 mqtt: fix documentation error (remove ':' after param name) 2018-01-13 16:09:17 +01:00
goldsimon
4a99721751 netif: try to fix gcc error (-Werror=c++-compat) 2018-01-13 09:38:18 +01:00
goldsimon
734b6ab57a netif: ensure netif_set_addr() only results in one "ext_status_callback"
This can be used e.g. in mdns to create one, not multiple "changed" triggers
if IP address and netmask change at the same time.
2018-01-12 23:11:38 +01:00
goldsimon
452c6a5378 netif: add netif_remove_ext_callback() (counterpart to netif_add_ext_callback()) 2018-01-12 22:25:34 +01:00
goldsimon
d115b28057 netif: change netif_nsc_reason_t to flags (preparation only) 2018-01-12 22:24:45 +01:00
goldsimon
0b2b22338a tcpip_thread_poll_one: remove invalid comment in this function 2018-01-12 20:41:11 +01:00
goldsimon
eb51b683ed fix copy & paste error in comment 2018-01-12 20:29:12 +01:00
Dirk Ziegelmeier
46cb0a796b Forgot to add LWIP_ASSERT_CORE_LOCKED() to http_continue function 2018-01-12 13:35:20 +01:00
Dirk Ziegelmeier
653313cb37 Work on task #14780: Add debug helper asserts to ensure threading/locking requirements are met
Add LWIP_ASSERT_CORE_LOCKED() to several more places
2018-01-12 13:15:36 +01:00
Dirk Ziegelmeier
67ad6e45db Add assertion that checks for a maximum msecs value for sys_timeout() 2018-01-12 12:38:25 +01:00
Dirk Ziegelmeier
990c25d4f3 Add unit test for a long running timer 2018-01-12 12:37:16 +01:00
David Girault
6ccd12b97c altcp_mbedtls: added altcp_mbedtls_sndbuf implementation
Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-01-11 10:34:55 +01:00
goldsimon
eab1b45cba tcpip: give the tcpip_thread mbox a better name
This also fixes shadowing 'mbox' in tcpip_timeouts_mbox_fetch()
2018-01-11 09:56:43 +01:00
Dirk Ziegelmeier
b6b14438b7 Rename lwip_sys_timers_get_next_timout() to sys_timeouts_get_next_timeout() 2018-01-11 09:53:07 +01:00
goldsimon
c257b56a39 move sys_timeouts_mbox_fetch() to tcpip_timeouts_mbox_fetch()
This cleans up the code: sys_timeouts_mbox_fetch() was only used from
tcpip.c anyway, so let's move it there.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-01-11 09:39:36 +01:00
Axel Lin
39ada6ec0e ip_addr: Define ip_addr_cmp_zoneless for LWIP_IPV6 only
This fixes build error when LWIP_IPV4=0 && LWIP_IPV6=1:
cc -g -Wall -DLWIP_DEBUG -pedantic -Werror -Wparentheses -Wsequence-point -Wswitch-default -Wextra -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wc++-compat -Wwrite-strings -Wold-style-definition -Wcast-align -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Wunreachable-code -Wuninitialized -Wlogical-op -I. -I../../.. -I../../../../lwip/src/include -I../../../ports/unix/port/include -I../../../../mbedtls/include -Wno-redundant-decls -DLWIP_HAVE_MBEDTLS=1 -c ../../../../lwip/src/apps/mdns/mdns.c
../../../../lwip/src/apps/mdns/mdns.c: In function ‘mdns_recv’:
../../../../lwip/src/apps/mdns/mdns.c:1817:10: error: implicit declaration of function ‘ip_addr_cmp_zoneless’; did you mean ‘ip6_addr_cmp_zoneless’? [-Werror=implicit-function-declaration]
     if (!ip_addr_cmp_zoneless(ip_current_dest_addr(), &v6group)) {
          ^~~~~~~~~~~~~~~~~~~~
          ip6_addr_cmp_zoneless
../../../../lwip/src/apps/mdns/mdns.c:1817:10: error: nested extern declaration of ‘ip_addr_cmp_zoneless’ [-Werror=nested-externs]
cc1: all warnings being treated as errors

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-01-09 21:24:12 +01:00
goldsimon
2d06483d8e ip4_frag: don't use LWIP_ERROR where we might depend in input data
fuzz test revealed that an ip header with options might land in ip4_frag() via ICMP. In this case, we can't use LWIP_ERROR() to check for not having ip options as that might be defined to assert
2018-01-09 10:25:41 +01:00
Axel Lin
deab51c36d netif: Remove unnecessary NULL checking in netif_do_set_{ipaddr|netmask|gw}
The callers already ensure the ipaddr/netmask/gw won't be NULL, so remove
the duplicated NULL checking in these static functions.
While at it, also move the code saving old_address for netmask/gw as
it's only used when address is actually being changed.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2018-01-09 08:45:37 +01:00
goldsimon
0795e289eb ip4_reass: fix double-free of pbuf and wrong ip_reass_pbufcount
This was broken by commit f1072fee8a on 07/28/17 when trying to fix bug #51595
2018-01-09 08:19:43 +01:00
Axel Lin
efa90d4294 netif: Add LWIP_ASSERT_CORE_LOCKED() to netif_set_remove_callback
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2018-01-09 07:51:18 +01:00
Dirk Ziegelmeier
05ded5516d Apply patch #9536: netif: Prevent possible NULL pointer dereference in netif_set_addr in a modified version
Replace NULL pointers by IP4_ADDR_ANY4 - at sometime in the future, we make the NULL pointer handling obsolete and we can remove all the NULL pointer checks in the code
2018-01-09 07:51:09 +01:00
David Girault
8801cbdb30 core: fix lwip_itoa()
See discussion in bug #51729

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-01-08 21:37:31 +01:00
Dirk Ziegelmeier
bb0ba64fb0 Work on bug #52748: the bug in timeouts.c - apply Douglas' patch for absolute timeouts with modification to avoid cyclic timer overload situation 2018-01-08 12:48:48 +01:00
Dirk Ziegelmeier
5eced48869 Apply timeouts.c simplification from Douglas
Use TIME_LESS_THAN() macro instead of TIME_LESS_OR_EQUAL_THAN, it is more readable and results equivalent
2018-01-08 11:16:51 +01:00
Dirk Ziegelmeier
b6c0c52d66 Fix that one of Douglas' optimizations broke the timers
The unit tests failed and I didn't notice it :-(
2018-01-08 09:19:57 +01:00
Dirk Ziegelmeier
bbb2e50327 Fix variable shadowing warning in my last commit 2018-01-08 08:12:33 +01:00
Dirk Ziegelmeier
a31f8837b5 Partly apply patch from "Douglas" provided in bug #52748: the bug in timeouts.c
- Fix sys_untimeout implementation should not modify timer values since we are now using absolute timeouts.c
- Cleanup and simplify sys_check_timeouts() implementation
- Implement sys_restart_timeouts to rebase all timeouts based on next timer to expire

Changes by me:
- Rename TIME_LESS_THAN to TIME_LESS_OR_EQUAL_THAN
2018-01-08 07:33:40 +01:00
Dirk Ziegelmeier
eaca067c7d Make _cyclic_ timers interval more deterministic - next timeout is calculated from last due time instead of relative to current time
This eliminates the cyclic timer jitter
2018-01-08 07:16:49 +01:00
Dirk Ziegelmeier
2b4dde84e3 Apply modified patch #9533: sys_check_timeouts: recalculate the time diff after each handler call
Adapted to new timer implementation
2018-01-08 07:16:48 +01:00
Dirk Ziegelmeier
dd3861720f Fix bug #52748: the bug in timeouts.c by reimplementing timer logic to use absolute instead of relative timeout values 2018-01-08 07:16:47 +01:00
Axel Lin
da2478b761 netif: Enclosing macro argument in parentheses for NETIF_FOREACH
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-01-05 21:35:25 +01:00
goldsimon
8fc20142f7 Added sys_mbox_trypost_fromisr() and tcpip_callbackmsg_trycallback_fromisr()
This can be used to post preallocated messages from an ISR to the tcpip thread
when using FreeRTOS, where where calls differ between task level and ISR level.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-01-05 21:08:27 +01:00
Dirk Ziegelmeier
756b7431a7 Start implementing unit tests for timers 2018-01-04 13:37:05 +01:00
Dirk Ziegelmeier
40fecab313 Introduce LWIP_TESTMODE #define to be able to make functions/variables public etc. for implementing unit tests 2018-01-04 13:20:28 +01:00
Dirk Ziegelmeier
b16f5f0e19 Rename tcpip_trycallback() tcpip_callbackmsg_trycallback() to avoid confusion with tcpip_try_callback()
Add tcpip_callbackmsg_new(), tcpip_callbackmsg_delete(), tcpip_callbackmsg_trycallback() to documentation
2018-01-04 08:24:17 +01:00
goldsimon
6b2ef1a89b httpd: fix typo "kepalive" -> "keepalive" 2018-01-04 06:35:00 +01:00
Axel Lin
2cb220d7fe netif: Move LWIP_ASSERT_CORE_LOCKED out of static functions
The netif_do_set_{ipaddr|netmask|gw} are static functions what won't be called
directly, thus move LWIP_ASSERT_CORE_LOCKED to netif_set_{ipaddr|netmask|gw}.
This avoid duplicated LWIP_ASSERT_CORE_LOCKED checking by netif_set_addr().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-01-03 12:22:36 +01:00
Dirk Ziegelmeier
25f1c6ef2c Revert "Apply patch #9523: MDNS responder should reply after a random timeout"
This reverts commit fa345b0f22.
2018-01-03 07:48:23 +01:00
Dirk Ziegelmeier
3b79c60e41 Revert "Fix build warnings in mdns.c introduced in my last commit"
This reverts commit 744e69334d.
2018-01-03 07:48:12 +01:00
Dirk Ziegelmeier
01e227d2c0 netif.c: Fix that when using LWIP_NETIF_EXT_STATUS_CALLBACK multiple callbacks instead of only one are fired when netif_set_addr() is used 2018-01-03 07:47:49 +01:00
Axel Lin
913a7e0638 sockets: Simplify #if !LWIP_TCPIP_CORE_LOCKING guard in select_check_waiters
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-01-03 06:35:02 +01:00
Dirk Ziegelmeier
744e69334d Fix build warnings in mdns.c introduced in my last commit 2018-01-03 06:31:59 +01:00
Dirk Ziegelmeier
fa345b0f22 Apply patch #9523: MDNS responder should reply after a random timeout
with a few cleanups and coding style fixes
2018-01-02 22:20:25 +01:00
Dirk Ziegelmeier
004b13ca09 Work on task #14780: Add debug helper asserts to ensure threading/locking requirements are met
Update documentation
2018-01-02 21:45:30 +01:00
Joel Cunningham
d569a22c73 tcpip: ensure core is locked for init done function
This ensures the core is locked when executing the init done function
passed to tcpip_init

The could manifest as a synchronization issue during early init if
another thread was in the LwIP context at the same time
2018-01-02 13:45:00 -06:00
Erik Ekman
d87740bb96 mdns: Fix multicast destination check for IPv6
This broke when IPv6 got scopes added. Scopes/zones are checked
even if none of the compared addresses are link local.

Result of the bug was that IPv6 replies were always sent unicast to
the source instead of to the multicast address.

Add ip-generic version that ignores IP zone info, since the v6 group
address is not tied to any netif.
2018-01-02 20:41:50 +01:00
Our Air Quality
1c7a024297 timers: add core locking assertion to tcp_timer_needed (task #14780) 2018-01-02 12:13:35 -06:00
Our Air Quality
53499f5e9f timers: rework the core locking around timers (bug #52719)
Want the core lock held while working on the timer data structures.
2018-01-02 11:54:40 -06:00
Joel Cunningham
04b983b4f3 tcp: handle pcb->snd_queuelen and chained pbufs during segment split (bug #52692)
This fixes a bug in tcp_split_unsent_seg() where a chained pbuf was
not correctly updating pcb->snd_queuelen during trimming and snd_queuelen
would desynchronize if pbuf_realloc() freed some of the chain

Also, use pbuf_clen() for adding the new remaining segment rather than ++.
The new remaining segment should always be one pbuf due to the semantics
of PBUF_RAM, but this follows the best practice of using pbuf_clen()
2018-01-02 09:16:10 -06:00
Dirk Ziegelmeier
f334ac68b6 Work on task #14780: Add debug helper asserts to ensure threading/locking requirements are met
Add LWIP_ASSERT_CORE_LOCKED() in several places
2018-01-02 15:44:08 +01:00
Dirk Ziegelmeier
10c50dffce tcpip.h: Make functions to lock TCPIP core overridable 2018-01-02 14:06:38 +01:00
Dirk Ziegelmeier
b33b3bb8bb Start working on task #14780: Add debug helper asserts to ensure threading/locking requirements are met 2018-01-02 13:44:38 +01:00
Dirk Ziegelmeier
36d160686a Remove mdnsapi_mdns_resp_announce() again - it is not really needed and declaring it in mdns.h breaks layering between callback-style API and thread-safe API 2018-01-02 12:33:07 +01:00
Dirk Ziegelmeier
dfd6a31ecb Fixup mdnsapi_mdns_resp_announce() macro - mdns_resp_announce() is a void function! 2018-01-02 11:03:45 +01:00
Dirk Ziegelmeier
a8755b8530 Work on bug #52770: mdns: move the announcements to a timer callback
Don't automatically announce when adding netifs/services
2018-01-02 10:59:20 +01:00
Dirk Ziegelmeier
6c7e7153bc Fix bug #52704: DHCP and bad OFFER
Stop timeout only if offer is accepted
2017-12-30 12:17:24 +01:00
Dirk Ziegelmeier
b536fd9767 Apply modified version of bug #52747: mdns resp: separate the announce function and add netifapi support for it
Changes made by me:
- Move all error handling code into mdns_resp_announce() so it can be safely used by external code
- Remove mdns_resp_netif_settings_changed() because it is the same as mdns_resp_announce() after my changes
- Declare #define for a "thread-safe" version of mdns_resp_announce in mdns.h instead of netifapi.h - I don't want to intermix netif API with APPs
2017-12-30 12:08:01 +01:00
Our Air Quality
1b57284bb4 mdns: guard against there being no ip4 address.
* Avoid announcing to an interface with no ip4addr.

* Avoid emitting A answers if there is no ip4 address.
2017-12-30 11:42:46 +01:00
Axel Lin
61e90d9fc0 Use pbuf_clone to replace pbuf_alloc+pbuf_copy
Use pbuf_clone() to simplify the code a bit.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-12-24 12:50:30 +01:00
Dirk Ziegelmeier
4cfef8acab Apply part from patch 9525: fix lwip_strnicmp in a modified way:
Move side effect out of boolean expression
2017-12-24 12:49:28 +01:00
Axel Lin
5b9f79680c lowpan6: Fix build warning when LWIP_6LOWPAN_IPHC=0
Fix below build warning if LWIP_6LOWPAN_IPHC=0.

../../../../lwip/src/netif/lowpan6.c:186:1: error: ‘lowpan6_get_address_mode_mc’ defined but not used [-Werror=unused-function]
 lowpan6_get_address_mode_mc(const ip6_addr_t *ip6addr)
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../../lwip/src/netif/lowpan6.c:160:1: error: ‘lowpan6_get_address_mode’ defined but not used [-Werror=unused-function]
 lowpan6_get_address_mode(const ip6_addr_t *ip6addr, const struct ieee_802154_addr *mac_addr)
 ^~~~~~~~~~~~~~~~~~~~~~~~

Also correct comment typo: s/LWIP_6LOWPAN_HC/LWIP_6LOWPAN_IPHC/g

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-12-24 12:46:11 +01:00
goldsimon
c6887522fe Fixed lwip_itoa (bug #51729) and added unit tests for it 2017-12-23 20:35:18 +01:00
goldsimon
b07a481f66 Fix bug #52686 (pointer 'to' checked for NULL in lwip_sendto() may be dereferenced)
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-12-18 20:09:44 +01:00
goldsimon
7c1f844782 Fix compiling mdns.c after last change (mixed code and declarations) 2017-12-18 20:06:45 +01:00
goldsimon
2505c6019e httpd: fix the names of some global variables 2017-12-18 20:01:24 +01:00
Mike Kleshov
db68c6df6a httpd: make global variables static
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-12-18 19:57:07 +01:00
Joel Cunningham
50a5d85f45 tcp: handle segmentation oversize during segment split (bug #52676)
This fixes a bug in tcp_split_unsent_seg where oversized segments were not
handled during the split, leading to pcb->unsent_oversized and
useg->oversize_left getting out of sync with the split segment

This would result in over-writing the pbuf if another call to tcp_write()
happened after the split, but before the remainder of the split was sent in
tcp_output

Now pcb->unsent_oversized is explicitly cleared (because the remainder at
the tail is never oversized) and useg->oversized_left is cleared after it is
trimmed

This also updates the test_tcp_persist_split unit test to explicitly check for
this case
2017-12-18 11:42:13 -06:00
Our Air Quality
31c60775b6 mdns: silence some unused variable warnings. 2017-12-17 22:24:49 +01:00
Axel Lin
0527c1bdf5 apps/smtp: Avoid NULL pointer dereference in smtp_send_body_data_handler
Move the code to have NULL test before dereference.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-12-17 22:16:29 +01:00
Axel Lin
df563e74f9 ip4: Fix IPH_OFFSET_BYTES macro
Current code only works if the argument happen to be named as fraghdr,
fix it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-12-17 22:15:10 +01:00
Axel Lin
892e30d8c1 ip4_reass: Use IPH_HL_BYTES instead of open coded
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-12-17 22:14:27 +01:00
Axel Lin
4c90858482 ip4_reass: Fix build error when IP_REASS_CHECK_OVERLAP=0
The goto freepbuf code path is also used when IP_REASS_CHECK_OVERLAP=0.
Thus remove #if IP_REASS_CHECK_OVERLAP around the freepbuf label to fix
below build error:

cc -g -Wall -DLWIP_DEBUG -pedantic -Werror -Wparentheses -Wsequence-point -Wswitch-default -Wextra -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wc++-compat -Wwrite-strings -Wold-style-definition -Wcast-align -Wmissing-prototypes -Wredundant-decls -Wnested-externs -Wunreachable-code -Wuninitialized -Wlogical-op -I. -I../../.. -I../../../../lwip/src/include -I../../../ports/unix/port/include -I../../../../mbedtls/include -Wno-redundant-decls -DLWIP_HAVE_MBEDTLS=1 -c ../../../../lwip/src/core/ipv4/ip4_frag.c
../../../../lwip/src/core/ipv4/ip4_frag.c: In function
‘ip_reass_chain_frag_into_datagram_and_validate’: ../../../../lwip/src/core/ipv4/ip4_frag.c:412:7: error: label ‘freepbuf’ used but not defined
       goto freepbuf;
       ^~~~

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-12-17 22:13:59 +01:00
goldsimon
82483073f0 sntp_send_request: assert that argument 'server_addr' != NULL 2017-12-17 22:13:09 +01:00
Axel Lin
ba270c2414 apps/sntp: Use ip_addr_copy to save server address
Use ip_addr_copy instead of ip_addr_set to avoid NULL test for
&sntp_last_server_address. This fixes build warning when
SNTP_CHECK_RESPONSE>=1 && LWIP_IPV4=1 && LWIP_IPV6=1.

In file included from ../../../../lwip/src/include/lwip/apps/sntp.h:41:0,
                 from ../../../../lwip/src/apps/sntp/sntp.c:52:
../../../../lwip/src/apps/sntp/sntp.c: In function ‘sntp_send_request’:
../../../../lwip/src/include/lwip/ip_addr.h:105:58: error: the comparison will always evaluate as ‘true’ for the address of ‘sntp_last_server_address’ will never be NULL [-Werror=address]
 #define IP_SET_TYPE(ipaddr, iptype)     do { if((ipaddr) != NULL) { IP_SET_TYPE_VAL(*(ipaddr), iptype); }}while(0)
                                                          ^
../../../../lwip/src/include/lwip/ip_addr.h:157:36: note: in expansion of macro ‘IP_SET_TYPE’
 #define ip_addr_set(dest, src) do{ IP_SET_TYPE(dest, IP_GET_TYPE(src)); if(IP_IS_V6(src)){ \
                                    ^~~~~~~~~~~
../../../../lwip/src/apps/sntp/sntp.c:549:5: note: in expansion of macro ‘ip_addr_set’
     ip_addr_set(&sntp_last_server_address, server_addr);
     ^~~~~~~~~~~

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-12-17 22:12:32 +01:00
Joel Cunningham
920ee2d07e sntp: use const for servername
This adds const to the sntp servername get/set API and internal storage

SNTP's usage of this name is read only and SNTP only passes it to dns_gethostbyname()

This was found by compiling with GCC -Wwrite-strings which makes the literal
SNTP_SERVER_ADDRESS a const string. This then produced warnings with sntp_init()'s
call to sntp_setservername()
2017-12-13 11:34:48 -06:00
Dirk Ziegelmeier
60063b98e1 Fix bug #52611: Incorrect use of ctype macros?
by applying a modified version of Axel Lin's patch including Mike Kleshov's comments.
2017-12-07 12:01:09 +01:00
Axel Lin
ec9f227eae apps/altcp_tls: Remove redundant check for altcp_mbedtls_malloc_clear_stats
No need to check altcp_mbedtls_malloc_clear_stats twice.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-12-05 06:35:44 +01:00
Axel Lin
eb30dbfdc5 Fix build warning for lwip_isdigit/isxdigit/islower/isspace
lwip_isdigit/isxdigit/islower/isspace takes int as argument, so
explicitly cast to int to silence below build warnings.

src/core/ipv4/ip4_addr.c: In function 'ip4addr_aton':
src/core/ipv4/ip4_addr.c:160:5: warning: array subscript has type 'char' [-Wchar-subscripts]
     if (!lwip_isdigit(c)) {
     ^
src/core/ipv4/ip4_addr.c:175:7: warning: array subscript has type 'char' [-Wchar-subscripts]
       if (lwip_isdigit(c)) {
       ^
src/core/ipv4/ip4_addr.c:178:7: warning: array subscript has type 'char' [-Wchar-subscripts]
       } else if (base == 16 && lwip_isxdigit(c)) {
       ^
src/core/ipv4/ip4_addr.c:179:9: warning: array subscript has type 'char' [-Wchar-subscripts]
         val = (val << 4) | (u32_t)(c + 10 - (lwip_islower(c) ? 'a' : 'A'));
         ^
src/core/ipv4/ip4_addr.c:204:3: warning: array subscript has type 'char' [-Wchar-subscripts]
   if (c != '\0' && !lwip_isspace(c)) {
   ^

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-12-03 19:34:24 +01:00
Axel Lin
975e23bf5e bridgeif: Remove redundant port_netif NULL test in bridgeif_send_to_port
portif = br->ports[dstport_idx].port_netif;
So no need to have NULL test for both br->ports[dstport_idx].port_netif
and portif.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-11-26 21:13:08 +01:00
Dirk Ziegelmeier
2ceedfe097 Fix bug #52345: MQTT buffer length check seems wrong
Don't try to parse variable length part if it is not contained in message
2017-11-26 21:05:07 +01:00
Dirk Ziegelmeier
ad47a46815 Revert fix for bug #52345, that was not correct 2017-11-26 20:59:39 +01:00
Axel Lin
32788f2c74 sockets.c: use udp_is_flag_set() instead of udp_flags()
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-11-23 22:12:41 +01:00
Axel Lin
6cbee37a58 apps/httpd: Use LWIP_ARRAYSIZE at appropriate places
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-11-22 16:54:03 +01:00
Axel Lin
5cd6c38893 apps/snmp: Fix buld error when LWIP_SNMP_CONFIGURE_VERSIONS=1
The version check is done in these functions, it should be ok to put
assert in the else clause.

Fix below build errors:

../../../../lwip/src/apps/snmp/snmp_msg.c: In function ‘snmp_version_enabled’:
../../../../lwip/src/apps/snmp/snmp_msg.c:87:1: error: embedding a directive within macro arguments is not portable [-Werror]
 #if LWIP_SNMP_V3
 ^
../../../../lwip/src/apps/snmp/snmp_msg.c:89:1: error: embedding a directive within macro arguments is not portable [-Werror]
 #endif
 ^
../../../../lwip/src/apps/snmp/snmp_msg.c: In function ‘snmp_version_enable’:
../../../../lwip/src/apps/snmp/snmp_msg.c:126:1: error: embedding a directive within macro arguments is not portable [-Werror]
 #if LWIP_SNMP_V3
 ^
../../../../lwip/src/apps/snmp/snmp_msg.c:128:1: error: embedding a directive within macro arguments is not portable [-Werror]
 #endif
 ^
cc1: all warnings being treated as errors
/home/axel/git/lwip/lwip-contrib/ports/unix/../Common.allports.mk:94:
recipe for target 'snmp_msg.o' failed
make: *** [snmp_msg.o] Error 1

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-11-22 16:53:00 +01:00
goldsimon
b48106c662 Fixed build errors in makefsdata introduced with the last commit 2017-11-21 20:08:40 +01:00
goldsimon
5500a36b29 ... and fix DEBUG string 2017-11-21 12:55:07 +01:00
goldsimon
444dfeada8 task #14600: tcp_alloc(): kill TF_CLOSEPEND connections before other ESTABLISHED 2017-11-21 12:53:33 +01:00
goldsimon
5dc3072af8 makefsdata: added option "-ssi:<filename>" to control SSI tag checking/insertion through a list of filenames, not by checking the file extension at runtime
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-11-21 12:23:08 +01:00
goldsimon
26f55f1eb3 makefsdata: add information about SSI and about the version of the included header to files
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-11-21 12:23:08 +01:00
goldsimon
839e5ecec6 makefsdata: rework finding arguments, rework printing flags to file
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-11-21 12:23:07 +01:00
Joel Cunningham
ebcae98ae6 Revert "socket/netconn recv: FIN should only be reported once (as '0' for sockets, as 'ERR_CLSD' for netconns)"
This reverts commit db3a4e3158.

See description of regression in bug #52417
2017-11-20 13:54:11 -06:00
Joel Cunningham
6af3b4accc netconn: Add LWIP_HOOK_NETCONN_EXTERNAL_RESOLVE (patch #9427)
This adds a new hook allowing an external DNS resolver to be hooked into
netconn_gethostbyname(). The hook can handle some or all of the queries

One use case for this hook is to run mDNSResponder in the same system as LwIP
(mDNSResponder also uses LwIP's socekt APIs) and have it handle .local queries
while LwIP stack handles unicast DNS queries
2017-11-20 09:59:35 -06:00
goldsimon
2aed2fc215 sockets: prevent nested SYS_ARCH_PROTECT() for LWIP_NETCONN_FULLDUPLEX==1 2017-11-19 14:37:29 +01:00
Axel Lin
8b6bb1a503 apps/httpd: Fix build error when LWIP_HTTPD_TIMING=1
Include lwip/sys.h to fix below build error:

../../../../lwip/src/apps/httpd/httpd.c:470:23: error: implicit declaration of function ‘sys_now’ [-Werror=implicit-function-declaration]
     u32_t ms_needed = sys_now() - hs->time_started;
                       ^~~~~~~

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-11-19 14:17:52 +01:00
goldsimon
f5c37c8cbb Fix broken MSG_PEEK on TCP sockets (post-2.0.3 bug)
MSG_PEEK on TCP sockets was broken since commit b71d4477ea
from 06.03.2017: recv hung in an endless loop and tcp_recved() was called for peeked data
(which would result in a too large window advertised).

Aded TCP MSG_PEEK to socket unit tests
2017-11-18 13:34:20 +01:00
Axel Lin
d99144eef1 tcp: Remove superfluous variable in tcp_netif_ip_addr_changed()
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-11-17 22:12:09 +01:00
Axel Lin
2ff0ef027e Use NETIF_FOREACH macro at appropriate places
Use NETIF_FOREACH macro to get some optimizations for LWIP_SINGLE_NETIF case.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-11-17 22:09:40 +01:00
goldsimon
8c6884b2db tcp_close_shutdown: always deallocate the pcb if there is unread data on close (see bug #52403)
We preserved the TIME_WAIT handling before, but it seems this is not correct: we want to issue
a RST later again if someone wants to talk to this port. With TIME_WAIT, this might not always
the case.
2017-11-17 22:04:52 +01:00
goldsimon
0853d1e7d1 sntp: revert 2 -Wconversion changes (see bug #51538) 2017-11-17 21:39:23 +01:00
goldsimon
db3a4e3158 socket/netconn recv: FIN should only be reported once (as '0' for sockets, as 'ERR_CLSD' for netconns) 2017-11-17 21:22:53 +01:00
goldsimon
fa73f130f1 tcp: fix bug #36167 again (fixed in 2014, but when calling shutdown(WR) followed by recv(), this still happened) 2017-11-17 21:06:49 +01:00
Dirk Ziegelmeier
1e0501c31a Improve HTTPD documentation 2017-11-17 10:08:35 +01:00
Dirk Ziegelmeier
b0344518e8 sockets.c: Don't rely on #defines in socket.h to be in sync with ip.h
Map SO_* to SOF_* #defines
2017-11-17 09:41:26 +01:00
goldsimon
da01bc4d15 httpd: ssi: support selecting ssi files by file flags, not by extension (at runtime) only 2017-11-16 22:29:44 +01:00
goldsimon
8bd670430a httpd: ssi: move checking file extensions against g_pcSSIExtensions array into its own function guarded by LWIP_HTTPD_SSI_BY_FILE_EXTENSION 2017-11-16 22:24:17 +01:00
goldsimon
5d6b39f1ce httpd: work on option documentation 2017-11-16 22:17:32 +01:00
Joel Cunningham
c47d161d4a netifapi: add thread safe ARP APIs (task #14724)
This adds thread safe netifapi ARP cache APIs for add/remove
2017-11-16 13:59:33 -06:00
Axel Lin
40a563cdd3 dns: Use dns_backupserver_available() instead of open-coded
Slightly better readability by calling dns_backupserver_available()
instead of open-coded. Also move dns_backupserver_available() function
up to avoid forward declaration.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-11-16 19:48:35 +01:00
Axel Lin
d20a7aba0c netif: Use ip6_addr_isvalid() at appropriate places
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-11-16 19:48:24 +01:00
goldsimon
a73eb7ae72 pbuf.c: fix that pbuf_skip_const() was not prototyped for some configurations 2017-11-16 11:37:34 +01:00
David Girault
5290eacf08 altcp_mbedtls: close and error related fixes
- call conn->err() instead of conn->recv() if handshake fail and free conn
- close inner_conn and free current conn in altcp_mbedtls_close()

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-11-15 21:58:12 +01:00
goldsimon
245a6835f3 fixed bug #52403: netconn: FIN may be sent instead of RST when TCP netconn is closed with pending data in recv_mbox 2017-11-15 21:12:15 +01:00
goldsimon
bd2e820829 Fix double-free when closing mbedTLS connections
Partly revert commit 0486100a2b from 07.08.2017 as it breaks layering: every layer must free its own altcp_pcb. Freeing the inner_conn is not the right way.
2017-11-14 22:21:08 +01:00
Dirk Ziegelmeier
6ef5f68c72 Don't forget to save before committing! (compile fix for my previous commit) 2017-11-13 22:53:41 +01:00
Dirk Ziegelmeier
1fdc7571e0 Move DNS_MAX_RETRIES option from dns.c to opt.h 2017-11-13 22:52:39 +01:00
Dirk Ziegelmeier
2c1a152880 Fix bug #52239: if a DNS request is denied by a DNS server, this DNS request shouldn't be stopped if there is another DNS server to try
Apply improved version of Xiaodong Sun's patch
2017-11-13 22:51:08 +01:00
Dirk Ziegelmeier
a56ea1b19f dns.c: Rename goto label memerr to ignore_packet
Label is more descriptive this way
2017-11-13 22:37:38 +01:00
Dirk Ziegelmeier
1a1478551e Fix bug #52345: MQTT buffer length check seems wrong
(for empty payload in publish message)
2017-11-13 22:29:25 +01:00
Dirk Ziegelmeier
a82054d24f Follow-up to patch #9472: tcp_kill_prio: Don't kill active connection that has the same priority
Correctly search for connection with lowest prio AND longest inactivity time
2017-11-13 22:13:11 +01:00
goldsimon
1665fcba83 httpd: LWIP_HTTPD_CGI_SSI: complete unfinished documentation for httpd_cgi_handler() 2017-11-13 21:18:15 +01:00
goldsimon
365e031340 httpd: fixed double-free for default 404 file () for LWIP_HTTPD_DYNAMIC_HEADERS==1 2017-11-13 21:04:24 +01:00
Joel Cunningham
637bce91b4 netif: ensure link and admin states are up in issue reports (bug #52353)
This fixes a bug where some callers of netif_issue_reports were not
checking that both link and admin states were up, leading to extraneous
reports when calling one of the following

 1) netif_set_ipaddr
 2) netif_ip6_addr_set_parts
 3) netif_ip6_addr_set_state

The bug has been fixed by placing link and admin state checks in
netif_issue_reports and not requiring the callers to perform this
checking
2017-11-08 13:38:48 -06:00
Dirk Ziegelmeier
d864f8c3a3 Fix bug #52368: Minor typo in comment
I think "Internet checksum functions" is OK
2017-11-08 19:52:40 +01:00
Axel Lin
7a241b6b52 slipif: Fix unbalance SYS_ARCH_PROTECT in slipif_process_rxqueue()
Fixes: 3d1a306518 ("SLIP netif: add support for multiple input strategies (threaded, polling, RX from ISR)")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-11-08 19:48:00 +01:00
Axel Lin
a8acca5902 Trivial typo fix
s/chekc/check/g

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-11-07 13:44:43 +01:00
Joel Cunningham
a78dbb25c5 docs: small clean ups for last couple of commits:
* Fix typos in LWIP_NO_CTYPE_H comment block
 * Update comment around caller of tcp_kill_prio()
2017-11-06 09:37:10 -06:00
Dirk Ziegelmeier
d8b6cdffcb Apply patch #9472: tcp_kill_prio: Don't kill active connection that has the same priority
in a modified, IMHO more readable way.
2017-11-06 12:53:08 +01:00
Axel Lin
41cf4012af pbuf: Simplify pbuf_get_contiguous implementation
Use pbuf_skip_const() to simplify the implementation.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-11-06 12:22:32 +01:00
Axel Lin
c1efb9e296 pbuf: Make pbuf_add_header/pbuf_remove_header return error if invalid parameters
It does not make sense to return success in p == NULL or
invalid header_size_increment/header_size_decrement cases. Fix it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-11-06 12:22:30 +01:00
Dirk Ziegelmeier
7eb462867b Fix follow-up to [bug #52315] Minor typo in output of MIB compiler
LWIP_SNMP_OBJ_ID_LEN -> SNMP_MAX_OBJ_ID_LEN
2017-11-05 11:51:23 +01:00
Dirk Ziegelmeier
849dfb17c7 The macros in ip6_addr.c are duplicated from ip4_addr.c, so move them to lwIPs portability layer
...didn't see that in the first place...
2017-11-05 10:27:46 +01:00
Dirk Ziegelmeier
93f4245e89 ip6_addr.c: Convert several macros to private #defines
The macros are functions from ctype.h, but ctype.h declares them as functions, not as #defines
It makes no sense to abstract them in lwIPs portability layer, the functions are of low complexity and they are only used in this file.
2017-11-05 10:13:24 +01:00
Dirk Ziegelmeier
a9a3d473ac Make xchar() a private #define of ip6_addr.c, it is not standardized in any C header 2017-11-05 10:06:25 +01:00
Dirk Ziegelmeier
de991b1158 Apply patch #9478: MQTT.c printf warning in debug messages
in a modified version that uses lwIP's format string #defines
2017-11-05 09:51:26 +01:00
Joel Cunningham
472f7985b5 Introduce LWIP_PACKED_CAST to fix error issue with ARMCC
ARMCC when using __packed structures will not implicitly convert a
pointer to a member of a packed structure to something which does not
have __packed. This results in a compiler error and was found with calls
to icmp6_param_problem

While there is a #pragma pack mode in ARMCC that disables this error, it
does require existing ports to switch over their packing mode and
perform integration
2017-11-01 09:05:06 -05:00
Joel Cunningham
d39e8cd827 docs: replace old reference to TCPIP_APIMSG with netconn_apimsg 2017-10-29 16:52:03 -05:00
Dirk Ziegelmeier
08ec234127 Related to patch #9471: pbuf: Drop casting to u8_t for increment the reference count
Cast to correct type: Needed to avoid warnings about integer cast (-Wconversion)
SYS_ARCH_SET cannot be used here
2017-10-28 15:41:15 +02:00
Dirk Ziegelmeier
4a9e845a53 Fix bug #52300: Minor type in snmp_opts.h
The comments for MIN and MAX need to be swapped
2017-10-28 15:37:22 +02:00
Joel Cunningham
b953bd0393 docs: fix minor mis-spelling in sys.c 2017-10-27 15:33:18 -05:00
goldsimon
283fec0a36 fixed copy&paste bug introduced in last commit 2017-10-26 11:30:26 +02:00
goldsimon
0f685e4fb5 Fixed bug #52279: httpd.c http_init_file() miss uri 2017-10-25 21:58:53 +02:00
Joel Cunningham
b296d2c7bb docs: update tcp_kill_prio same priority comments
tcp_kill_prio will kill the oldest active connection of same/lower
priority. Update all comments so that it's clear the same priority
can be killed
2017-10-25 09:08:23 -05:00
Joel Cunningham
b18e6a8734 sockets: fix missing break regression in event_callback
During the refactoring in c5db278746, the
previous gotos were removed, but the lack of break statements in
NETCONN_EVNT_RCVMINUS and NETCONN_EVT_SENDMINUS was overlooked, leading
to incorrect fall through behavior
2017-10-23 09:05:57 -05:00
Joel Cunningham
22dacc38c0 Revert "Fix two bad "fall-through" code"
This reverts commit a7f2ef4aec.

The fall through is actually a regression
2017-10-23 08:59:43 -05:00
Dirk Ziegelmeier
98d5e06dba Silence gcc 7 warning about fall-through in case statement by adding a comment 2017-10-22 21:27:32 +02:00
Dirk Ziegelmeier
a7f2ef4aec Fix two bad "fall-through" code 2017-10-22 21:26:57 +02:00
Dirk Ziegelmeier
ddcf9cc764 Move all rawapi.txt to appropriate doxygen docs 2017-10-20 21:40:23 +02:00
Dirk Ziegelmeier
33ce04019d Move API description text from rawapi.txt to doxygen docs 2017-10-20 18:44:58 +02:00
Dirk Ziegelmeier
a8edee8268 Move all text from sys_arch.txt to appropriate doxygen places 2017-10-20 18:23:06 +02:00
Joel Cunningham
9c175835d5 sockets: poll Open Group clean ups
1) Define remaining Open Group poll constants (values in hex)
2) Switch nfds_t to unsigned int

http://pubs.opengroup.org/onlinepubs/007908799/xsh/poll.h.html
2017-10-19 14:03:56 -05:00
Nate Karstens
1960937df3 Enable support for MSG_DONTWAIT in lwip_recvmsg()
Enables support for MSG_DONTWAIT in lwip_recvmsg(). Support already
exists in lwip_recv_tcp() and lwip_recvfrom_udp_raw(); these are both
accessible from lwip_recvfrom(), which already supports MSG_DONTWAIT.

Signed-off-by: Nate Karstens <nate.karstens@garmin.com>
Signed-off-by: Joel Cunningham <joel.cunningham@me.com>
2017-10-19 13:55:25 -05:00
Dirk Ziegelmeier
f41b5b84b1 Try to fix build of bridgeif_fdb.c 2017-10-19 12:16:11 +02:00
goldsimon
cf07fddf96 lwip_poll_dec_sockets_used: remove unused SYS_ARCH_DECL_PROTECT(lev); 2017-10-19 06:52:33 +02:00
Joel Cunningham
8d04f3d622 docs: correct LWIP_IPV6_MLD reference on #endif comment 2017-10-18 11:48:00 -05:00
Dirk Ziegelmeier
4f2dc05c7c Improve documentation on bridgeif_fdb 2017-10-18 18:31:38 +02:00
Dirk Ziegelmeier
b3a379c239 BridgeIF: Move FDB implementation into a separate file, implementation is easier to understand like this. 2017-10-18 18:27:35 +02:00
Dirk Ziegelmeier
8a46a853d2 Improve system abstraction layer doxygen docs by moving documentation from sys_arch.txt to sys.c 2017-10-17 22:38:18 +02:00
Dirk Ziegelmeier
26b2628f01 Improve system abstraction layer doxygen docs by moving documentation from sys_arch.txt to the corresponding functions 2017-10-17 22:30:51 +02:00
Dirk Ziegelmeier
84b2a0f55b Remove raw API TCP/UDP function documentation from rawapi.txt - it is now integrated in doxygen docs.
This avoid having a second description for the same stuff that is "bit-rotting" because noone remembers to update this file.
Also remove outdated and misleading zero-copy TX information.
2017-10-17 21:59:34 +02:00
Dirk Ziegelmeier
d020bfc0df Improve UDP documentation using rawapi.txt texts 2017-10-17 21:50:18 +02:00
Dirk Ziegelmeier
001e1f1127 Improve lwIP doxygen documentation by copying several passages from rawapi.txt to the corresponding doxygen places 2017-10-16 23:24:52 +02:00
Dirk Ziegelmeier
921f601b5d Improve lwIP doxygen documentation by copying several passages from rawapi.txt to the corresponding function documentation 2017-10-16 23:14:28 +02:00
Our Air Quality
4d21d8da23 Allow LWIP_SOCKET_OFFSET with an external FD_SET
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-10-16 17:07:17 +02:00
Joel Cunningham
0882e0ba89 sockets: poll clean ups
This makes the following poll cleanups:

 1) Add LWIP_ERROR in lwip_poll to check for invalid fds/nfds combinations.
    This fixes a possible a NULL fds dereference in lwip_poll_scan()
 2) Use has_ copies of the socket events in lwip_poll_should_wake() rather
    passing the sock pointer and accessing socket after leaving the critical
    section
2017-10-16 08:06:31 -05:00
Dirk Ziegelmeier
ada6a84785 Fix documentation on relocating memory pools 2017-10-15 22:37:41 +02:00
Joel Cunningham
de531131c5 Fix compiler warnings seen with clang 8.1.0 on MacOS
This fixes the following warnings:

test_tcp.c:266:5: error: code will never be executed [-Werror,-Wunreachable-code]
    pbuf_free(p);
    ^~~~~~~~~
 - The check API 'fail' aborts the test, thus pbuf_free(p) will never be executed

pbuf.c:783:111: error: format specifies type 'unsigned short' but the argument has type 'u8_t' (aka 'unsigned char') [-Werror,-Wformat]
      LWIP_DEBUGF( PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_free: %p has ref %"U16_F", ending here.\n", (void *)p, ref));
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
 - LWIP_PBUF_REF_T is u8_t by default and doesn't match U16_F, so cast to u16_t. The cast and formatter will need to be changed
   if ref is larger than 16 bits

ethernet.c:105:16: error: format specifies type 'unsigned char' but the argument has type 'unsigned int' [-Werror,-Wformat]
               (unsigned)ethhdr->dest.addr[0], (unsigned)ethhdr->dest.addr[1], (unsigned)ethhdr->dest.addr[2],
~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 - addr[] is type u8_t, formatter is X8_F which should be 8 bits. 'unsigned' is an int, so cast to unsighed char instead
2017-10-13 07:52:34 -05:00
Our Air Quality
0794d88f09 If undefined then define O_NDELAY in terms of O_NONBLOCK.
Current newlib does not define O_NDELAY, but it needs to be the same
as O_NONBLOCK rather than using the lwip value of 1.

Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-10-09 12:31:23 +02:00
Dirk Ziegelmeier
856b0c3260 Fix bug #52189: list add and remove bug in <lwiperf.c>
Apply patch from xuyao hong
2017-10-09 12:30:12 +02:00
goldsimon
8fc69c9858 Revert changes of 07434aa73a (accidentally committed local changes) 2017-10-06 11:45:10 +02:00
Dirk Ziegelmeier
de5b693e7d Reformat netif subdir using astylerc 2017-10-03 21:22:04 +02:00
Dirk Ziegelmeier
47138f92d0 Fix a few doxygen comment issues 2017-10-02 10:08:48 +02:00
goldsimon
ad4358592a add MEM_SANITY_CHECK (behaves like MEMP_SANITY_CHECK) and ensure 'ram_end->prev' does not get changed 2017-09-26 22:30:18 +02:00
goldsimon
a61aee337b mem.c: beautify converting between struct mem and heap index (add ptr_to_mem/mem_to_ptr) 2017-09-26 22:13:44 +02:00
goldsimon
1710fc1a89 Fix a corner case of double-free in the heap 2017-09-25 22:29:02 +02:00
goldsimon
f058364d7f Added two simple unit tests for illegal calls to mem_free() 2017-09-25 21:38:00 +02:00
goldsimon
5e187bb8bc Tiny typo fix 2017-09-25 20:24:47 +02:00
Jens Nielsen
7115384b15 Clear seg->oversize_left after sending OK
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-25 20:21:17 +02:00
Joel Cunningham
6cdfae1245 sockets: cleanup ioctlsocket for LWIP_COMPAT_SOCKETS == 2 (patch #9456)
This makes two cleanups that follows the same organization as close/closesocket:

 1) There is no lwip_ioctlsocket. Instead lwip_ioctl should redirect to ioctlsocket
 2) With LWIP_POSIX_SOCKETS_IO_NAMES enabled, lwip_ioctl/ioctlsocket should redirect to ioctl
2017-09-22 08:51:48 -05:00
goldsimon
0c2d94a283 sntp: allow SNTP_UPDATE_DELAY to be a function 2017-09-22 06:26:53 +02:00
goldsimon
68d75a58df sockets: adapt poll to LWIP_MPU_COMPATIBLE; make LWIP_SOCKET_POLL and LWIP_SOCKET_SELECT independent options 2017-09-21 22:18:55 +02:00
Kalle Olavi Niemitalo
1152fd02c0 New sockets function: lwip_poll
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-21 21:50:36 +02:00
goldsimon
333f1bf2bd Fix compiling with LWIP_SOCKET_SELECT==0 2017-09-21 21:49:31 +02:00
Kalle Olavi Niemitalo
983eb8ebb4 Move select_cb list handling to functions (prepare for adding "poll")
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-21 21:10:08 +02:00
goldsimon
61e0a42cce Guard LWIP_COMPAT_SOCKETS definitions of lwip_socket with LWIP_SOCKET_SELECT 2017-09-21 21:05:50 +02:00
goldsimon
60356514c7 Guard struct lwip_select_cb definition with LWIP_SOCKET_SELECT 2017-09-21 20:20:23 +02:00
Our Air Quality
dbd726959c [PATCH] Replace the OOSEQ max bytes and pbufs constants with functions.
Some systems need to take into account an RX buffer pool size when
advising an appropriate number of RX pbufs to queue on the ooseq
list. For some systems there is a practical hard limit beyond which
the rx pool becomes exhausted blocking reception of further buffers
until some are freed.

It also helps to be able to consider the available dynamic memory when
advising an appropriate maximum number of bytes to buffer on the ooseq
list.

These decisions can also benefit from knowing the number already
allocated on a particular pcb, so the ooseq tcp segement is passed to
these functions. For example, if the system only wants to allow the
total number of rx pbufs queued on all the ooseq lists to grow by one
and a pcb already has two then it can return three for this call, but
might return one for another call - supporting a greedy allocation
strategy.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-21 10:36:21 +02:00
goldsimon
7dcc407c53 tcp_in: favour local variables over ifdef blocks 2017-09-21 10:12:36 +02:00
goldsimon
8f459cc242 Make TCP_OOSEQ_MAX_BYTES and TCP_OOSEQ_MAX_PBUFS work independently 2017-09-21 09:52:51 +02:00
goldsimon
6d2b181cc0 tcp_in: favour code block over #ifdef blocks for local variables only used in TCP_OOSEQ_MAX_BYTES || TCP_OOSEQ_MAX_PBUFS configs 2017-09-21 09:50:47 +02:00
David Girault
f48c71e17f altcp_tcp: free altcp_pcb struct in altcp_tcp_close()
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-20 20:50:03 +02:00
Dirk Ziegelmeier
8faf765632 Fix bug #52059: httpd/makefsdata assumes UNICODE
Patch by Gisle Vanem
And fixup one variable name (currName -> curName)
2017-09-20 12:41:31 +02:00
Jisu Kim
6447a583e2 ipv6 ready: When there are more fragments(Mbit is not zero), payload_length field in IPV6 header must be the multiple of 8 (see patch #9455)
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-19 14:29:27 +02:00
Jisu Kim
fa11461f84 ipv6 ready: Added exception handling to parse a routing header (see patch #9455)
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-19 14:21:10 +02:00
Jisu Kim
675c6e4428 ipv6 ready: Hop-by-Hop and destination option header must be checked more detailed (see patch #9455)
Hop-by-Hop, Destination option header structures consist of 2 unsigned char; next option type and header length field.
And TLV(Type-Length-Value) option headers come by the number in header length field.
If the option type in TLV option header is not recognized and 2 MSB is not 0, it is handled as an exception.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-19 14:18:38 +02:00
Jisu Kim
72171c12b5 ipv6 ready: Hop-by-Hop and destination option header must be checked more detailed (see patch #9455)
Hop-by-Hop, Destination option header structures consist of 2 unsigned char; next option type and header length field.
And TLV(Type-Length-Value) option headers come by the number in header length field.
If the option type in TLV option header is not recognized and 2 MSB is not 0, it is handled as an exception.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-19 14:12:10 +02:00
Jisu Kim
acb4b60517 ipv6 ready: icmp6_param_problem() should send an exact offset to point to the error (see patch #9455)
For this, convert 'u8_t nexth' to a pointer and change 'icmp6_param_problem()' to take a pointer, not an offset number

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-19 14:11:30 +02:00
Jisu Kim
7b27df1b83 ipv6 ready: clean up ipv6 header structs and add more header types & defines (see patch #9455)
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-19 14:08:16 +02:00
goldsimon
6d1c067719 tabs -> spaces 2017-09-19 09:20:40 +02:00
Dirk Ziegelmeier
931b5e643c Reformat core code using astylerc 2017-09-17 20:38:38 +02:00
Dirk Ziegelmeier
8c59be74c1 Reformat IPv4 code using astylerc 2017-09-17 20:33:27 +02:00
Dirk Ziegelmeier
3ed24085fa Reformat SNMP code using astylerc 2017-09-17 20:29:18 +02:00
Dirk Ziegelmeier
6e7fe4520a Reformat tftp_server.c using astylerc 2017-09-17 18:08:43 +02:00
Dirk Ziegelmeier
2ab73ad572 Reformat sntp.c using astylerc 2017-09-17 18:07:26 +02:00
Dirk Ziegelmeier
52d65ed1d0 Reformat netbiosns.c using astylerc 2017-09-17 18:05:07 +02:00
Dirk Ziegelmeier
be5bcc172d Reformat mqtt.c using astylerc 2017-09-17 18:04:29 +02:00
Dirk Ziegelmeier
914a20728e Reformat mdns.c using astylerc 2017-09-17 18:00:33 +02:00
Dirk Ziegelmeier
014420bfa0 Reformat lwiperf.c using astylerc 2017-09-17 18:00:23 +02:00
Dirk Ziegelmeier
6164f0cd34 Reformat httpd* using astylerc 2017-09-17 17:58:36 +02:00
Dirk Ziegelmeier
c35b1099a4 Reformat altcp_tls_mbedtls* using astylerc 2017-09-17 17:52:44 +02:00
Dirk Ziegelmeier
438cfd3f14 Reformat sockets.c using astylerc 2017-09-17 17:50:24 +02:00
Dirk Ziegelmeier
fa33db1448 Reformat tcpip.c using astylerc 2017-09-17 17:50:24 +02:00
Dirk Ziegelmeier
dc9115334e Reformat netifapi.c using astylerc 2017-09-17 17:50:24 +02:00
Dirk Ziegelmeier
771ac7ac44 Reformat netdb.c using astylerc 2017-09-17 17:50:24 +02:00
Dirk Ziegelmeier
bfae233e3e Reformat netbuf.c using astylerc 2017-09-17 17:50:24 +02:00
Dirk Ziegelmeier
3d60024f9b Reformat if_api.c using astylerc 2017-09-17 17:50:24 +02:00
Dirk Ziegelmeier
75847c8b4d Reformat err.c using astylerc 2017-09-17 17:50:24 +02:00
Dirk Ziegelmeier
2b977a4a6a Reformat api_msg.c using astylerc 2017-09-17 17:50:24 +02:00
Dirk Ziegelmeier
30152cea78 Reformat api_lib.c using astylerc 2017-09-17 17:50:24 +02:00
Jisu Kim
bd94297115 icmp6_send_response() sends the pointer in network byte order (see patch #9455: IPv6 ready test on RFC2460)
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-16 22:46:42 +02:00
goldsimon
ab1c9548e0 Increase IPv4 reassembly timeout according to RFC 791 2017-09-16 22:43:12 +02:00
Jisu Kim
27b7ed17fc First step to passing IPV6 Ready test: time out IPv6 fragments after 60 seconds
(added IPV6_REASS_MAXAGE as an option that is independent of the IPv4 setting)

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-16 22:41:35 +02:00
goldsimon
14919e34a1 icmp_input: fix possibly unused variable (used for debug output only) 2017-09-15 11:44:22 +02:00
Joel Cunningham
5c0054d8ee Remove double free on select_cb (bug #51990)
This was left over after the refactoring in 92b6f83eb2
2017-09-13 16:51:03 -05:00
goldsimon
7ba479e482 Try to fix clang runtime errors during unit tests (see bug #51652) 2017-09-12 21:51:50 +02:00
goldsimon
92b6f83eb2 Slightly rework the fix for bug #51990: allocate select_cb only if we actually need to wait 2017-09-12 21:37:48 +02:00
David Lockyer
72a00ca79c Fixed bug #51990: Calling select() from different threads with MPU enabled triggers memory protection fault
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-09-12 21:19:54 +02:00