mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-11-04 14:29:39 +00:00
fixed bug #40788 "lwip_setsockopt_internal() crashes" by rewriting set/getsockopt functions to combine checks with the actual code and add more NULL checks; this also fixes that CORE_LOCKING used message passing for set/getsockopt.
This commit is contained in:
parent
1cbd2121e2
commit
5d2e93e5f0
@ -147,6 +147,12 @@ HISTORY
|
||||
|
||||
++ Bugfixes:
|
||||
|
||||
2015-01-17: Simon Goldschmidt
|
||||
* sockets.c/.h, memp_std.h: fixed bug #40788 "lwip_setsockopt_internal() crashes"
|
||||
by rewriting set/getsockopt functions to combine checks with the actual code
|
||||
and add more NULL checks; this also fixes that CORE_LOCKING used message
|
||||
passing for set/getsockopt.
|
||||
|
||||
2014-12-19: Simon Goldschmidt
|
||||
* opt.h, dhcp.h/.c: prevent dhcp from starting when netif link is down (only
|
||||
when LWIP_DHCP_CHECK_LINK_UP==1, which is disabled by default for
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -63,7 +63,7 @@ LWIP_MEMPOOL(API_MSG, MEMP_NUM_API_MSG, sizeof(struct api_msg),
|
||||
#if LWIP_DNS
|
||||
LWIP_MEMPOOL(DNS_API_MSG, MEMP_NUM_DNS_API_MSG, sizeof(struct dns_api_msg), "DNS_API_MSG")
|
||||
#endif
|
||||
#if LWIP_SOCKET
|
||||
#if LWIP_SOCKET && !LWIP_TCPIP_CORE_LOCKING
|
||||
LWIP_MEMPOOL(SOCKET_SETGETSOCKOPT_DATA, MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA, sizeof(struct lwip_setgetsockopt_data), "SOCKET_SETGETSOCKOPT_DATA")
|
||||
#endif
|
||||
#if LWIP_NETIF_API
|
||||
|
@ -108,31 +108,34 @@ typedef u32_t socklen_t;
|
||||
|
||||
struct lwip_sock;
|
||||
|
||||
#if !LWIP_TCPIP_CORE_LOCKING
|
||||
/** Maximum optlen used by setsockopt/getsockopt */
|
||||
#define LWIP_SETGETSOCKOPT_MAXOPTLEN 16
|
||||
|
||||
/** This struct is used to pass data to the set/getsockopt_internal
|
||||
* functions running in tcpip_thread context (only a void* is allowed) */
|
||||
struct lwip_setgetsockopt_data {
|
||||
/** socket struct for which to change options */
|
||||
struct lwip_sock *sock;
|
||||
#ifdef LWIP_DEBUG
|
||||
/** socket index for which to change options */
|
||||
int s;
|
||||
#endif /* LWIP_DEBUG */
|
||||
/** level of the option to process */
|
||||
int level;
|
||||
/** name of the option to process */
|
||||
int optname;
|
||||
/** set: value to set the option to
|
||||
* get: value of the option is stored here */
|
||||
void *optval;
|
||||
#if LWIP_MPU_COMPATIBLE
|
||||
u8_t optval[LWIP_SETGETSOCKOPT_MAXOPTLEN];
|
||||
#else
|
||||
void* optval;
|
||||
#endif
|
||||
/** size of *optval */
|
||||
socklen_t *optlen;
|
||||
socklen_t optlen;
|
||||
/** if an error occurs, it is temporarily stored here */
|
||||
err_t err;
|
||||
#if !LWIP_TCPIP_CORE_LOCKING
|
||||
/** semaphore to wake up the calling task */
|
||||
void* completed_sem;
|
||||
#endif /* !LWIP_TCPIP_CORE_LOCKING */
|
||||
};
|
||||
#endif /* !LWIP_TCPIP_CORE_LOCKING */
|
||||
|
||||
/* Socket protocol types (TCP/UDP/RAW) */
|
||||
#define SOCK_STREAM 1
|
||||
|
Loading…
Reference in New Issue
Block a user