mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-08-26 08:02:51 +00:00
Improve getsockopt for IP_MULTICAST_LOOP
Changes getsockopt handling for IP_MULTICAST_LOOP to test for UDP and use macro. Also fixes debug message.
This commit is contained in:
parent
545a57ce60
commit
64cd2582ca
@ -3092,14 +3092,10 @@ lwip_getsockopt_impl(int s, int level, int optname, void *optval, socklen_t *opt
|
|||||||
s, *(u32_t *)optval));
|
s, *(u32_t *)optval));
|
||||||
break;
|
break;
|
||||||
case IP_MULTICAST_LOOP:
|
case IP_MULTICAST_LOOP:
|
||||||
LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB(sock, *optlen, u8_t);
|
LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB_TYPE(sock, *optlen, u8_t, NETCONN_UDP);
|
||||||
if ((sock->conn->pcb.udp->flags & UDP_FLAGS_MULTICAST_LOOP) != 0) {
|
*(u8_t *)optval = udp_is_flag_set(sock->conn->pcb.udp, UDP_FLAGS_MULTICAST_LOOP) ? 1 : 0;
|
||||||
*(u8_t *)optval = 1;
|
|
||||||
} else {
|
|
||||||
*(u8_t *)optval = 0;
|
|
||||||
}
|
|
||||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_IP, IP_MULTICAST_LOOP) = %d\n",
|
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_IP, IP_MULTICAST_LOOP) = %d\n",
|
||||||
s, *(int *)optval));
|
s, *(u8_t *)optval));
|
||||||
break;
|
break;
|
||||||
#endif /* LWIP_IPV4 && LWIP_MULTICAST_TX_OPTIONS && LWIP_UDP */
|
#endif /* LWIP_IPV4 && LWIP_MULTICAST_TX_OPTIONS && LWIP_UDP */
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user