PATCH to make IP Multicast work

Mathias Kretschmer mathias at research.att.com
Mon Aug 27 17:37:39 CEST 2001


Hi guys,

Since I'm new to this list I don't know if people already discussed
that issue.

I've attached two patches to actually make IP Multicast work when 
'broadcast mode' is selected:

 - 'vlc' now issues an IP_ADD_MEMBERSHIP
   The code should do the right thing for win32 *and* unix systems

 - Added a warning if systems like linux silently set the 
   socket receive buffer size to a smaller limit then the one that was
requested.

 - Added a line to ignore random EAGAIN errors returned by readv()
   They shouldn't occur but seem to do so on some networks, nevertheless.


I'd be happy if those patches would make it into the vlc source tree.


Cheers,

Mathias

-- Attached file included as plaintext by Listar --
-- File: input.c.diff

diff /home/mathias/vlc-0.2.83/src/input/input.c ./input.c
639a640
>     int                 i_opt_size;
640a642,643
>     unsigned int        mc_group;
> 
790a794,812
>     /* check if we really got what we have asked for, because */
>     /* linux, etc. will silently limit the max buffer size to */
>     /* net.core.rmem_max which is typically only 65535 bytes  */
>     i_opt = 0;
>     i_opt_size = sizeof( i_opt);
>     if( getsockopt( p_input->i_handle, SOL_SOCKET, SO_RCVBUF,
>                     (void*) &i_opt, &i_opt_size ) == -1 )
>     {
>       intf_ErrMsg( "input error: can't configure socket (SO_RCVBUF: %s)", 
>                      strerror(errno));
>         close( p_input->i_handle );
>         p_input->b_error = 1;
>         return;
>     }
>     
>     if( i_opt < 0x80000){
>       intf_ErrMsg( "input warning: socket receive buffer size just %d instead of %d bytes.\n", i_opt, 0x80000);
>     }
> 
799a822,824
>     /* required for IP_ADD_MEMBERSHIP */
>     mc_group = sock.sin_addr.s_addr;
> 
804a830
> #define IN_MULTICAST(a)         IN_CLASSD(a)
814a841,853
>     }
> 
>     /* join the m/c group if sock is a multicast address */
>     if( IN_MULTICAST( ntohl(mc_group))){
>       struct ip_mreq imr;
>       imr.imr_interface.s_addr = htonl(INADDR_ANY);
>       imr.imr_multiaddr.s_addr = mc_group;
>       if( setsockopt( p_input->i_handle, IPPROTO_IP,IP_ADD_MEMBERSHIP, (char*)&imr, sizeof(struct ip_mreq)) == -1){
>         intf_ErrMsg( "input error: failed to join IP multicast group (%s)", strerror(errno) );
>         close( p_input->i_handle);
>         p_input->b_error = 1;
>         return;
>       }
Only in .: input.c.diff
Only in .: input.o
Only in .: input_clock.o
Only in .: input_dec.o
Only in .: input_ext-dec.o
Only in .: input_ext-intf.o
Only in .: input_netlist.o
Only in .: input_programs.o
Only in .: mpeg_system.o


-- Attached file included as plaintext by Listar --
-- File: input_ts.c.diff

333a334,339
> 	/* shouldn't happen, but it does - at least under linux */
>         if( (i_read == -1) && ( (errno == EAGAIN) || (errno = EWOULDBLOCK)))
> 	{
> 	  /* just ignore that error */
> 	  i_read = 0;
>         }
337,338c343,344
<             intf_ErrMsg( "input error: TS readv error" );
<             return( -1 );
---
> 	  intf_ErrMsg( "input error: TS readv error" );
> 	  return( -1 );
340c346
< 
---
> 	





More information about the vlc-devel mailing list