Commit Graph

5778 Commits

Author SHA1 Message Date
goldsimon
f343a67b40 netif unit test: add some more tests for ext callbacks 2018-01-13 15:22:09 +01:00
goldsimon
e645d00484 netif unit test: fix -Werror=c++-compat 2018-01-13 15:16:12 +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
fa75ffed9d unit tests: added test_netif (checking ext_callbacks only, for now) 2018-01-12 22:27:15 +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
94ad523357 Update lwip.Doxyfile to doxygen 1.8.13 2018-01-12 15:01:14 +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
goldsimon
1affbb4bd5 unit tests: fixed testing itoa with too small buffer 2018-01-08 21:38:16 +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
d7566216c9 Remove Simon's compile fix in test_timers.c, it is not needed any more. The function is now used. 2018-01-08 13:02:58 +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
b4768f1711 Once again: Fix build warnings in test_timers.c 2018-01-08 08:34:17 +01:00
Dirk Ziegelmeier
bbb2e50327 Fix variable shadowing warning in my last commit 2018-01-08 08:12:33 +01:00
Dirk Ziegelmeier
3f30bfae28 lwipopts.h for unit tests: Increase number of timeouts 2018-01-08 07:34:38 +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
e415151cf2 minor style change: fixed indentation 2018-01-05 21:30:32 +01:00
goldsimon
40c0f21b9e Added dummy sys_mbox_trypost to unit test port 2018-01-05 21:30:07 +01:00
goldsimon
c4867b878c Try to silence unused function warning in travis 2018-01-05 21:12:31 +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
1623c3e2cc Add test for bug 52748
Disabled :-) -> travis doesn't complain
2018-01-05 08:20:36 +01:00
Dirk Ziegelmeier
8de4900641 Work on timer unit tests 2018-01-05 07:49:39 +01:00
Dirk Ziegelmeier
8542556a03 Fix build warning in test_def.c 2018-01-04 13:37:29 +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