This makes the following poll cleanups:
1) Add LWIP_ERROR in lwip_poll to check for invalid fds/nfds combinations.
This fixes a possible a NULL fds dereference in lwip_poll_scan()
2) Use has_ copies of the socket events in lwip_poll_should_wake() rather
passing the sock pointer and accessing socket after leaving the critical
section
This fixes the following warnings:
test_tcp.c:266:5: error: code will never be executed [-Werror,-Wunreachable-code]
pbuf_free(p);
^~~~~~~~~
- The check API 'fail' aborts the test, thus pbuf_free(p) will never be executed
pbuf.c:783:111: error: format specifies type 'unsigned short' but the argument has type 'u8_t' (aka 'unsigned char') [-Werror,-Wformat]
LWIP_DEBUGF( PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_free: %p has ref %"U16_F", ending here.\n", (void *)p, ref));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
- LWIP_PBUF_REF_T is u8_t by default and doesn't match U16_F, so cast to u16_t. The cast and formatter will need to be changed
if ref is larger than 16 bits
ethernet.c:105:16: error: format specifies type 'unsigned char' but the argument has type 'unsigned int' [-Werror,-Wformat]
(unsigned)ethhdr->dest.addr[0], (unsigned)ethhdr->dest.addr[1], (unsigned)ethhdr->dest.addr[2],
~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- addr[] is type u8_t, formatter is X8_F which should be 8 bits. 'unsigned' is an int, so cast to unsighed char instead
Current newlib does not define O_NDELAY, but it needs to be the same
as O_NONBLOCK rather than using the lwip value of 1.
Signed-off-by: Dirk Ziegelmeier <dirk@ziegelmeier.net>
This makes two cleanups that follows the same organization as close/closesocket:
1) There is no lwip_ioctlsocket. Instead lwip_ioctl should redirect to ioctlsocket
2) With LWIP_POSIX_SOCKETS_IO_NAMES enabled, lwip_ioctl/ioctlsocket should redirect to ioctl
Some systems need to take into account an RX buffer pool size when
advising an appropriate number of RX pbufs to queue on the ooseq
list. For some systems there is a practical hard limit beyond which
the rx pool becomes exhausted blocking reception of further buffers
until some are freed.
It also helps to be able to consider the available dynamic memory when
advising an appropriate maximum number of bytes to buffer on the ooseq
list.
These decisions can also benefit from knowing the number already
allocated on a particular pcb, so the ooseq tcp segement is passed to
these functions. For example, if the system only wants to allow the
total number of rx pbufs queued on all the ooseq lists to grow by one
and a pcb already has two then it can return three for this call, but
might return one for another call - supporting a greedy allocation
strategy.
Signed-off-by: goldsimon <goldsimon@gmx.de>
Hop-by-Hop, Destination option header structures consist of 2 unsigned char; next option type and header length field.
And TLV(Type-Length-Value) option headers come by the number in header length field.
If the option type in TLV option header is not recognized and 2 MSB is not 0, it is handled as an exception.
Signed-off-by: goldsimon <goldsimon@gmx.de>
Hop-by-Hop, Destination option header structures consist of 2 unsigned char; next option type and header length field.
And TLV(Type-Length-Value) option headers come by the number in header length field.
If the option type in TLV option header is not recognized and 2 MSB is not 0, it is handled as an exception.
Signed-off-by: goldsimon <goldsimon@gmx.de>
For this, convert 'u8_t nexth' to a pointer and change 'icmp6_param_problem()' to take a pointer, not an offset number
Signed-off-by: goldsimon <goldsimon@gmx.de>