mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-29 12:14:28 +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:
|
++ 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
|
2014-12-19: Simon Goldschmidt
|
||||||
* opt.h, dhcp.h/.c: prevent dhcp from starting when netif link is down (only
|
* 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
|
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
|
#if LWIP_DNS
|
||||||
LWIP_MEMPOOL(DNS_API_MSG, MEMP_NUM_DNS_API_MSG, sizeof(struct dns_api_msg), "DNS_API_MSG")
|
LWIP_MEMPOOL(DNS_API_MSG, MEMP_NUM_DNS_API_MSG, sizeof(struct dns_api_msg), "DNS_API_MSG")
|
||||||
#endif
|
#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")
|
LWIP_MEMPOOL(SOCKET_SETGETSOCKOPT_DATA, MEMP_NUM_SOCKET_SETGETSOCKOPT_DATA, sizeof(struct lwip_setgetsockopt_data), "SOCKET_SETGETSOCKOPT_DATA")
|
||||||
#endif
|
#endif
|
||||||
#if LWIP_NETIF_API
|
#if LWIP_NETIF_API
|
||||||
|
@ -108,31 +108,34 @@ typedef u32_t socklen_t;
|
|||||||
|
|
||||||
struct lwip_sock;
|
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
|
/** This struct is used to pass data to the set/getsockopt_internal
|
||||||
* functions running in tcpip_thread context (only a void* is allowed) */
|
* functions running in tcpip_thread context (only a void* is allowed) */
|
||||||
struct lwip_setgetsockopt_data {
|
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 */
|
/** socket index for which to change options */
|
||||||
int s;
|
int s;
|
||||||
#endif /* LWIP_DEBUG */
|
|
||||||
/** level of the option to process */
|
/** level of the option to process */
|
||||||
int level;
|
int level;
|
||||||
/** name of the option to process */
|
/** name of the option to process */
|
||||||
int optname;
|
int optname;
|
||||||
/** set: value to set the option to
|
/** set: value to set the option to
|
||||||
* get: value of the option is stored here */
|
* 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 */
|
/** size of *optval */
|
||||||
socklen_t *optlen;
|
socklen_t optlen;
|
||||||
/** if an error occurs, it is temporarily stored here */
|
/** if an error occurs, it is temporarily stored here */
|
||||||
err_t err;
|
err_t err;
|
||||||
#if !LWIP_TCPIP_CORE_LOCKING
|
|
||||||
/** semaphore to wake up the calling task */
|
/** semaphore to wake up the calling task */
|
||||||
void* completed_sem;
|
void* completed_sem;
|
||||||
#endif /* !LWIP_TCPIP_CORE_LOCKING */
|
|
||||||
};
|
};
|
||||||
|
#endif /* !LWIP_TCPIP_CORE_LOCKING */
|
||||||
|
|
||||||
/* Socket protocol types (TCP/UDP/RAW) */
|
/* Socket protocol types (TCP/UDP/RAW) */
|
||||||
#define SOCK_STREAM 1
|
#define SOCK_STREAM 1
|
||||||
|
Loading…
Reference in New Issue
Block a user