iptv: allow non-multicast IPTV (useful for testing)

I don't actually check for valid MC group address, I simply try and add group
and just warn if it fails (but carry on anyway).
This commit is contained in:
Adam Sutton 2013-12-23 23:56:10 +00:00
parent 4226ea5e31
commit a0f2bebcc5

View file

@ -101,30 +101,29 @@ iptv_udp_start ( iptv_mux_t *im, const url_t *url )
goto error;
}
/* Join group */
m.imr_multiaddr = sin.sin_addr;
m.imr_address.s_addr = 0;
#if defined(PLATFORM_LINUX)
m.imr_ifindex = ifr.ifr_ifindex;
#elif defined(PLATFORM_FREEBSD)
m.imr_ifindex = ifr.ifr_index;
#endif
#ifdef SOL_IP
solip = SOL_IP;
#else
{
struct protoent *pent;
pent = getprotobyname("ip");
solip = (pent != NULL) ? pent->p_proto : 0;
}
#endif
/* Join group */
m.imr_multiaddr = sin.sin_addr;
m.imr_address.s_addr = 0;
#if defined(PLATFORM_LINUX)
m.imr_ifindex = ifr.ifr_ifindex;
#elif defined(PLATFORM_FREEBSD)
m.imr_ifindex = ifr.ifr_index;
#endif
#ifdef SOL_IP
solip = SOL_IP;
#else
{
struct protoent *pent;
pent = getprotobyname("ip");
solip = (pent != NULL) ? pent->p_proto : 0;
}
#endif
if (setsockopt(fd, solip, IP_ADD_MEMBERSHIP, &m, sizeof(m))) {
inet_ntop(AF_INET, &m.imr_multiaddr, buf, sizeof(buf));
tvherror("iptv", "%s - cannot join %s [%s]",
name, buf, strerror(errno));
goto error;
}
if (setsockopt(fd, solip, IP_ADD_MEMBERSHIP, &m, sizeof(m))) {
inet_ntop(AF_INET, &m.imr_multiaddr, buf, sizeof(buf));
tvhwarn("iptv", "%s - cannot join %s [%s]",
name, buf, strerror(errno));
}
/* Bind to IPv6 group */
} else {
@ -154,9 +153,8 @@ iptv_udp_start ( iptv_mux_t *im, const url_t *url )
#ifdef SOL_IPV6
if (setsockopt(fd, SOL_IPV6, IPV6_ADD_MEMBERSHIP, &m, sizeof(m))) {
inet_ntop(AF_INET, &m.ipv6mr_multiaddr, buf, sizeof(buf));
tvherror("iptv", "%s - cannot join %s [%s]",
name, buf, strerror(errno));
goto error;
tvhwarn("iptv", "%s - cannot join %s [%s]",
name, buf, strerror(errno));
}
#else
tvherror("iptv", "IPv6 multicast not supported");