Commit 5202876a authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

IP_MULTICAST_TTL: fallback to char on weird/old OSes

parent 9588bb79
......@@ -136,9 +136,12 @@ Broadcast::Broadcast(int i_ttl, const char *psz_iface) : fd4 (-1), fd6 (-1),
}
}
if (i_ttl != 0)
setsockopt (fd4, IPPROTO_IP, IP_MULTICAST_TTL,
&i_ttl, sizeof(i_ttl));
if (i_ttl && setsockopt (fd4, IPPROTO_IP, IP_MULTICAST_TTL,
&i_ttl, sizeof(i_ttl)))
{
unsigned char ttl = i_ttl; /* Solaris wants a char */
setsockopt (fd4, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, 1);
}
if (bind (fd4, (struct sockaddr *)&addr, sizeof (addr)) == 0)
shutdown (fd4, SHUT_RD);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment