mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-07 15:04:39 +08:00
setsockopt: allow SO_BROADCAST for UDP sockets only
This commit is contained in:
parent
8345e9035f
commit
0bbf6490f5
@ -2852,6 +2852,11 @@ lwip_setsockopt_impl(int s, int level, int optname, const void *optval, socklen_
|
|||||||
#if SO_REUSE
|
#if SO_REUSE
|
||||||
case SO_REUSEADDR:
|
case SO_REUSEADDR:
|
||||||
#endif /* SO_REUSE */
|
#endif /* SO_REUSE */
|
||||||
|
if ((optname == SO_BROADCAST) &&
|
||||||
|
(NETCONNTYPE_GROUP(sock->conn->type) != NETCONN_UDP)) {
|
||||||
|
done_socket(sock);
|
||||||
|
return ENOPROTOOPT;
|
||||||
|
}
|
||||||
LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB(sock, optlen, int);
|
LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB(sock, optlen, int);
|
||||||
if (*(const int*)optval) {
|
if (*(const int*)optval) {
|
||||||
ip_set_option(sock->conn->pcb.ip, optname);
|
ip_set_option(sock->conn->pcb.ip, optname);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user