Commit Graph

2376 Commits

Author SHA1 Message Date
goldsimon
ac03107036 lowpan6_common.c: add comments from ble version 2018-03-21 22:53:08 +01:00
goldsimon
a4b9beef04 Move common 6LoWPAN code to new file lopwan6_common.c
This is mainly IPHC (de)compression.

TODO: adapt the 6LoWPAN-over-BLE netif to this.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-03-21 20:55:05 +01:00
goldsimon
0074022bb5 minor: fix typos and spaces 2018-03-13 20:28:59 +01:00
goldsimon
61a1b98cc9 various IPv6-only compile fixes 2018-03-07 20:55:00 +01:00
Axel Lin
971404ff90 http_client.h: Include lwip/pbuf.h
struct pbuf is used by httpc_headers_done_fn, thus need to include
lwip/pbuf.h.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-03-07 15:24:14 +08:00
Axel Lin
0411332856 api_msg.h: Fix build error when LWIP_NETIF_API && !LWIP_SOCKET && !LWIP_NETCONN
netifapi related lwIP internal definitions should be guarded
by #if LWIP_NETIF_API rather than #if LWIP_NETCONN || LWIP_SOCKET.

Fix below build errors:
cc -g -DLWIP_DEBUG -Wall -pedantic -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 -Wmissing-prototypes -Wredundant-decls -Waggregate-return -Wlogical-not-parentheses -Wlogical-op -Wc90-c99-compat -Wtrampolines -I. -I../../..  -I../../../../lwip/src/include -I../../../ports/unix/port/include -I../../../../mbedtls/include -Wno-redundant-decls -DLWIP_HAVE_MBEDTLS=1 -c ../../../../lwip/src/api/netifapi.c In file included from ../../../../lwip/src/api/netifapi.c:46:0:
../../../../lwip/src/include/lwip/netifapi.h:76:50: error: unknown type name 'netifapi_void_fn'; did you mean 'netif_init_fn'?
 err_t netifapi_netif_common(struct netif *netif, netifapi_void_fn voidfunc,
                                                  ^~~~~~~~~~~~~~~~
                                                  netif_init_fn
../../../../lwip/src/include/lwip/netifapi.h:77:29: error: unknown type name 'netifapi_errt_fn'; did you mean 'netif_input_fn'?
                             netifapi_errt_fn errtfunc);
                             ^~~~~~~~~~~~~~~~
                             netif_input_fn
../../../../lwip/src/api/netifapi.c: In function 'netifapi_do_netif_add':
../../../../lwip/src/api/netifapi.c:67:22: error: dereferencing pointer to incomplete type 'struct netifapi_msg'
   if (!netif_add( msg->netif,
                      ^~

Fixes: 30a2283993 ("Move netifapi private definitions to priv/api_msg.h")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-03-07 07:58:10 +08:00
goldsimon
b6d9bb6b2a http_client: check current state when receiving FIN 2018-03-06 21:51:13 +01:00
goldsimon
6e62baaa6c sockets.h: include <string.h> for memcpy in FD_ZERO 2018-03-01 09:05:29 +01:00
goldsimon
cb746a1aea zepif: fix destination IP (default should be broadcast, not 0.0.0.0) 2018-03-01 07:08:03 +01:00
goldsimon
43a55003da Added a netif encapsulating 6LowPAN in ZEP (ZigBee Enxapsulation Protocol)
This protocol is sent over a 2nd netif via UDP/IP and can used to analyze
6LoWPAN with a Wireshark dissector.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-28 22:58:48 +01:00
goldsimon
d9770d2c5f tcpip_thread: TCPIP_MSG_INPKT: free input pbufs if the input function returns an error
This simply wasn't the case until 6LoWPAN. However, since tcpip_input is like this, we
should stay with that pattern.

Adapted documentation in netif.h

Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-28 22:48:56 +01:00
goldsimon
3a8af612b3 lowpan6.c: handle 6-byte MAC addresses on netif, too 2018-02-28 22:46:55 +01:00
goldsimon
3a93029e92 lowpan6.c: implement software CRC (e.g. required for use with ZEP) 2018-02-28 21:39:38 +01:00
goldsimon
4f059fea76 fix some IEEE_802154_FC_ bit definitions 2018-02-28 21:03:40 +01:00
Axel Lin
6e6eb620df tftp_opts.h: Make TFTP_DEBUG default OFF
TFTP_DEBUG should be enabled only when it's necessary to debug tftp,
make it default OFF.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-02-28 13:49:44 +08:00
Axel Lin
3c71e3fc77 lowpan6_ble_opts.h: Make LWIP_RFC7668_DEBUG default OFF
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-02-27 18:04:36 +08:00
goldsimon
fb5bbca1d9 lowpan6.c: move IEEE 802.15.4 definitions to their own header file
This is mainly a preparation to merge the two 6LoWPAN netifs
2018-02-26 20:38:41 +01:00
Axel Lin
7697a45405 lowpan6_ble_opts.h: Add #ifndef guard for LWIP_RFC7668_LINUX_WORKAROUND_PUBLIC_ADDRESS
Avoid "LWIP_RFC7668_LINUX_WORKAROUND_PUBLIC_ADDRESS" redefined build
warning if it's set to 0 by lwipopts.h.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2018-02-25 12:01:01 +08:00
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
aa04944ae0 Add DHCPv6 to documentation 2018-02-23 12:35:45 +01:00
goldsimon
7d007cfee5 DHCPv6: make LWIP_IPV6_DHCP6_STATELESS==LWIP_IPV6_DHCP6 by default 2018-02-23 09:26:46 +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
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
Dirk Ziegelmeier
333fff3e66 Improve altcp allocator documentation 2018-02-20 13:31:27 +01: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
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
bd656efd64 http client: add https support, fix parsing header with chained pbufs 2018-02-16 12:29:40 +01:00
goldsimon
3dafa72ec8 apps: add http client
Signed-off-by: goldsimon <goldsimon@gmx.de>
2018-02-15 22:10:29 +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
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
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
6934bb4428 netif: ext_callback: make LWIP_NSC_ defines, not an enum; fix mdns accordingly 2018-02-07 20:35:49 +01: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
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
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
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
9fb86f6e4b tcp: add a define for maximum option bytes 2018-02-01 09:14:22 +01:00
goldsimon
0ee7a39594 tcp: add comments about usage of options 2018-01-30 22:01:54 +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
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
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
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
goldsimon
30ddfe1a98 Make LWIP_VERSION work with the preprocessor again. 2018-01-16 20:37:10 +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
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
990c25d4f3 Add unit test for a long running timer 2018-01-12 12:37:16 +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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
goldsimon
1665fcba83 httpd: LWIP_HTTPD_CGI_SSI: complete unfinished documentation for httpd_cgi_handler() 2017-11-13 21:18:15 +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
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
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
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
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
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
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
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
Dirk Ziegelmeier
ada6a84785 Fix documentation on relocating memory pools 2017-10-15 22:37:41 +02: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
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
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
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
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
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
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
7ba479e482 Try to fix clang runtime errors during unit tests (see bug #51652) 2017-09-12 21:51:50 +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
Joel Cunningham
445eef2b0e sockets: add readv() implementation (task #14610)
Adds an implementation of readv() that calls recvmsg()

See http://pubs.opengroup.org/onlinepubs/009695399/functions/readv.html
2017-09-11 14:48:33 -05:00
goldsimon
e749678eed Fix function signature of fcntl() for LWIP_COMPAT_SOCKETS == 2 && LWIP_POSIX_SOCKETS_IO_NAMES (see bug #51701) 2017-08-25 22:07:14 +02:00
Joel Cunningham
f582c88339 tcp: persist timer re-work (bug #50837)
This re-works the persist timer to have the following behavior:

  1) Only start persist timer when a buffered segment doesn't fit within
     the current window and there is no in-fligh data.  Previously, the
     persist timer was always started when the window went to zero even
     if there was no buffered data (since timer was managed in receive
     pathway rather than transmit pathway)
  2) Upon first fire of persist timer, fill the remaining window if
     non-zero by splitting the unsent segment.  If split segment is sent,
     persist timer is stopped, RTO timer is now ensuring reliable window
     updates
  3) If window is already zero when persist timer fires, send 1 byte probe
  4) Persist timer and zero window probe should only be active when the
     following are true:
       * no in-flight data (pcb->unacked == NULL)
       * when there is buffered data (pcb->unsent != NULL)
       * when pcb->unsent->len > pcb->snd_wnd
2017-08-25 09:35:10 -05:00
Dirk Ziegelmeier
f457769fe8 Add netconn_join_leave_group_netif() that takes netif index as argument 2017-08-21 09:42:57 +02:00
Dirk Ziegelmeier
e58e398267 Implement IPv6 IPV6_JOIN_GROUP/IPV6_LEAVE_GROUP socket options 2017-08-16 17:41:46 +02:00
Dirk Ziegelmeier
9d74883491 Moving eth_type to iana.h was incorrect - these are assigned by IEEE. IANA published a document containing these numbers, but does not assign them. I didn't see that in the first place :-(
Now we have ieee.h, too.
2017-08-15 13:50:12 +02:00
Dirk Ziegelmeier
c6fac10b62 Rename eth_type enum in iana.h to be prefixed with lwip_iana_ 2017-08-15 13:42:39 +02:00
Dirk Ziegelmeier
aaee7ed1e7 Improve documentation in iana.h 2017-08-15 13:40:37 +02:00
Dirk Ziegelmeier
2013f4cbd4 Move eth_type definition to iana.h 2017-08-15 13:35:30 +02:00
Joel Cunningham
b8a3cf3a4a tcp: use tcp_set_flags() rather than manually setting flag 2017-08-09 12:15:52 -05:00
Joel Cunningham
ba7a3204cb tcp: use tcp_ack_now rather than manually setting TF_ACK_NOW 2017-08-09 10:13:41 -05:00
goldsimon
90873d6c71 Continue fixing the spirit of bug #51663: don't change pcb state if retransmission can't be done because segments are still queued for transmission
- add a better-documented static function tcp_output_segment_busy
- try to reduce the number of checks
- tcp_rexmit_rto: iterate pcb->unacked only once
- no need to check for ref==1 in tcp_rexmit_fast when tcp_rexmit does
- call tcp_rexmit_fast if dupacks >= 3 (not == 3) and use TF_INFR flag to guard the fast-rexmit case (that way, it's triggered again on the next dupack)
2017-08-08 23:02:14 +02:00
Joel Cunningham
902d393aef tcp: map tcp_ack_now() directly to tcp_set_flags()
Also remove extra set of parenthesis in tcp_ack()
2017-08-08 14:56:00 -05:00
goldsimon
fed916b852 tiny doc change to LWIP_HOOK_IP4_ROUTE_SRC 2017-08-08 21:03:41 +02:00
goldsimon
6d28e9de79 Some cleanups after applying David Girault's altcp patches 2017-08-08 12:59:49 +02:00
David Girault
0486100a2b altcp_tls: some fixes
- added `altcp_tls_free_config()`.
- added `altcp_tls_context()` function to allow mbedtls parameter tweak.

  Since state structure isn't exported, this allow application to get
  internal context (port dependent) to tweak it.

- free altcp_pcb when lower error callback called.
2017-08-08 12:59:47 +02:00
David Girault
ee89d906ec altcp_tcp: some fixes
- expose `altcp_tcp_setup()` so we can wrap altcp over existing tcp pcb.
- avoid calling tcp_close() with NULL pcb.
- free altcp_pcb struct when error callback called.

According to `mqtt_tcp_err_cb()` in src/apps/mqtt/mqtt.c, altcp socket should
work the same way than raw tcp socket. So freeing altcp_pcb ensure this.
2017-08-08 12:59:46 +02:00
Dirk Ziegelmeier
60dd518887 Implement task #14594: Improve consistency of ip route API parameters
reverse parameters of ip4_route_src to be consistent with other ip*_route* functions
This commit will break applications using this function!
2017-08-08 12:41:19 +02:00
Dirk Ziegelmeier
1c91118f4a Add DHCP ports to iana.h 2017-08-08 11:46:15 +02:00
Dirk Ziegelmeier
0eb8d19e82 Move several port number #defines to iana.h 2017-08-08 11:37:08 +02:00
Dirk Ziegelmeier
5193844ac4 iana.h: Prefix #defines with LWIP_ 2017-08-08 11:21:11 +02:00
goldsimon
51c4bc55a0 iana.h: added RFC 2017-08-07 22:07:09 +02:00
Dirk Ziegelmeier
629ec98dd8 Work on task #14587: Create common header for IANA assigned numbers
Create include/lwip/prot/iana.h
Move DHCP and ARP #define in there
2017-08-07 21:06:19 +02:00
Dirk Ziegelmeier
42fd01547d Fix bug #51681: mqtt: cannot free client
Add free function
2017-08-07 20:43:25 +02:00
goldsimon
1981cf39d1 opt.h: improved hooks documentation by adding function signatures for all hooks 2017-08-04 21:55:10 +02:00
goldsimon
cd80e38db8 Clean up DHCP a bit: no need keep msg_out and msg_in as members in struct dhcp
They are used in a call stack only (p_out and options_out_len as well)
2017-08-04 21:26:29 +02:00
goldsimon
65ac160e99 Wconversion-related cleanup: split pbuf_header(s16_t) into pbuf_add_header(size_t) and pbuf_remove_header(size_t)
The new functions both take size_t as increment/decrement argument instead of s16_t (which needed to be range-checked before conversion everywhere) - in most places, the direction (increment or decrement) is known anyway, so no need to encode it in a sign bit
2017-08-04 13:16:18 +02:00
Dirk Ziegelmeier
006bb84368 Fix bug #50883: struct eth_addr alignment does not fit with ETHADDR16_COPY
... by simply removing ETHADDR16_COPY since noone advocated to keep it
2017-07-30 17:48:16 +02:00
goldsimon
a6432c46aa Clarify LWIP_NUM_SYS_TIMEOUT_INTERNAL regarding PPP and make the number of required timeouts per ppp_pcb configurable as we don't really know it right now ;-) 2017-07-27 20:50:40 +02:00
goldsimon
45fb7d7220 Give struct fs_file::pextension its own type & improve its documentation (see also task #14567) 2017-07-26 22:16:26 +02:00
Dirk Ziegelmeier
b5fe13d818 Don't declare SNMP_ASN1_TYPE_COUNTER64 on systems that do not have uint64_t to avoid runtime problems 2017-07-26 09:33:15 +02:00
Dirk Ziegelmeier
3ec8b22f14 snmp_core.h: Add room for u64 values in union snmp_variant_value 2017-07-26 09:06:13 +02:00
goldsimon
0ee6ad0a3a Removed LWIP_SOCKET_SET_ERRNO - errno is always set - if it doesn't exist, it must be provided by the port 2017-07-25 21:54:10 +02:00
Matthias Hofmann
64bceabc03 Increase SNTP_RECV_TIMEOUT to be conform with RFC.
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-07-25 20:52:25 +02:00
goldsimon
6d51b3ff37 Restructure compatibility headers to fix bug #51463 2017-07-20 22:11:55 +02:00
Our Air Quality
f934ca7a03 [PATCH] Deprecate sys_arch_sem_wait and sys_arch_mbox_fetch returning the time waited
These are now defined to return != SYS_ARCH_TIMEOUT on success rather than the time
waiting. The returned times were unused by lwip and this simplifies at
least some implementations.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-07-20 22:04:34 +02:00
Dirk Ziegelmeier
328134fdba Fix two -Wconversion warnings 2017-07-15 10:25:45 +02:00
Dirk Ziegelmeier
d62d3edc08 Update tcpip.c/.h documentation 2017-07-12 11:08:35 +02:00
Dirk Ziegelmeier
30a2283993 Move netifapi private definitions to priv/api_msg.h 2017-07-12 10:56:42 +02:00
Dirk Ziegelmeier
c08459490d Update netifapi documentation 2017-07-12 10:48:43 +02:00
Dirk Ziegelmeier
66df84a5b5 Map dhcp_release_and_stop() to netifapi, mark old functions as deprecated 2017-07-12 10:43:40 +02:00
goldsimon
f3c860958f -Wconversion (still far from finished) and other minor compilation fixes... 2017-07-06 22:47:11 +02:00
goldsimon
866d6c8637 Make PBUF_LINK_ENCAPSULATION_HLEN default signed (unsigned would be OK, but too many defines are signed already and mixing them gets bad) 2017-07-06 20:26:24 +02:00
goldsimon
2594f1a423 Try to fix the build: ip_globals.current_ip6_header cannot really be const :( 2017-07-06 11:50:02 +02:00
goldsimon
694fc7e472 work on -Wconversion... 2017-07-06 11:22:38 +02:00
goldsimon
9d61e36466 work on -Wconversion, fixed some const bug in ip4 2017-07-06 09:01:03 +02:00
goldsimon
44f7a3cb0d work on -Wconversion... 2017-07-05 22:31:58 +02:00
goldsimon
ba6b504cc0 work on -Wconversion... 2017-07-05 12:20:26 +02:00
goldsimon
debf34ff9c work on -Wconversion... 2017-07-04 21:26:30 +02:00
goldsimon
2b2fa0ed71 Ensure SACKs are deleted when pbuf_free_ooseq() frees ooseq pbufs (because of memory shortage) 2017-07-04 20:10:23 +02:00
goldsimon
1a1c360f1d Fixed LWIP_TCP_SACK_VALID and its usage 2017-07-03 21:41:34 +02:00
goldsimon
6796bcf7ad Cleaned up a bit after merging SACK_OUT support (mostly coding style) 2017-07-03 21:20:56 +02:00
Jakub Schmidtke
b1a3c37c3c Partial SACK (RFC 2018) support
Adds partial support for selective acknowledgements (RFC 2018).
This change makes lwIP negotiate SACK support, and include SACK
data in outgoing empty ACK packets. It does not include it
in outgoing packets with data payload.
It also does not add support for handling incoming SACKs.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-07-03 20:17:30 +02:00
Dirk Ziegelmeier
94beb4eddf Make inet_chksum.c compile with -Wconversion 2017-06-30 22:17:32 +02:00
goldsimon
41177cfd1c work on -Wconversion... 2017-06-30 22:10:16 +02:00
Joel Cunningham
229c9edad2 tcp: switch tcpflags_t to u16_t for all cases (bug #51326)
This changes tcpflags_t to be a u16_t for all cases.  The TCP Appropriate
Byte Count support added a new flag that used a bit past 8 and since this
flag is now required, tcpflags_t can no longer be a u8_t

This does not increase the size of struct tcp_pcb due to padding that
already existed (see bug #51326 for details)

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-06-28 21:47:33 +02:00
goldsimon
5b15234833 work on -Wconversion... 2017-06-25 23:01:57 +02:00
Matthias Hofmann
c12aa3fb40 Remove double definition of SNTP_SERVER_DNS.
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-06-23 21:05:30 +02:00
Dirk Ziegelmeier
d02a73c285 Replace usages of tcpip_callback_with_block(foo, bar, 0) with tcpip_try_callback() 2017-06-22 08:14:02 +02:00
goldsimon
b4921dc401 Ensure that all parts of an ip_addr are written for the various set commands when setting an ipv4 address in dual-stack configurations (for security & compiler warning reasons :) 2017-06-22 07:48:38 +02:00
goldsimon
c9e7e56389 Fix IPv4-only and IPv6-only after again last commits 2017-06-21 22:01:19 +02:00
goldsimon
c094fcc086 Try to make gcc work without -Wno-address 2017-06-21 16:07:36 +02:00
Dirk Ziegelmeier
68d36f19f0 Implement LWIP core locking support in tcpip_callback_with_block()
Created two new functions for API cleanup:
tcpip_callback() that blocks until message is posted, cannot be called from IRQs.
tcpip_try_callback() that does not block and just tries to post a message. Can be called from IRQs.
Add compatibility #define tcpip_callback_with_block() that maps to these two functions according to "block" parameter.
2017-06-21 13:42:54 +02:00
goldsimon
79d69ce526 Slightly optimize pbuf_alloc: encode 'header offset' in 'enum pbuf_layer' instead of switch/case (which was duplicated in pbuf_alloc and pbuf_alloced_custom) 2017-06-21 13:37:05 +02:00
goldsimon
fc23257ca0 Fix unused arg from last patch the *real* lwIP way ;-) 2017-06-20 20:13:31 +02:00
Dirk Ziegelmeier
b92bcc5f02 Fix unused arg from last patch the lwIP way 2017-06-19 14:11:35 +02:00
Our Air Quality
6e62b6090b Silence some unsed variable warnings. 2017-06-19 14:09:07 +02:00
Dirk Ziegelmeier
c923d00340 Fix bug #51238: LWIP_ARRAYSIZE() can't be used on lwip_cyclic_timers
Add const int variable containing number of array elements
2017-06-14 23:07:55 +02:00
goldsimon
7197bf25f0 Add another posix compatibility header 2017-06-14 23:05:30 +02:00
goldsimon
82b9f86b45 Fixed bug #51195 (Calling inet_pton() causes buffer overrun on a struct in6_addr) 2017-06-14 22:22:14 +02:00
Dirk Ziegelmeier
3611b583f5 smtp.c, smtp_set_server_addr: Avoid smtp_server buffer overrun when server name length is SMTP_MAX_SERVERNAME_LEN -> "smtp_server[len] = 0" is an out-of-bound access 2017-06-14 12:40:58 +02:00
goldsimon
ef5e44b2d3 Fix bug #51230 (Fix comment line) - change tcp_pcb to altcp_pcb 2017-06-13 21:14:16 +02:00