Commit Graph

4925 Commits

Author SHA1 Message Date
Dirk Ziegelmeier
8025b85694 Second draft of task #14283: Add more detailed status callback 2017-02-14 10:59:28 +01:00
Joel Cunningham
b2beb42c14 Remove forward declaration of struct lwip_sock
The forward declaration was added in commit
e2c2afbbe0 for use in struct
lwip_setgetsockopt_data, but became dead after commit
5d2e93e5f0 where the sock pointer was
removed from lwip_setgetsockopt_data
2017-02-13 17:22:52 -06:00
Dirk Ziegelmeier
7dd21e93c4 Fix my last commits (unused variable warning)
my gcc at home did not show this warning...
2017-02-13 22:27:59 +01:00
Dirk Ziegelmeier
3c1713406e Work on task #14283: Add more detailed status callback
Cleanups and IPv6 address status
2017-02-13 21:52:55 +01:00
Dirk Ziegelmeier
58c48af58f Start working on task #14283: Add more detailed status callback
IPv6 stuff is not implemented
2017-02-13 21:40:08 +01:00
Joel Cunningham
0b257f71e7 Fix comment typo from bug #47485
tcp_close_shutdown_impl() should be tcp_close_shutdown_fin()
2017-02-13 11:25:05 -06:00
Dirk Ziegelmeier
45f3c28eb2 Fix netif_find() function for many netifs (should use atoi) and move it to the bottom of the file where similar functions are located 2017-02-13 13:35:30 +01:00
Dirk Ziegelmeier
400c41ffd9 Also base netif_index_to_name function on netif_get_by_index 2017-02-13 13:26:54 +01:00
Dirk Ziegelmeier
d4d8fd819d Some code cleanup related to netif index handling
Made the macro "netif_index_to_num" private, if someone needs it externally, please complain.
2017-02-13 13:21:45 +01:00
Dirk Ziegelmeier
32954e9d4f Fix comment in my previous commit 2017-02-13 13:00:10 +01:00
Dirk Ziegelmeier
c01096097c Move struct ip4_addr2 and corresponding copy macros from ip4_addr.h to prot/etharp.h where they belong
Also rename struct not to clash with IP4_ADDR2 macro definition, and rework copy macros to contain a source/dest direction
2017-02-13 12:34:38 +01:00
goldsimon
44068e3109 minor: mark variable "unused" after assigning it 2017-02-13 11:43:56 +01:00
goldsimon
693a74c286 For tiny targtes, LWIP_RAND is optional -> fix compile time checks 2017-02-13 11:43:25 +01:00
Dirk Ziegelmeier
06c84cb110 My documentation changes forced the usage of rand() function, which is not desired
By default, the code that does NOT need LWIP_RAND() is active now
2017-02-13 10:38:18 +01:00
Dirk Ziegelmeier
de05424ff6 Fix build in IPv4 only case when source based routing is disabled 2017-02-10 22:52:43 +01:00
Dirk Ziegelmeier
def87c0c23 Add David's IPv6 multicast work to CHANGELOG 2017-02-10 22:42:14 +01:00
David van Moolenbroek
6ce9a01c3e raw: add core support for multicast TX options
The patch simply copies the relevant bits from the UDP implementation.
Perhaps most notably, the patch does *not* copy the IPv4-only UDP
support for IP_MULTICAST_IF, because that option can also be
implemented using the interface index based approach. Largely thanks
to this omission, at least on 32-bit platforms, this patch does not
increase the RAW PCB size at all.
2017-02-10 22:37:35 +01:00
David van Moolenbroek
ab8119360e udp: add core-level multicast support for IPv6
So far, the UDP core module implemented only IPv4 multicast support.
This patch extends the module with the features necessary for socket
layers on top to implement IPv6 multicast support as well:

o If a UDP PCB is bound to an IPv6 multicast address, a unicast source
  address is selected and used to send the packet instead, as is
  required (and was the case for IPv4 multicast already).

o Unlike IPv4's IP_MULTICAST_IF socket option, which takes a source
  IPv4 address, the IPV6_MULTICAST_IF socket option (from RFC 3493)
  takes an interface identifier to denote the interface to use for
  outgoing multicast-destined packets. A new pair of UDP PCB API
  calls, udp_[gs]et_multicast_netif_index(), are added to support
  this. The new definition "NETIF_NO_INDEX" may be used to indicate
  that lwIP should pick an interface instead.

  IPv4 socket implementations may now also choose to map the given
  source address to an interface index immediately and use the new
  facility instead of the old udp_[gs]et_multicast_netif_addr() one.
  A side effect of limiting the old facility to IPv4 is that for dual-
  stack configurations with multicast support, the UDP PCB size is
  reduced by (up to) 16 bytes.

o For configurations that enable loopback interface support, the IPv6
  code now also supports multicast loopback (IPV6_MULTICAST_LOOP).

o The LWIP_MULTICAST_TX_OPTIONS opt.h setting now covers both IPv4
  and IPv6, and as such is no longer strictly linked to IGMP. It is
  therefore placed in its own lwIP options subgroup in opt.h.

The IPV6_MULTICAST_HOPS socket option can already be implemented using
the existing IP_MULTICAST_TTL support, and thus requires no additional
changes. Overall, this patch should not break any existing code.
2017-02-10 22:37:29 +01:00
sg
4a9db56f4c Tiny speed/size improvement: don't check netconn_type twice on socket-receive 2017-02-10 22:01:21 +01:00
sg
a3fc38037a minor: move assert to a slightly better place 2017-02-10 21:30:07 +01:00
David van Moolenbroek
240cf62056 tcp: fix accept event on closed listening PCBs
If LWIP_CALLBACK_API is not defined, but TCP_LISTEN_BACKLOG is, then
the LWIP_EVENT_ACCEPT TCP event may be triggered for closed listening
sockets.  This case is just as disastrous for the event API as it is
for the callback API, as there is no way for the event hook to tell
whether the listening PCB is still around.  Add the same protection
against this case for TCP_LISTEN_BACKLOG as was already in place for
LWIP_CALLBACK_API.

Also remove one NULL check for LWIP_CALLBACK_API that had already
become redundant for all callers, making the TCP_EVENT_ACCEPT code
for that callback wrapper more in line with the rest of the wrappers.
2017-02-10 21:28:18 +01:00
sg
b9e66bfcfb Provide a better way to include system's <errno.h> for errno + error numbers (LWIP_ERRNO_INCLUDE can't be defined to <errno.h> at least on GCC/linux) 2017-02-10 21:18:08 +01:00
Dirk Ziegelmeier
239498f37c Implement task #14367: Hooks need a better place to be defined
We now have a #define for a header file name that is #included in every .c file that provides hooks.
2017-02-10 13:25:04 +01:00
goldsimon
bc07fd9db5 Fixed bug #47485 (tcp_close() should not fail on memory error) by retrying to send FIN from tcp_fasttmr 2017-02-10 09:42:38 +01:00
Joel Cunningham
82711e069c socket_priv.h: add newline at EOF 2017-02-09 23:17:01 -06:00
Joel Cunningham
2cab253b34 Minor if_api.h cleanups
This commit makes the following minor cleanups:
  1) Add C++ support
  2) Guard header with #if LWIP_SOCKET
2017-02-09 22:48:47 -06:00
Joel Cunningham
3a7e03aaff Add errno support to if_indextoname()
This commit adds support in if_indextoname() to return ENXIO when
no interface is found.  This conforms to the Open Group/RFC 3493
specification

In order to leverage errno set support, the set_errno macro from
sockets.c was moved to sockets_priv.h
2017-02-09 22:32:29 -06:00
Joel Cunningham
852993029d Add sockets_priv.h header
This commit introduces a sockets_priv.h header for socket API internal
implementations intended to be used by sockets API C files, but not
applications

This commit moves struct lwip_setgetsockopt_data to the private header
because this is not part of the public sockets API, but needs to be
shared between sockets.c and memp.c

This header lays ground work for sharing other internal sockets types
/macros between API files (sockets.c and if_api.c)
2017-02-09 22:04:30 -06:00
sg
c396dd4554 Clean up icmp6.c a bit after adding IPv6 scopes 2017-02-09 21:18:40 +01:00
Dirk Ziegelmeier
702091d548 igmp.c: igmp_lookup_group() should be static 2017-02-09 21:08:40 +01:00
Dirk Ziegelmeier
4d8fec3b67 Rename "IPv6 mapped IPv4 addresses" to their correct name from RFC4191: "IPv4-mapped IPv6 address" 2017-02-09 21:02:12 +01:00
sg
c1c470fc4c Fixed bug #44032 (LWIP_NETCONN_FULLDUPLEX: select might work on invalid/reused socket) by not allowing to reallocate a socket that has "select_waiting != 0" 2017-02-09 20:41:27 +01:00
Dirk Ziegelmeier
eae4129863 Documentation updates related to Joel's if_api changes 2017-02-09 19:39:07 +01:00
Dirk Ziegelmeier
fb0a750970 Choose another title for zones documentation page 2017-02-09 13:21:20 +01:00
Dirk Ziegelmeier
a826b1aeeb Add IPv6 scopes to documentation 2017-02-09 13:21:19 +01:00
goldsimon
ea093d3a53 http_add_connection: add connections to the front to be faster (and really fix bug #50059) 2017-02-09 13:08:17 +01:00
goldsimon
5743864744 Fixed bug #50059 (httpd LWIP_HTTPD_SUPPORT_11_KEEPALIVE vs. LWIP_HTTPD_KILL_OLD_ON_CONNECTIONS_EXCEEDED) 2017-02-09 13:01:37 +01:00
Luc Revardel
819bfbb943 Fix bug #50220 (mld6_leavegroup does not send ICMP6_TYPE_MLD, even if last reporter)
Signed-off-by: sg <goldsimon@gmx.de>
2017-02-08 22:29:32 +01:00
David van Moolenbroek
03f47e58a3 udp/raw: prevent packet length overflows
Previously, on netifs with unrestricted MTUs (typically loopback
interfaces), it was possible to give a packet to the UDP/RAW API
calls that is so large that when prepending headers, the pbuf's
tot_len field would overflow. This could easily result in
undesirable behavior at lower layers, e.g. a crash when copying
the packet for later delivery.

This patch models such overflows as memory allocation errors, thus
resulting in clean failures. Checks have to be added in multiple
places to cover (hopefully) all cases.
2017-02-08 22:19:46 +01:00
David van Moolenbroek
fffd61c746 Patch #9250 (slightly changed): fix source substitution in ip6_output_if() (broken in 2014 with be75c483d0)
Signed-off-by: sg <goldsimon@gmx.de>
2017-02-08 22:16:32 +01:00
sg
21737f57e5 Fixed bug #50090 (ast_unsent->oversize_left can become wrong value in tcp_write error path) 2017-02-08 21:42:30 +01:00
Joel Cunningham
0284961d61 if APIs: update copyright claim
Update copyright claim on new if API files
2017-02-07 10:32:41 -06:00
Joel Cunningham
22b892571b Add parenthesis to clarify sin6_scope_id cast
Add parenthesis to clarity on cast of sin6_scope_id and not sin6 pointer
2017-02-07 10:12:31 -06:00
Joel Cunningham
a0a64a59ba Fix sockets on MSVC after IPv6 zone work
This fixes the following build failure with MSVC 2013:

sockets.c(323): warning C4242: '=' : conversion from 'const u32_t' to 'u8_t', possible loss of data

This casts sin6_scope_id to a u8_t before calling ip6_addr_set_zone()
2017-02-07 10:03:33 -06:00
Dirk Ziegelmeier
8a34570b83 Fix compile without IPv6 zone support
Fixed warning about unreachable code because ip6_addr_has_zone is always 0
2017-02-05 13:33:10 +01:00
Dirk Ziegelmeier
46f4584796 Fix cast from pointer to numeric in slipif.c 2017-02-05 12:53:42 +01:00
Dirk Ziegelmeier
55e6bf7e3d Fix compile when IPv6 is disabled 2017-02-05 12:53:20 +01:00
Dirk Ziegelmeier
d857344aa8 patch #9249: tcp: Fix unused parameter 'dest' build warning if !LWIP_IPV6
Apply modified version of Axel Lin's patch, without #ifdef
2017-02-05 12:44:32 +01:00
Dirk Ziegelmeier
ef758082ed Fix that slipif used netif->num to pass parameters to slipif_init.
Use netif->state now, interpreted as u8_t port number (not a pointer any more!)
2017-02-05 12:35:42 +01:00
Dirk Ziegelmeier
1fd56658b8 Add IPv6 scopes to CHANGELOG 2017-02-04 18:44:30 +01:00