Commit Graph

5711 Commits

Author SHA1 Message Date
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
c20d50acec Update cache handling in ZeroCopyRx.c - invalidate is faster than flushing 2018-01-02 08:40:23 +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
Joel Cunningham
a98d3a4efb Add test_def.c to Filelists.mk 2017-12-27 09:13:31 -06:00
Dirk Ziegelmeier
e77099673c Add flushing CPU cache to zero-copy RX code example 2017-12-24 13:12:32 +01:00
Dirk Ziegelmeier
27ca731242 Improve cache handling notes from my last commit some more 2017-12-24 13:07:35 +01:00
Dirk Ziegelmeier
8f6b876ef9 Common pitfalls document: Add note that lwip writes to ethernet RX buffers (caching issue!) 2017-12-24 13:02:30 +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
goldsimon
f8f31218d1 sockets_stresstest.c: some compile and runtime fixes 2017-11-23 09:19:01 +01:00
goldsimon
6e624f8035 multithreading socket test: implement more code paths 2017-11-22 23:08:57 +01:00
goldsimon
0397ff9ba4 Added initial version of multithreading socket test 2017-11-22 22:03:33 +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
cdabdcb00d test_sockets: disable test for calling recv() after remote closure
Re-enable these when calling recv() multiple times after remote closure
returns an error
2017-11-20 14:17:59 -06: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