RIOT/pkg/lwip/init_devs/init.c:65:61: error: 'tcpip_6lowpan_input' undeclared (first use in this function)
return netif_add_noaddr(netif, state, lwip_netdev_init, tcpip_6lowpan_input);
^
If DEVELHELP is not set `LOCK_TCPIP_CORE()`/`UNLOCK_TCPIP_CORE()`
are not defined, leading to a build failure.
Defining them to no-op leads to a run-time segmentation fault, so
better always use those functions.
When reading from the socket with `sock_tcp_read()` it would only return
data from at most one internal connection buffer, even if the buffer
passed to `sock_tcp_read()` is larger and there is more data available
in the connection. This patch makes `sock_tcp_read` process all the
available data so long as there's more data to read available
immediately.
lwip receives network buffers that are made available to lwip_sock_tcp
calling `netconn_recv_tcp_pbuf`. The size of these buffers depends on
the size of the network packets. An application calling `sock_tcp_read`
can pass any arbitrary buffer size to read (copy) from these internal
network buffers, which may be smaller. lwip_sock_tcp keeps around the
last network buffer (`struct pbuf last_buf`) and the offset into this
buffer already consumed by the application (`last_offset`).
However, when multiple application reads from the same `pbuf` buffer
occur, the `last_offset` must be updated incrementing it. The code had
a bug that would work only when `last_offset` was either 0 (no previous
partial read) or when the current read was consuming all the remaining
data (when `buf_len == copylen`).
This patch fixes the issue an allows multiple reads from the same
buffer.
Netifs without link status support will keep sending discover
messages with increasing time between.
Netifs that support link status will wait for the link to be up,
and then start sending.
Netifs that support link status but send no link status events
will continue to not work (unless link status is up from the
first check when setting it up).
Set link state correctly in lwIP for interfaces that support
the NETOPT_LINK option. Interfaces that do not support it
(like tap for native arch) remain up all the time.
Netdevs that support NETOPT_LINK but do not send NETDEV_EVENT_LINK_UP/DOWN
events will end up with a mismatched link state - but DHCP would
already not start for them either.
Use netifapi to signal lwIP to do the work in its own thread.