Patch for vls-0.5.6 multicast interface specification
John Wehle <[email protected]> Wed, 9 Jun 2004 00:04:25 -0400 (EDT)
| Newsgroups | gmane.comp.video.videolan.vls.devel |
|---|---|
| Message-ID | <[email protected]> |
C_NetOutput currently doesn't select which interface to use for
multicast. This can result in the packets going out the wrong
interface if the host has multiple multicast capable network
adapters. This patch uses the IP_MULTICAST_IF to select the
correct interface. It's been tested on FreeBSD 4.10 x86.
-- John Wehle
------------------8<------------------------8<------------------------
*** src/modules/netchannel/netoutput.cpp.ORIGINAL Fri May 16 15:43:59 2003
--- src/modules/netchannel/netoutput.cpp Sun Jun 6 01:20:24 2004
***************
*** 47,52 ****
--- 47,54 ----
#include <net/if.h>
#endif
+ #include <sys/ioctl.h>
+
#include "netoutput.h"
*************** void C_NetOutput::OnInit()
*** 132,137 ****
--- 134,155 ----
if(iOptVal <= 524288/16)
throw E_Output("Unable to allocate output buffer", e);
}
+ }
+
+ if (m_strType == "multicast" && (m_strInterface != ""))
+ {
+ struct ifreq sInterface;
+ struct sockaddr_in sin;
+ int vs = socket(AF_INET, SOCK_DGRAM, 0);
+ strncpy(sInterface.ifr_name, m_strInterface.GetString(), IFNAMSIZ);
+ if (ioctl(vs, SIOCGIFADDR, &sInterface) < 0) perror("SIOCGIFADDR");
+ else
+ {
+ sin = *(struct sockaddr_in *)&sInterface.ifr_addr;
+ m_cSocket.SetOption(IPPROTO_IP, IP_MULTICAST_IF,
+ (char *)&sin.sin_addr, sizeof (sin.sin_addr));
+ }
+ close(vs);
}
#ifdef HAVE_IPV6
-------------------------------------------------------------------------
| Feith Systems | Voice: 1-215-646-8000 | Email: [email protected] |
| John Wehle | Fax: 1-215-540-5495 | |
-------------------------------------------------------------------------
--
This is the vls-devel mailing-list, see http://www.videolan.org/streaming/
To unsubscribe, please read http://developers.videolan.org/lists.html
If you are in trouble, please contact <[email protected]>