Commit Graph

5187 Commits

Author SHA1 Message Date
Joel Cunningham
2b2ea50cb1 ip4: fix swapped src/dst params with ip4_route_src
This fixes a couple of occurrences where the src and dst parameters to
ip4_route_src() were swapped. This was most likely due to confusion between
ip_route(src, dst) and ip4_route_src(dst, src)

This was found in a system where LWIP_IPV4_SRC_ROUTING is 0

The UDP case was an application socket bound to INADDR_ANY with
IP_MULTICAST_IF set. Transmits would result in calling ip4_route(dst) where
dst was pcb->local_addr (which was INADDR_ANY) instead of pcb->mcast_ip4.
This resulted in a routing failure

The ICMP issue was found through code analysis only
2017-07-31 08:57:11 -05: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
500598658d ip4_reass: fixed bug #51596 (Insufficient overlap check) 2017-07-28 10:11:45 +02:00
goldsimon
3dedfa3d1f ip4_reass: fixed bug #51597 (Last fragment is assumed to have arrived even if it was discarded) 2017-07-28 09:46:56 +02:00
goldsimon
f1072fee8a ip4_reass: fixed bug #51595 (ip_reass_pbufcount may be updated incorectly) 2017-07-28 09:41:00 +02:00
Dirk Ziegelmeier
ca76c302f1 Probably fix bug #51602: MQTT Ring buffer 'get'
Rollover of get index was wrong
2017-07-28 08:01:30 +02:00
Our Air Quality
ff03ae6f55 dhcp: restart dhcp after releasing.
There were uses of dhcp_release() followed immediately by dhcp_discover() but
dhcp_release() now stops dhcp so discovery would fail, so call dhcp_start()
after release which restarts discovery.

Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-07-28 07:57:50 +02:00
Axel Lin
925f3944d3 init: Correct minimal MEMP_NUM_SYS_TIMEOUT setting check
According to commit 1f780e86d5 ("PPP timeouts required depend on the number of allowed PPP sessions"):
Per PPP needs 6 timeouts (AUTH + PAP|CHAP|EAP + LCP + IPCP + IP6CP + PPPoE).

So update the minimal MEMP_NUM_SYS_TIMEOUT setting check accordingly.
Since we have LWIP_NUM_SYS_TIMEOUT_INTERNAL so just switch to use it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-07-27 20:51:11 +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
Axel Lin
a92a281455 PPP, VJ: Use pbuf_clone to replace pbuf_alloc+pbuf_copy
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-07-26 21:18:33 +02:00
Dirk Ziegelmeier
ecd6c7ceae Fix bug #51525: MQTT_OUTPUT_RINGBUF_SIZE validation
Ringbuf now supports sizes that are not a power of two
2017-07-26 18:53:12 +02:00
Dirk Ziegelmeier
0d23d686eb snmp_asn1.c: Fix handling of u64 values 2017-07-26 12:48:19 +02:00
Dirk Ziegelmeier
0dabc8df9b snmp_asn1: Surround u64_t handling functions with #if LWIP_HAVE_INT64 2017-07-26 09:42:41 +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
b7e24fdc58 Accidentally removed a break statement in my last commit 2017-07-26 09:32:40 +02:00
Dirk Ziegelmeier
aa4d978448 Fix [bug #51520] Big endian bug in apps/snmp/snmp_asn1.c
Apply patch from Art Heers that does not need endianess checks
2017-07-26 09:28:07 +02:00
Dirk Ziegelmeier
f5d7535323 Work on [bug #51577] snmp/asn1: 64 bit encoding/decoding seems broken for big endian
We should support COUNTER64 data type only when we have u64_t on the system
2017-07-26 09:27:11 +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
4c13c32473 fix bug #51578 (SNMP failed to decode some values on non 32bit platforms) 2017-07-26 08:41:13 +02:00
Joel Cunningham
c5db278746 sockets: Refactor event_callback()
This refactors event_callback() to separate updating socket event
state from processing the select list (to apply socket event change)

Refactoring changes:

1) select_list_cb processing has been moved to a new local function called
select_check_waiters()
2) goto no_select_wakeup has been removed and now we use a flag
to track whether to call select_check_waiters()
3) There is a small functional change for !LWIP_TCPIP_CORE_LOCKING.
We call SYS_ARCH_UNPROTECT after saving events but before calling
select_check_waiters() (which now calls PROTECT before starting the loop).
Before the code held the PROTECT across saving the events and the first
loop iteration, but this didn't protect against anything because each loop
iteration we do an UNPROTECT/PROTECT
4) Better documentation for both LWIP_TCPIP_CORE_LOCKING and
!LWIP_TCPIP_CORE_LOCKING
2017-07-25 15:06:26 -05: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
goldsimon
a2e4dd2de7 Minor whitespace cleanups 2017-07-25 21:48:17 +02:00
Matthias Hofmann
9b06d71aeb Fix using DHCP IP configuration after lease time is expired.
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-07-25 21:46:57 +02:00
goldsimon
9b5d8f14a9 tcp_getoptbyte() -> tcp_get_next_optbyte() (to make it clearer that this function modifies something - not only a getter) 2017-07-25 21:38:06 +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
Pascal Quantin
2e78b6dcae Fixed bug #51528 (Bug when parsing WND_SCALE option)
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-07-24 21:38:47 +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
goldsimon
d01b3177fd Fix bug #51507 (Keep uses of SYS_ARCH_PROTECT/UNPROTECT in alloc_socket nested) 2017-07-20 21:18:40 +02:00
Joel Cunningham
99e1f37b82 IP_PKTINFO: set msg_controllen upon output
This fixes a bug where when writing IP_PKTINFO to msg_control, the
msg_controllen field was not updated with the length written

This bug is exposed by applications that provide a msg_control buffer large
enough for multiple control messages.  Then when calling CMSG_NXTHDR, it
returned a next cmsg pointer even though was no additional message
2017-07-20 12:29:56 -05:00
Joel Cunningham
5cd475d91b docs: remove 'unimplemented' tag from exceptset
The exceptset FDs in select() are implemented and record pending socket
errors.  This removes the 'unimplemented' tag in documentation
2017-07-18 16:56:02 -05:00
goldsimon
26771d0800 Add @todo: scope ip6addr? 2017-07-18 19:17:17 +02:00
Our Air Quality
5eff45cac0 Correct a few uses of sizeof(ip6_addr_t) to sizeof(ip6_addr_p_t)
The ip6_addr_t structure may have an addition slot so is not necessarily
the size of an ipv6 address, so some uses of sizeof(ip6_addr_t) were not
correct.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-07-18 19:17:17 +02:00
Joel Cunningham
7b13fae833 docs: update references to global igmp_group_list
This updates documentation to refer to netif specific igmp group list rather
than the old global igmp_group_list
2017-07-17 14:25:14 -05:00
Dirk Ziegelmeier
328134fdba Fix two -Wconversion warnings 2017-07-15 10:25:45 +02:00
goldsimon
3c371e4d52 Fixed bug #51379: (Sockets: prevent select_waiting overflow) 2017-07-14 20:16:11 +02:00
Dirk Ziegelmeier
aa317dcb18 Fix dhcp documentation 2017-07-12 11:09:36 +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
Dirk Ziegelmeier
d021972785 Fix "no previous prototype" warning when TCP_QUEUE_OOSEQ is disabled 2017-07-11 09:59:11 +02:00
Dirk Ziegelmeier
449eb64fcb Fix my last commit - break is missing 2017-07-10 09:52:48 +02:00
Dirk Ziegelmeier
57b1471254 Avoid return in case statement, makes function control flow equal to other case statement paths 2017-07-10 09:40:21 +02:00
Dirk Ziegelmeier
9130d37df7 Add "fall through" statement to Axel's patch 2017-07-10 09:37:59 +02:00
Axel Lin
6f28a874b8 pbuf: Simplify pbuf_alloc a bit
No need to have additional if statement for PBUF_REF/PBUF_ROM.
It can be merged to the existing swtich(type) cases.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-07-10 09:37:07 +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
c730a404d4 Make ioctl(FIONBIO) take an int*, not a u32_t* to got the *nix way 2017-07-06 20:25:41 +02:00
goldsimon
b8ecfe640c work on -Wconversion... 2017-07-06 12:38:50 +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
c5607d3889 Fix compiling ASSERT (broken some commits ago) 2017-07-05 12:22:02 +02:00
goldsimon
ba6b504cc0 work on -Wconversion... 2017-07-05 12:20:26 +02:00
goldsimon
9a40597ced work on -Wconversion... 2017-07-04 21:31:30 +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
0b91888eb1 remove invalid TODO comment 2017-07-04 20:09:41 +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
goldsimon
d262132b92 work on -Wconversion... 2017-07-03 20:15:02 +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
goldsimon
c636072362 pbuf.c: work on -Wconversion... 2017-06-29 22:49:39 +02:00
Axel Lin
ca9eae26e1 PPP, VJ: Use vj_uncompress_err at appropriate places
Use vj_uncompress_err() instead of duplicating the same code.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2017-06-29 11:44:11 +02:00
Axel Lin
79f2200b27 PPP, PPPoS: Fix update SNMP ifoutoctets counter in pppos_output_last()
Current code does not correctly update ifoutoctets counter because nb->tot_len
is always 0. Fix it by setting nb->tot_len to actual payload length so we can
update ifoutoctets correctly.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2017-06-29 11:44:08 +02:00
goldsimon
5bddbdd914 tcp_output: faster return when nothing is to send (pcb->unsent == NULL) 2017-06-29 08:47:26 +02:00
goldsimon
48e55b1e5d tcp_output: slightly move the jump target 'output_done': when nothing is to send, pcb->unsent cannot be NULL; add a 2017-06-29 08:43:59 +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
092c6c1f07 DNS_MAX_SOURCE_PORTS is PP-checked to be <= 255... 2017-06-26 08:48:17 +02:00
goldsimon
5efe26ebd3 Fix the fix for LWIP_LOOPBACK_MAX_PBUFS :-) 2017-06-26 08:21:53 +02:00
goldsimon
5b15234833 work on -Wconversion... 2017-06-25 23:01:57 +02:00
goldsimon
197166d906 LWIP_LOOPBACK_MAX_PBUFS: fix compilation or memory leak for LWIP_LOOPBACK_MAX_PBUFS > 255 2017-06-25 20:31:09 +02:00
goldsimon
af0f4d4020 Start making the source compile correctly with gcc -Wconversion enabled 2017-06-23 21:15:36 +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
10a5afeee7 Revert my last change to tcpip_callback() - it breaks the semantics of the function.
The function previously returned after posting a message, which is a short operation. Now it actually waits until the operation has completed - which may take a long time. This may break user programs. So all that remains is the cleanup separation in tcpip_callback() and tcpip_try_callback() :-(
2017-06-21 15:07:20 +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
11da4ef024 Use ip_addr_debug_print_val instead of ip_addr_debug_print where applicable 2017-06-21 13:26:55 +02:00
Axel Lin
aa98747d6f timeouts: Trivial comment fix for cyclic_timer
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-06-21 13:11:48 +02:00
Joel Cunningham
d4c8a1ac78 netconn: switch gethostbyname to use tcpip_send_msg_wait_sem (task #14523)
This switches netconn_gethostbyname to use tcpip_send_msg_wait_sem to
take advantage of core locking support when enabled.

tcpip_send_msg_wait_sem handles blocking for the non-core locking case,
so we can remove the manual blocking in netconn_gethostbyname. For the
core locking case, we need to block if waiting on DNS callback. To
achieve this, we unlock the core and wait in lwip_netconn_do_gethostbyname.
This is the similar approach that netconn_write takes when it needs to
block to continue the write (see lwip_netconn_do_write)

This improves performance in the core locking case and is no change
for the non-core locking case
2017-06-20 17:52:28 -05:00
goldsimon
f13b1340f2 Refine comment changed by last commit 2017-06-20 20:53:39 +02:00
Jakub Schmidtke
112e370457 Sending TCP timestamp option in SYN packets
TCP timestamps were only sent if the remote side
requested it first. This enables the use of timestamps
for outgoing connections as well.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-06-20 20:51:50 +02:00
Axel Lin
faf74b36a4 PPP, VJ: Use pbuf_take instead of duplicate copy code
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-06-20 20:26:01 +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
Axel Lin
02aaf12f48 stats: Use proper format modifier in stats_display_mem/stats_display_sys
Use proper format modifier and remove unnecessary cast.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-06-19 14:07:31 +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
5a27e97baf smtp.c: Fix detecting overlength server names
Thanks to Axel Lin
2017-06-14 22:06:37 +02:00
goldsimon
67d1970059 pbuf_alloced_custom(): less code duplication, please :-) 2017-06-14 21:39:53 +02:00
Dirk Ziegelmeier
3073affaaf Axel Lin correctly pointed out that there is no buffer overflow because smtp_server[SMTP_MAX_SERVERNAME_LEN + 1] - there is always room for terminating 0 byte 2017-06-14 14:11:27 +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
Axel Lin
4af438916a apps/smtp: Ensure smtp_server is NULL terminated
Ensure we set correct setting when changing smtp_server setting.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-06-14 12:33:57 +02:00
Dirk Ziegelmeier
d5cdb91611 Fix compile of Axel Lin's patch 2017-06-14 12:30:55 +02:00
Axel Lin
6b4cc984ad pbuf: Allow pass flags to pbuf_init_alloced_pbuf()
Then we can reuse pbuf_init_alloced_pbuf() in pbuf_alloced_custom().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-06-14 12:28:29 +02:00
goldsimon
7b45f3fa3f Fix sys_timeouts_init() for LWIP_TCP==0 (see patch #9375) 2017-06-13 22:04:57 +02:00
Axel Lin
e1ce5dc491 mem: Move LWIP_DEBUGF out of critical section in mem_malloc
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-06-13 22:02:17 +02:00
goldsimon
bab7a32eec Remove smtp_server when passing NULL to smtp_set_server_addr() (see patch #9373 for discussion) 2017-06-13 22:00:48 +02:00
Axel Lin
117d3abdf8 apps/smtp: Make smtp_state_str/smtp_result_strs/base64_table static
These tables are only referenced in smtp.c, so make them static.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-06-13 21:57:03 +02:00
goldsimon
07cc25a9df httpd: remove unnecessary "\0" suffix for CRLF string constant (see bug #51232) 2017-06-13 21:53:35 +02:00
goldsimon
ef5e44b2d3 Fix bug #51230 (Fix comment line) - change tcp_pcb to altcp_pcb 2017-06-13 21:14:16 +02:00
goldsimon
a92e838687 httpd: include hooks header file so that redefined defines/functions can be defined there 2017-06-13 21:13:45 +02:00
goldsimon
35ba3a877d Moved NUM_SOCKETS and struct lwip_sock to sockets_priv.h; added test case for fd_use count with select 2017-06-13 21:07:34 +02:00
goldsimon
85a85906d9 Fix bug #51122 (Mismatched socket->fd_used accounting when using lwip_select) 2017-06-13 20:58:45 +02:00
Joel Cunningham
3eaf976152 tcp: fix cwnd rollover introduced by ABC
Changes for TCP Appropriate Byte Counting introduce a potential cwnd
rollover by not taking into account integer promotion on tcpwnd_size_t
during inequality comparisions

This fixes the issue by introducing a macro TCP_WND_INC which detects
the rollover correctly and now holds the tcpwnd_size_t at the maximum
value rather than not incrementing the window.  This provides a slight
performance improvement by allowing full use of the tcpwnd_size_t number
space for the congestion window
2017-06-01 12:34:57 -05:00
Dirk Ziegelmeier
0df2c4f2be Map {tcp, udp, raw}_bind_netif() functions to netconn API 2017-05-31 20:16:21 +02:00
David Girault
dc2bdc2a21 memp: allow initialization of pool memory if not in standard section 2017-05-31 19:11:33 +02:00
Axel Lin
3aca7885a7 pbuf: Init pbuf if_idx to NETIF_NO_INDEX in pbuf_alloced_custom
Otherwise the p->pbuf.if_idx is uninitialized.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-05-31 19:10:00 +02:00
goldsimon
ba1cf2fa44 memp malloc: move LWIP_DEBUGF out of critical section (bug #51142) 2017-05-30 11:39:42 +02:00
Tim Cussins
84502e5ae0 etharp.c: Ensure etharp_query() allocates adequate pbuf if copying/consolidating.
etharp_query() queues packets, instead of sending, if a relevant arp-request is
pending.

Code walks the packet (a pbuf chain) to determine whether any pbufs are marked
'volatile': If so, we cannot simply enqueue the packet, and instead allocate a
new pbuf from RAM, copying the original packet, and enqueueing this new pbuf.

The bug here is that the allocation refers to the tot_len field of a temp pbuf*,
'p', instead of the head, 'q'.

In the case where the first pbuf of the chain is non-volatile but the second pbuf
*is* volatile, then we'll request an allocation that uses the tot_len field of
the second pbuf. If the first pbuf is non-zero length, the allocated pbuf (chain)
will be too small to allow the copy.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-05-29 21:48:51 +02:00
Our Air Quality
fb9fabb87c Initialize the tcp listen pcb netif_idx to NETIF_NO_INDEX.
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-05-29 21:48:51 +02:00
Axel Lin
cbbfb1356c pbuf: Make pbuf_init_alloced_pbuf take pbuf_type instead of u8_t for type parameter
All callers pass pbuf_type to pbuf_init_alloced_pbuf(), so make it take
pbuf_type instead of u8_t.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-05-24 12:19:32 +02:00
goldsimon
356da76cc8 Work on bug #3031/task #7896: change pbuf->type/enum pbuf_type to be more generic (see UPGRADING) 2017-05-22 22:30:55 +02:00
goldsimon
5c65402fd6 minor: whitespace change only to make the next diff smaller :-) 2017-05-22 22:30:19 +02:00
Axel Lin
10abb6b5ec ethernetif: Add #if LWIP_IPV4 guard around netif->output
netif->output and etharp_output are only available when LWIP_IPV4=1.
Fix the skeleton file.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-05-22 20:42:19 +02:00
Axel Lin
5dd037ea49 debug: Remove superfluous #ifudef checking for LWIP_PLATFORM_ASSERT/LWIP_PLATFORM_DIAG
The lwip/arch.h already provides a default implentation of LWIP_PLATFORM_ASSERT
and LWIP_PLATFORM_DIAG.
So both LWIP_PLATFORM_ASSERT and LWIP_PLATFORM_DIAG are never undefined here.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-05-15 21:04:21 +02:00
goldsimon
0bbf6490f5 setsockopt: allow SO_BROADCAST for UDP sockets only 2017-05-12 20:34:16 +02:00
goldsimon
8345e9035f gesockopt: fall-through in switch/case only if a case contains no code at all 2017-05-12 20:33:57 +02:00
goldsimon
5c35bab26c getsockopt: invalid type used to check for UDP 2017-05-12 20:31:11 +02:00
goldsimon
e80b2eb4cf Fix mdns_resp_del_service 2017-05-12 13:21:42 +02:00
David Girault
c8b7759e10 mdns: added support for removing service in mdns responder
New function `mdns_resp_del_service()` added.

Signed-off-by: goldsimon <goldsimon@gmx.de>
2017-05-12 13:12:22 +02:00
goldsimon
20fd844935 fixed typo in docs 2017-05-11 21:26:34 +02:00
goldsimon
79bd47736c SO_BROADCAST is valid for SOCK_DGRAM only 2017-05-11 20:48:57 +02:00
Axel Lin
9dee346000 apps/smtp: Fix memory leak in smtp_send_mail_alloced error paths
Call smtp_free_struct(s) in all smtp_send_mail_alloced error paths to ensure
no memory leak.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-05-11 10:47:20 +02:00
goldsimon
ec9096be40 fixed typo in httpd debug message 2017-05-10 13:41:26 +02:00
goldsimon
035bf4dcb0 Fixed bug #50992: window updated too often 2017-05-10 13:40:17 +02:00
Axel Lin
ae210967f2 apps/smtp: Fix memory leak if SMTP_BODYDH_MALLOC fails
Need to free s before return error.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-05-10 11:25:34 +02:00
Axel Lin
5bbe190b3b apps/smtp: Make smtp_send_bodyh_data takes "const char **from" parameter
Fixes 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 -Wno-address -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/smtp/smtp.c
../../../../lwip/src/apps/smtp/smtp.c: In function ‘smtp_send_body_data_handler’:
../../../../lwip/src/apps/smtp/smtp.c:1487:41: error: cast discards ‘const’ qualifier from pointer target type [-Werror=cast-qual]
     if((res = smtp_send_bodyh_data(pcb, (char **)&s->body, &s->body_len))
                                         ^
../../../../lwip/src/apps/smtp/smtp.c:1507:47: error: cast discards ‘const’ qualifier from pointer target type [-Werror=cast-qual]
             ((res = smtp_send_bodyh_data(pcb, (char **)&s->body, &s->body_len)) == BDHALLDATASENT)
                                               ^
cc1: all warnings being treated as errors
../../Common.allports.mk:94: recipe for target 'smtp.o' failed
make: *** [smtp.o] Error 1

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-05-10 08:43:07 +02:00
Axel Lin
f5f34f138c apps/smtp: Fix missing altcp conversion in smtp_send_bodyh_data
The pcb is "struct altcp_pcb *" so we cannot call tcp_sndbuf/tcp_write here.
Use altcp_sndbuf/altcp_write instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-05-10 08:18:00 +02:00
Axel Lin
b9d5399ec1 apps/smtp: Trivial typo fixes
s/smpt/smtp/g

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-05-10 08:06:49 +02:00
Joel Cunningham
c03fef9a3c bug #50837: add zero-window probe timeout
This commit adds a timeout to the zero-window probing (persist timer)
mechanism. LwIP has not historically had a timeout for the persist
timer, leading to unbounded blocking if connection drops during the
zero-window condition

This commit also adds two units test, one to check the RTO timeout
and a second to check the zero-window probe timeout
2017-05-09 09:01:03 -05:00
Axel Lin
d87b11e8f9 sockets: Remove unreachable break statements in event_callback
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-05-09 11:25:59 +02:00
Sylvain Rochet
4171f39a72 PPP: remove ppp_singlebuf
We don't have to keep a helper function just for the sake of a PBUF_RAW
constant. Inline ppp_singlebuf function.

Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2017-05-05 15:42:15 +02:00
Axel Lin
3e909bafa8 PPP: use pbuf_coalesce() instead of private ppp_singlebuf()
pbuf_coalesce() creates a single pbuf out of a chain of pbufs, which is
exactly what ppp_singlebuf() need.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Sylvain Rochet <gradator@gradator.net>
2017-05-05 15:36:26 +02:00
Dirk Ziegelmeier
a942582b4b Minor #ifdef cleanup in netif.c 2017-05-05 11:11:19 +02:00
Axel Lin
89d825f603 netif: Fix IPv6-only build
Fix below build error if LWIP_IPV4 == 0.
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 -Wno-address -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/netif.c
../../../../lwip/src/core/netif.c: In function ‘netif_add’:
../../../../lwip/src/core/netif.c:284:7: error: ‘ipaddr’ undeclared (first use in this function)
   if (ipaddr == NULL) {
       ^~~~~~
../../../../lwip/src/core/netif.c:284:7: note: each undeclared identifier is reported only once for each function it appears in
../../../../lwip/src/core/netif.c:285:14: error: implicit declaration of function ‘ip_2_ip4’ [-Werror=implicit-function-declaration]
     ipaddr = ip_2_ip4(IP4_ADDR_ANY);
              ^~~~~~~~
../../../../lwip/src/core/netif.c:285:5: error: nested extern declaration of ‘ip_2_ip4’ [-Werror=nested-externs]
     ipaddr = ip_2_ip4(IP4_ADDR_ANY);
     ^~~~~~
../../../../lwip/src/core/netif.c:285:23: error: ‘IP4_ADDR_ANY’ undeclared (first use in this function)
     ipaddr = ip_2_ip4(IP4_ADDR_ANY);
                       ^~~~~~~~~~~~
../../../../lwip/src/core/netif.c:287:7: error: ‘netmask’ undeclared (first use in this function)
   if (netmask == NULL) {
       ^~~~~~~
../../../../lwip/src/core/netif.c:290:7: error: ‘gw’ undeclared (first use in this function)
   if (gw == NULL) {
       ^~
cc1: all warnings being treated as errors
../../Common.allports.mk:94: recipe for target 'netif.o' failed
make: *** [netif.o] Error 1

Fixes: 5967380c20 ("netif_add: avoid passing NULL pointers to subsequent functions")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-05-05 10:39:15 +02:00
goldsimon
749e078d36 6lowpan: fix compiling with !LWIP_UDP 2017-05-05 09:19:02 +02:00
Dirk Ziegelmeier
5967380c20 netif_add: avoid passing NULL pointers to subsequent functions (reported by Axel Lin) 2017-05-05 09:07:40 +02:00
Axel Lin
9bbb741247 tcp: Remove unreachable code in tcp_close_shutdown_fin
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
2017-05-05 08:58:09 +02:00