[vlc-devel] Incorrect connect() call after SSM join
Alexander Gall
gall at switch.ch
Wed Mar 1 11:06:39 CET 2006
There is a flaw in modules/misc/network/ipv{4,6}.c:OpenUDP() when an
SSM channel is joined. The logic is roughly this pseudocode
(bind_addr and server_addr are passed from the caller)
s = socket(SOCK_DGRAM)
if (!bind_addr) {
bind_addr = addr_any
}
bind(s, bind_addr)
if (is_multicast_addr(bind_addr)) {
if (server_addr) {
join_ssm(s, bind_addr, server_addr)
} else {
join_asm(s, bind_addr)
}
}
if (server_addr) {
connect(s, server_addr)
set_ttl()
set_mcast_output_interface()
}
The last block should only be executed when receiving/sending a
unicast stream from/to server_addr or when sending to a multicast
group, but not when joining an SSM channel. On Solaris, the connect()
call returns EADDRNOTAVAIL (can't assign requested address) in this
case, which breaks SSM completely on this platform. On Linux, the
call doesn't seem to have an effect and doesn't return an error. I
think the proper thing to do is to skip this part for SSM. That's
what my patch does.
--
Alex
diff -Naur vlc-0.8.5-20060226.orig/modules/misc/network/ipv4.c vlc-0.8.5-20060226/modules/misc/network/ipv4.c
--- vlc-0.8.5-20060226.orig/modules/misc/network/ipv4.c 2006-02-26 00:00:26.000000000 +0100
+++ vlc-0.8.5-20060226/modules/misc/network/ipv4.c 2006-02-28 11:41:42.539457000 +0100
@@ -410,7 +410,7 @@
return 0;
}
}
- }
+ } else
#endif
if( *psz_server_addr )
diff -Naur vlc-0.8.5-20060226.orig/modules/misc/network/ipv6.c vlc-0.8.5-20060226/modules/misc/network/ipv6.c
--- vlc-0.8.5-20060226.orig/modules/misc/network/ipv6.c 2006-02-26 00:00:26.000000000 +0100
+++ vlc-0.8.5-20060226/modules/misc/network/ipv6.c 2006-02-28 11:33:54.590910000 +0100
@@ -302,9 +302,7 @@
msg_Err( p_this, "cannot join multicast group" );
}
}
- }
-
- if( *psz_server_addr )
+ } else if( *psz_server_addr )
{
int ttl;
--
This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://developers.videolan.org/lists.html
More information about the vlc-devel
mailing list