Commit Graph

5154 Commits

Author SHA1 Message Date
Dirk Ziegelmeier
79a08c9fee tcp.c: Remove side-effects from boolean expressions 2017-08-08 11:05:23 +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
4fb7fab850 Fix docs on dhcp_option_trailer() 2017-08-07 08:08:24 +02:00
Our Air Quality
ff588fc771 dhcp: quieten a compile unused variable warning 2017-08-06 21:21:10 +02:00
goldsimon
a1c7924cb6 task #14597: cleanup pbuf_header usages (use pbuf_add_header/pbuf_remove_header instead) 2017-08-04 22:38:11 +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
a681f6b04f Fix using LWIP_HOOK_DHCP_PARSE_OPTION after recent dhcp changes 2017-08-04 21:53:24 +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
goldsimon
47f55b02bf Finally fix bug #50088 (socket/netconn: data before RST should be readable) and added a unit test for it 2017-08-03 22:28:50 +02:00
Joel Cunningham
6fa5d02435 tcp: remove extra seg == NULL checks
In tcp_output() there were a number of blocks of code performing
duplicate checks of 'if (seg == NULL)'.  This combines them together
to reduce duplicate checks

TCP_OUTPUT_DEBUG and TCP_CWND_DEBUG also don't need to be guarded
by #if/#endif since the LWIP_DEBUGF infrastructure already compiles them
out when LWIP_DEBUG is not defined
2017-08-03 10:37:16 -05:00
goldsimon
5ea7f507c3 Fixed bugs #51606 and #51535: IPv4 reassembly could be finished although there are holes 2017-08-02 21:11:53 +02:00
Axel Lin
2781d7abd7 ip6_reass: Move update ip6_frag.drop stats to nullreturn
The ip6_frag.drop counter is updated before all the code paths calling
goto nullreturn, so let's move updating ip6_frag.drop stats to nullreturn.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-08-01 20:48:08 +02:00
Joel Cunningham
5d2be3460f docs: update remaining api_msg_msg references
This updates some remaining references to the old struct api_msg_msg
(renamed to struct api_msg) in comment blocks
2017-08-01 11:56:54 -05:00
goldsimon
a81b19aa62 Fixed bug #51623: DHCP request XID should probably be regenerated for INIT-REBOOT 2017-07-31 20:20:31 +02:00
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