mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-12 12:14:06 +02:00
gsocket: fix joining/leaving multicast groups
Initialize the structure passed to setsockopt to 0 to avoid random errors when joining or leaving a multicast group. https://bugzilla.gnome.org/show_bug.cgi?id=688378
This commit is contained in:
@@ -1952,6 +1952,7 @@ g_socket_multicast_group_operation (GSocket *socket,
|
|||||||
struct ip_mreq mc_req;
|
struct ip_mreq mc_req;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
memset (&mc_req, 0, sizeof (mc_req));
|
||||||
memcpy (&mc_req.imr_multiaddr, native_addr, sizeof (struct in_addr));
|
memcpy (&mc_req.imr_multiaddr, native_addr, sizeof (struct in_addr));
|
||||||
|
|
||||||
#ifdef HAVE_IP_MREQN
|
#ifdef HAVE_IP_MREQN
|
||||||
@@ -1985,6 +1986,7 @@ g_socket_multicast_group_operation (GSocket *socket,
|
|||||||
{
|
{
|
||||||
struct ipv6_mreq mc_req_ipv6;
|
struct ipv6_mreq mc_req_ipv6;
|
||||||
|
|
||||||
|
memset (&mc_req_ipv6, 0, sizeof (mc_req_ipv6));
|
||||||
memcpy (&mc_req_ipv6.ipv6mr_multiaddr, native_addr, sizeof (struct in6_addr));
|
memcpy (&mc_req_ipv6.ipv6mr_multiaddr, native_addr, sizeof (struct in6_addr));
|
||||||
#ifdef HAVE_IF_NAMETOINDEX
|
#ifdef HAVE_IF_NAMETOINDEX
|
||||||
if (iface)
|
if (iface)
|
||||||
|
Reference in New Issue
Block a user