Commit Graph

4864 Commits

Author SHA1 Message Date
Dirk Ziegelmeier
2ad03b0ebd Add documentation for LWIP_PROVIDE_ERRNO in arch.h 2017-02-02 09:18:30 +01:00
Dirk Ziegelmeier
29b7c75a72 Revert fixes "bug #50162: Minor bug in errno.h"
They are a breaking change :-(
This reverts commit abef0b44a8.
2017-02-02 08:42:09 +01:00
Dirk Ziegelmeier
e8d5499d72 Code cleanup: add some parentheses in tcp.c and tcp_out.c 2017-02-01 15:28:10 +01:00
goldsimon
4b091cfc2a Fix comment on lwip_shutdown() (it's not unimplemented any more) 2017-02-01 10:09:37 +01:00
goldsimon
48d2243845 Clarify/add LWIP_PROVIDE_ERRNO comments 2017-01-31 12:38:53 +01:00
Axel Lin
2685d742e8 stats: Remove superfluous /t in end of stats display
The debug message after the stats display looks odd because the /t in end of
stats display.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-01-31 08:57:26 +01:00
Dirk Ziegelmeier
a1df0c5d77 Fix build failue in err.h reported by Axel Lin
In file included from ../../../../lwip/src/include/lwip/sockets.h:49:0,
                 from ../../../../lwip/src/core/init.c:47:
../../../../lwip/src/include/lwip/errno.h:46:5: error:
"LWIP_PROVIDE_ERRNO" is not defined [-Werror=undef]
 #if LWIP_PROVIDE_ERRNO
     ^~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
../Common.mk:93: recipe for target 'init.o' failed
make: *** [init.o] Error 1
2017-01-31 08:57:25 +01:00
David van Moolenbroek
2e528ad510 PPP: clear address state before clearing address
netif_ip6_addr_set_state() relies on being able to access the old
address on invalidation, for example in order to invalidate PCBs
and leave the correct solicited-node MLD group.
2017-01-27 19:07:14 +01:00
Dirk Ziegelmeier
abef0b44a8 bug #50162: Minor bug in errno.h
#ifdef -> #if
2017-01-27 09:09:21 +01:00
Dirk Ziegelmeier
ee3154999a Add CHANGELOG to lwIP HTML documentation 2017-01-24 11:45:51 +01:00
Dirk Ziegelmeier
7a99d2f8e9 Fix documentation on netif_index_to_name 2017-01-24 11:39:34 +01:00
Joel Cunningham
6fbec25c8f if.c include lwip/if.h
if.c was not including lwip/if.h and failed to build with
-Werror=missing-prototypes on gcc/clang
2017-01-23 17:40:36 -06:00
Joel Cunningham
fbfe987ae8 netif: clean up remaining index shadowing from if APIs
This commit cleans up the remaining instance of global variable
"index" shadowing caused by using local variables and function
parameters named "index"

These were introduced in the recent interface index API commits
2017-01-23 17:23:54 -06:00
Dirk Ziegelmeier
d297d466ed Fix some more variables named "index" - found by Joel Cunningham 2017-01-23 21:46:11 +01:00
Dirk Ziegelmeier
0ef298b21f Fix warning about shadowing a global variable "index" in netifapi.c 2017-01-23 21:12:29 +01:00
Dirk Ziegelmeier
9e0b36747a Fix warning about shadowing a global variable "index" in if.c 2017-01-23 20:21:49 +01:00
Ajay Bhargav
b5011e7012 api:if: Handle case when LWIP_NETIF_API is not defined
When LWIP_NETIF_API is not enabled in lwipopts.h. Return error from if
APIs

Signed-off-by: Ajay Bhargav <contact@rickeyworld.info>
2017-01-23 09:30:00 -06:00
Joel Cunningham
e158f87286 Netif: add allowance for init to override netif->num
Adjusts assert logic from 9c80a66253
to allow for a netif driver's init callback to manually override
the number.  When the init function is taking care of the unique
assignment, the assert simply checks that a valid number was provided
2017-01-20 14:55:29 -06:00
Dirk Ziegelmeier
edac92d03a Minor compile fix in netifapi.c: Use LWIP_CONST_CAST to cast away constness 2017-01-20 21:27:05 +01:00
Joel Cunningham
1b20e664bf Task #14314: Add interface name/index APIs
This commit adds the following sets of interface name/index APIs:

Interface Identification APIs from RFC 3493:
  * lwip_if_nametoindex (COMPAT macro if_nametoindex)
  * lwip_if_indextoname (COMPAT macro if_indextoname)

netifapi:
  * netifapi_netif_name_to_index
  * netifapi_netif_index_to_name

netif:
  * netif_name_to_index
  * netif_index_to_name
  * netif_num_to_index
  * netif_index_to_num
2017-01-20 14:06:42 -06:00
Joel Cunningham
9c80a66253 Netif: add netif_num overflow assert
This commit adds an LWIP_ASSERT to detect when netif_num overflows and
we no longer have unique numbers per netif.  Unique netif numbers are
needed to support interface indexes (task #14314)

The only cases where this could occur are with a deployment that attempts
to use the maximum 256 netifs at the same time or where netifs are being
constantly adding and removed.  Neither of these use cases fit the
lightweight goals of LwIP

See discussion in task #14314 for more details
2017-01-20 14:03:54 -06:00
Dirk Ziegelmeier
645ca84704 Retry 1 to fix bug #50064
Accidentally used the wrong destination HW addr
2017-01-18 13:43:01 +01:00
Dirk Ziegelmeier
7aaa888d1d Optimize my last fix in etharp.c, I missed the variable declaration at the beginning of the function 2017-01-18 13:21:11 +01:00
Dirk Ziegelmeier
c362c6a02c Add note about bug #50064 to CHANGELOG 2017-01-18 12:33:26 +01:00
Dirk Ziegelmeier
47bac3c11f Remove special ARP reply optimization from etharp.c
- Code duplication with etharp_raw()
- No great effect on perfomance
- May make reworking PBUF handling code more complicated (see bug #49914)
- The check for p->type == PBUF_REF is a strange special case, too
- Simon also voted to remove it
2017-01-18 12:25:09 +01:00
Dirk Ziegelmeier
199c38de29 Fix bug #50064: Zero-copy RX: ARP reply fails with PBUF_REF
Kept the optimized version intact, see discussion in savannah bug tracker
2017-01-18 10:15:02 +01:00
sg
b198c877db fix compiling TCP unit tests with IPv6 enabled 2017-01-16 14:21:08 +01:00
Axel Lin
141b5def46 tcp_out: Use LWIP_MIN instead of open-coded for better readability
Make the intention of code more clear by using LWIP_MIN instead of open-coded.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-01-16 10:25:10 +01:00
Axel Lin
30aedfc3f7 tcp_out: Fix comment for last_unsent->oversize_left and tcp_pcb.unsent_oversize
Both last_unsent->unsent_oversize and tcp_pcb.unsent_oversized fields are not
exist, fix the comments.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-01-16 08:51:53 +01:00
Dirk Ziegelmeier
df8e404abd Add some parentheses for better code readability in tcp_in.c 2017-01-16 08:51:27 +01:00
Dirk Ziegelmeier
9898d406bc Fix bug #50040: pbuf_alloc(..., 65534, PBUF_RAM) succeeds
Check for integer overflow when calculating memory allocation size
2017-01-15 17:36:33 +01:00
Dirk Ziegelmeier
0043bf78b6 Minor typo fix in tcp_out.c 2017-01-15 16:37:25 +01:00
Axel Lin
e1598b0b11 tcp_out: Fix oversize vs. space assertion test
oversize_used is always 0 at this point, should test oversize instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-01-15 16:36:48 +01:00
Dirk Ziegelmeier
861dab5b22 Set lwIP version to 2.0.2 in doxygen script 2017-01-15 09:22:33 +01:00
Dirk Ziegelmeier
5c58e25de5 Minor code readability improvement in mqtt.c 2017-01-15 09:22:13 +01:00
Dirk Ziegelmeier
1d7f375992 Fix compile error in ip6_frag.c
../../../../lwip/src/core/ipv6/ip6_frag.c: In function ‘ip6_reass’:
../../../../lwip/src/core/ipv6/ip6_frag.c:567:7: error: ISO C90 forbids mixed declarations and code [-Werror=pedantic]
2017-01-14 09:31:06 +01:00
Dirk Ziegelmeier
92511f4711 Fix part 2 of bug #50042: ETHADDR16_COPY from netif->hwaddr
Eliminate ETHADDR32_COPY macro - it cannot be used in ETH_PAD_SIZE case. I could have kept it by defining it to ETHADDR16_COPY in case of ETH_PAD_SIZE, but I did not consider it worth another #ifdef mess.
2017-01-13 08:18:33 +01:00
Dirk Ziegelmeier
6748aa0818 Fix part 1 of bug #50042: ETHADDR16_COPY from netif->hwaddr
Rearrange struct netif to group more u8_t values together which may result in smaller struct netif on 32 bit systems
2017-01-13 08:06:50 +01:00
Dirk Ziegelmeier
bc583c993a Add comment about my fix to bug #47512: MPU_COMPATIBLE may fail on empty pool to api_lib.c
Code looks like it could be optimized, but it can not!
2017-01-12 16:36:17 +01:00
Axel Lin
2c3538cb8f IPv6: Fix compile error of ip6_frag.c
Fix below compile error:
../../../../lwip/src/core/ipv6/ip6_frag.c: In function ‘ip6_reass’:
../../../../lwip/src/core/ipv6/ip6_frag.c:533:20: error: declaration of ‘next_pbuf’ shadows a previous local [-Werror=shadow]
       struct pbuf* next_pbuf = iprh->next_pbuf;
                    ^~~~~~~~~
../../../../lwip/src/core/ipv6/ip6_frag.c:272:20: note: shadowed declaration is here
   struct pbuf *q, *next_pbuf;
                    ^~~~~~~~~
cc1: all warnings being treated as errors
../Common.mk:93: recipe for target 'ip6_frag.o' failed
make: *** [ip6_frag.o] Error 1

Fixes: 7cedf7ae71 ("IPv6: fragment reassembly fixes")
Signed-off-by: Axel Lin <axel.lin@ingics.com>
2017-01-11 16:16:41 +01:00
David van Moolenbroek
9713baea55 ip6: improve length checks for extension headers
Malformed packets could cause the extension header iteration code to
read from up to two bytes beyond the end of the packet's first pbuf.
2017-01-11 14:05:24 +01:00
David van Moolenbroek
7cedf7ae71 IPv6: fragment reassembly fixes
This patch aims to fix three closely related issues.

o The implementation of IPV6_FRAG_COPYHEADER was fundamentally
  incompatible with the presence of extension headers between the
  IPv6 header and the Fragment Header. This patch changes the
  implementation to support such extension headers as well, with
  pretty much the same memory requirements. As a result, we can
  remove the check that prevented such packets from being reassembled
  in all cases, even with IPV6_FRAG_COPYHEADER off.

o Given that temporary data is stored in the Fragment Header of
  packets saved for the purpose of reassembly, but ICMPv6 "Fragment
  Reassembly Time Exceeded" packets contain part of the original
  packet, such ICMPv6 packets could actually end up containing part
  of the temporary data, which may even include a pointer value. The
  ICMPv6 packet should contain the original, unchanged packet, so
  save the original header data before overwriting it even if
  IPV6_FRAG_COPYHEADER is disabled. This does add some extra memory
  consumption.

o Previously, the reassembly would leave the fragment header in the
  reassembled packet, which is not permitted by RFC 2460 and prevents
  reassembly of particularly large packets (close to 65535 bytes
  after reassembly). This patch gets rid of the fragment header. It
  does require an implementation of memmove() for that purpose.

Note that this patch aims to improve correctness.  Future changes
might restore some of the previous functionality in order to regain
optimal performance for certain cases (at the cost of more code).
2017-01-11 14:05:22 +01:00
Dirk Ziegelmeier
b17c050861 Fix compile of my last change in httpd_opts.h (use of undefined preprocessor macro) 2017-01-11 12:28:09 +01:00
Dirk Ziegelmeier
2b1ebda6f1 Minor correction to last patch: Avoid #including socket.h in api_msg.c 2017-01-11 12:27:30 +01:00
Knut Andre Tidemann
5e9df2c698 lwip: fix broken default ICMPv6 handling of checksums.
ICMPv6 should always have checksum generated for it as per RFC 3542
chapter 3.1.
2017-01-11 12:24:15 +01:00
Dirk Ziegelmeier
f8ef8c48f7 Simplify HTTPD #include path handling
- Move fsdata.h content to lwip/apps/fs.h -> no #include path needed any more to src/apps/httpd/
- Create a #define to specify fsdata file name. One can use path in there now, e.g. "../mywebserver/mkfsdata_output.c" -> no #include path needed any more to location of generated file
2017-01-11 10:59:15 +01:00
Dirk Ziegelmeier
a038e1502f Add David's IPv6 improvements to CHANGELOG 2017-01-11 08:42:40 +01:00
Dirk Ziegelmeier
2e265310c4 Fix (bogus) MSVC 2010 warning about uninitialized variable usage in ip6.c
It's wrong because the variables are initialized during first loop iteration due to best_addr == NULL
2017-01-11 08:08:05 +01:00
David van Moolenbroek
713146eeba nd6: cull destination cache on router removal
As per RFC requirements, upon removing a router from the default
router list, remove any entries pointing to it from the destination
cache. While here, synchronize timing out entries in the default
router list with the rest of the timer code.

When removing a netif, clear the destination cache altogether
in order to prevent more general inconsistency. When this happens,
the entries for other netifs will have to be rebuilt, but removing
netifs should be sufficiently rare that this is not worth optimizing.
2017-01-11 07:54:17 +01:00
David van Moolenbroek
a1130f8c7b nd6: some work on basic RFC 4861 compliance
The current ND implementation does not yet implement the most basic
required ('MUST') checks for message validation and generation.

- implement some of the required checks for message validation;
- document the remaining missing message validation checks;
- hardcode the hop limit of Neighbor Discovery messages rather than
  having it depend on lwIP configuration which, if changed, would
  cause all of ND to cease working.
2017-01-11 07:54:15 +01:00