Commit d50d3d06 authored by Christophe Massiot's avatar Christophe Massiot

util: fix multicast logic (fixes multilive)

parent cb476ead
Changes between 2.3 and 2.4:
----------------------------
* Fix multilive
Changes between 2.2 and 2.3: Changes between 2.2 and 2.3:
---------------------------- ----------------------------
* New VRRP-like implementation multilive * New VRRP-like implementation multilive
......
...@@ -905,34 +905,39 @@ normal_bind: ...@@ -905,34 +905,39 @@ normal_bind:
if ( !*pb_tcp ) if ( !*pb_tcp )
{ {
if ( i_ttl ) if ( i_family == AF_INET
&& IN_MULTICAST(ntohl(connect_addr.sin.sin_addr.s_addr)) )
{ {
if ( i_family == AF_INET if ( p_opt != NULL && p_opt->pb_multicast != NULL )
&& IN_MULTICAST(ntohl(connect_addr.sin.sin_addr.s_addr)) ) *p_opt->pb_multicast = true;
if ( i_ttl &&
setsockopt( i_fd, IPPROTO_IP, IP_MULTICAST_TTL,
(void *)&i_ttl, sizeof(i_ttl) ) == -1 )
{ {
if ( setsockopt( i_fd, IPPROTO_IP, IP_MULTICAST_TTL, msg_Err( NULL, "couldn't set TTL (%s)",
(void *)&i_ttl, sizeof(i_ttl) ) == -1 ) strerror(errno) );
{ PrintSocket( "socket definition:", &bind_addr,
msg_Err( NULL, "couldn't set TTL (%s)", &connect_addr );
strerror(errno) ); exit(EXIT_FAILURE);
PrintSocket( "socket definition:", &bind_addr,
&connect_addr );
exit(EXIT_FAILURE);
}
} }
}
if ( i_family == AF_INET6 if ( i_family == AF_INET6
&& IN6_IS_ADDR_MULTICAST(&connect_addr.sin6.sin6_addr) ) && IN6_IS_ADDR_MULTICAST(&connect_addr.sin6.sin6_addr) )
{
if ( p_opt != NULL && p_opt->pb_multicast != NULL )
*p_opt->pb_multicast = true;
if ( i_ttl &&
setsockopt( i_fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
(void *)&i_ttl, sizeof(i_ttl) ) == -1 )
{ {
if ( setsockopt( i_fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, msg_Err( NULL, "couldn't set TTL (%s)",
(void *)&i_ttl, sizeof(i_ttl) ) == -1 ) strerror(errno) );
{ PrintSocket( "socket definition:", &bind_addr,
msg_Err( NULL, "couldn't set TTL (%s)", &connect_addr );
strerror(errno) ); exit(EXIT_FAILURE);
PrintSocket( "socket definition:", &bind_addr,
&connect_addr );
exit(EXIT_FAILURE);
}
} }
} }
......
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