mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-05 22:29:49 +00:00
Implement IPV6_MULTICAST_IF socket option
Implements the IPV6_MULTICAST_IF socket option, which specifies the interface for outgoing multicast packets. Based on work from https://savannah.nongnu.org/patch/?9554 Co-authored-by: Christina Schoenrogge <christina.schoenrogge@garmin.com> Co-authored-by: Chee Bin Hoh <hohcheebin@gmail.com> Co-authored-by: hanhui <hanhui03@163.com>
This commit is contained in:
parent
64b758d00c
commit
d96a90a5ec
@ -3181,6 +3181,14 @@ lwip_getsockopt_impl(int s, int level, int optname, void *optval, socklen_t *opt
|
|||||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_IPV6, IPV6_V6ONLY) = %d\n",
|
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_IPV6, IPV6_V6ONLY) = %d\n",
|
||||||
s, *(int *)optval));
|
s, *(int *)optval));
|
||||||
break;
|
break;
|
||||||
|
#if LWIP_MULTICAST_TX_OPTIONS && LWIP_UDP
|
||||||
|
case IPV6_MULTICAST_IF:
|
||||||
|
LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB_TYPE(sock, *optlen, int, NETCONN_UDP);
|
||||||
|
*(int *)optval = udp_get_multicast_netif_index(sock->conn->pcb.udp);
|
||||||
|
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_IPV6, IPV6_MULTICAST_IF) = %d\n",
|
||||||
|
s, *(int *)optval));
|
||||||
|
break;
|
||||||
|
#endif /* LWIP_MULTICAST_TX_OPTIONS && LWIP_UDP */
|
||||||
default:
|
default:
|
||||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_IPV6, UNIMPL: optname=0x%x, ..)\n",
|
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getsockopt(%d, IPPROTO_IPV6, UNIMPL: optname=0x%x, ..)\n",
|
||||||
s, optname));
|
s, optname));
|
||||||
@ -3668,6 +3676,14 @@ lwip_setsockopt_impl(int s, int level, int optname, const void *optval, socklen_
|
|||||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_IPV6, IPV6_V6ONLY, ..) -> %d\n",
|
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_IPV6, IPV6_V6ONLY, ..) -> %d\n",
|
||||||
s, (netconn_get_ipv6only(sock->conn) ? 1 : 0)));
|
s, (netconn_get_ipv6only(sock->conn) ? 1 : 0)));
|
||||||
break;
|
break;
|
||||||
|
#if LWIP_MULTICAST_TX_OPTIONS && LWIP_UDP
|
||||||
|
case IPV6_MULTICAST_IF:
|
||||||
|
LWIP_SOCKOPT_CHECK_OPTLEN_CONN_PCB_TYPE(sock, optlen, int, NETCONN_UDP);
|
||||||
|
udp_set_multicast_netif_index(sock->conn->pcb.udp, (u8_t)(*(int *)optval));
|
||||||
|
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_setsockopt(%d, IPPROTO_IPV6, IPV6_MULTICAST_IF, ..) -> %d\n",
|
||||||
|
s, *(int *)optval));
|
||||||
|
break;
|
||||||
|
#endif /* LWIP_MULTICAST_TX_OPTIONS && LWIP_UDP */
|
||||||
#if LWIP_IPV6_MLD
|
#if LWIP_IPV6_MLD
|
||||||
case IPV6_JOIN_GROUP:
|
case IPV6_JOIN_GROUP:
|
||||||
case IPV6_LEAVE_GROUP: {
|
case IPV6_LEAVE_GROUP: {
|
||||||
|
@ -317,6 +317,8 @@ struct linger {
|
|||||||
#define IP_MULTICAST_TTL 5
|
#define IP_MULTICAST_TTL 5
|
||||||
#define IP_MULTICAST_IF 6
|
#define IP_MULTICAST_IF 6
|
||||||
#define IP_MULTICAST_LOOP 7
|
#define IP_MULTICAST_LOOP 7
|
||||||
|
|
||||||
|
#define IPV6_MULTICAST_IF 17 /* RFC3493: interface for outgoing multicast packets */
|
||||||
#endif /* LWIP_MULTICAST_TX_OPTIONS */
|
#endif /* LWIP_MULTICAST_TX_OPTIONS */
|
||||||
|
|
||||||
#if LWIP_IGMP
|
#if LWIP_IGMP
|
||||||
|
Loading…
Reference in New Issue
Block a user