mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-26 05:56:14 +01: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:
parent
49db979922
commit
c2acbc0182
@ -1952,6 +1952,7 @@ g_socket_multicast_group_operation (GSocket *socket,
|
||||
struct ip_mreq mc_req;
|
||||
#endif
|
||||
|
||||
memset (&mc_req, 0, sizeof (mc_req));
|
||||
memcpy (&mc_req.imr_multiaddr, native_addr, sizeof (struct in_addr));
|
||||
|
||||
#ifdef HAVE_IP_MREQN
|
||||
@ -1985,6 +1986,7 @@ g_socket_multicast_group_operation (GSocket *socket,
|
||||
{
|
||||
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));
|
||||
#ifdef HAVE_IF_NAMETOINDEX
|
||||
if (iface)
|
||||
|
Loading…
Reference in New Issue
Block a user