diff --git a/src/api/sockets.c b/src/api/sockets.c index 73aecf02..d6cee222 100644 --- a/src/api/sockets.c +++ b/src/api/sockets.c @@ -2448,14 +2448,15 @@ lwip_getsockopt_impl(int s, int level, int optname, void *optval, socklen_t *opt /* The option flags */ case SO_BROADCAST: - if (NETCONNTYPE_GROUP(sock->conn->type) != NETCONN_UDP) { - done_socket(sock); - return ENOPROTOOPT; - } case SO_KEEPALIVE: #if SO_REUSE case SO_REUSEADDR: #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); *(int*)optval = ip_get_option(sock->conn->pcb.ip, optname); LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, SOL_SOCKET, optname=0x%x, ..) = %s\n",