[multicat-devel] [Git][videolan/multicat][master] util: fix multicast logic (fixes multilive)

Christophe Massiot gitlab at videolan.org
Tue Nov 20 14:53:44 CET 2018


Christophe Massiot pushed to branch master at VideoLAN / multicat


Commits:
d50d3d06 by Christophe Massiot at 2018-11-20T13:53:15Z
util: fix multicast logic (fixes multilive)

- - - - -


2 changed files:

- NEWS
- util.c


Changes:

=====================================
NEWS
=====================================
@@ -1,3 +1,7 @@
+Changes between 2.3 and 2.4:
+----------------------------
+  * Fix multilive
+
 Changes between 2.2 and 2.3:
 ----------------------------
   * New VRRP-like implementation multilive


=====================================
util.c
=====================================
@@ -905,34 +905,39 @@ normal_bind:
 
         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
-                      && IN_MULTICAST(ntohl(connect_addr.sin.sin_addr.s_addr)) )
+                if ( p_opt != NULL && p_opt->pb_multicast != NULL )
+                    *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,
-                                     (void *)&i_ttl, sizeof(i_ttl) ) == -1 )
-                    {
-                        msg_Err( NULL, "couldn't set TTL (%s)",
-                                 strerror(errno) );
-                        PrintSocket( "socket definition:", &bind_addr,
-                                     &connect_addr );
-                        exit(EXIT_FAILURE);
-                    }
+                    msg_Err( NULL, "couldn't set TTL (%s)",
+                             strerror(errno) );
+                    PrintSocket( "socket definition:", &bind_addr,
+                                 &connect_addr );
+                    exit(EXIT_FAILURE);
                 }
+            }
 
-                if ( i_family == AF_INET6
-                      && IN6_IS_ADDR_MULTICAST(&connect_addr.sin6.sin6_addr) )
+            if ( i_family == AF_INET6
+                  && 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,
-                                     (void *)&i_ttl, sizeof(i_ttl) ) == -1 )
-                    {
-                        msg_Err( NULL, "couldn't set TTL (%s)",
-                                 strerror(errno) );
-                        PrintSocket( "socket definition:", &bind_addr,
-                                     &connect_addr );
-                        exit(EXIT_FAILURE);
-                    }
+                    msg_Err( NULL, "couldn't set TTL (%s)",
+                             strerror(errno) );
+                    PrintSocket( "socket definition:", &bind_addr,
+                                 &connect_addr );
+                    exit(EXIT_FAILURE);
                 }
             }
 



View it on GitLab: https://code.videolan.org/videolan/multicat/commit/d50d3d064eeb6f8667034c6ab2dec0f2a73d1c2d

-- 
View it on GitLab: https://code.videolan.org/videolan/multicat/commit/d50d3d064eeb6f8667034c6ab2dec0f2a73d1c2d
You're receiving this email because of your account on code.videolan.org.


More information about the multicat-devel mailing list