From 6f03dd8aa37c3cd7067d704c82665abf44f232db Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Sun, 25 May 2014 00:54:41 +0200 Subject: [PATCH 1/4] webui: load mpegts.js even if linuxdvb is disabled DVB input tabs are also needed for IPTV service. Also this fixes webui which doesn't load properly when --disable-linuxdvb is used. --- src/webui/extjs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webui/extjs.c b/src/webui/extjs.c index d83e5039..3a3af8d3 100755 --- a/src/webui/extjs.c +++ b/src/webui/extjs.c @@ -150,7 +150,7 @@ extjs_root(http_connection_t *hc, const char *remain, void *opaque) extjs_load(hq, "static/app/tvadapters.js"); extjs_load(hq, "static/app/idnode.js"); extjs_load(hq, "static/app/esfilter.js"); -#if ENABLE_LINUXDVB +#if ENABLE_MPEGTS extjs_load(hq, "static/app/mpegts.js"); #endif extjs_load(hq, "static/app/iptv.js"); From 17f2d7c222cb2fe7b1268878950c73365e303468 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Sun, 25 May 2014 22:39:03 +0200 Subject: [PATCH 2/4] udp: use if_nametoindex instead of SIOCGIFINDEX ioctl if_nametoindex is more portable and shorter --- src/udp.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/udp.c b/src/udp.c index 6e11752e..1c75d3c7 100644 --- a/src/udp.c +++ b/src/udp.c @@ -95,21 +95,16 @@ udp_resolve( udp_connection_t *uc, int receiver ) } static int -udp_get_ifindex( int fd, const char *ifname ) +udp_get_ifindex( const char *ifname ) { - struct ifreq ifr; + unsigned int r; if (ifname == NULL || *ifname == '\0') return 0; - memset(&ifr, 0, sizeof(ifr)); - strncpy(ifr.ifr_name, ifname, IFNAMSIZ); - ifr.ifr_name[IFNAMSIZ - 1] = '\0'; - if (ioctl(fd, SIOCGIFINDEX, &ifr)) + + r = if_nametoindex(ifname); + if (!r) return -1; -#if defined(PLATFORM_LINUX) - return ifr.ifr_ifindex; -#elif defined(PLATFORM_FREEBSD) - return ifr.ifr_index; -#endif + return r; } static int @@ -160,7 +155,7 @@ udp_bind ( const char *subsystem, const char *name, setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse)); /* Bind to interface */ - ifindex = uc->multicast ? udp_get_ifindex(fd, ifname) : 0; + ifindex = uc->multicast ? udp_get_ifindex(ifname) : 0; if (ifindex < 0) { tvherror(subsystem, "%s - could not find interface %s", name, ifname); @@ -308,7 +303,7 @@ udp_connect ( const char *subsystem, const char *name, } /* Bind to interface */ - ifindex = uc->multicast ? udp_get_ifindex(fd, ifname) : 0; + ifindex = uc->multicast ? udp_get_ifindex(ifname) : 0; if (ifindex < 0) { tvherror(subsystem, "%s - could not find interface %s", name, ifname); From 63b3b13a7273d71e86c42347e41b7e850d7637ab Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Sun, 25 May 2014 22:41:21 +0200 Subject: [PATCH 3/4] udp: some compilers doesn't like return = syntax --- src/udp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/udp.c b/src/udp.c index 1c75d3c7..f4dcbfb4 100644 --- a/src/udp.c +++ b/src/udp.c @@ -115,7 +115,7 @@ udp_get_solip( void ) #else struct protoent *pent; pent = getprotobyname("ip"); - return = (pent != NULL) ? pent->p_proto : 0; + return (pent != NULL) ? pent->p_proto : 0; #endif } From 09f716e1ad37bf2686a8f2e03d058d8cd22718f2 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Mon, 26 May 2014 02:23:33 +0200 Subject: [PATCH 4/4] satip: missing comparison --- src/input/mpegts/satip/satip_frontend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/input/mpegts/satip/satip_frontend.c b/src/input/mpegts/satip/satip_frontend.c index 5846232c..a9681225 100644 --- a/src/input/mpegts/satip/satip_frontend.c +++ b/src/input/mpegts/satip/satip_frontend.c @@ -1332,7 +1332,7 @@ satip_frontend_create override = htsmsg_get_str(conf, id); if (override) { i = dvb_str2type(override); - if ((i == DVB_TYPE_T || i == DVB_TYPE_C || DVB_TYPE_S) && i != type) + if ((i == DVB_TYPE_T || i == DVB_TYPE_C || i == DVB_TYPE_S) && i != type) type = i; else override = NULL;