opt_debug = 0,
opt_syslog = 0,
opt_uidebug = 0,
- opt_abort = 0;
+ opt_abort = 0,
+ opt_ipv6 = 0;
const char *opt_config = NULL,
*opt_user = NULL,
*opt_group = NULL,
{ 'a', "adapters", "Use only specified DVB adapters",
OPT_STR, &opt_dvb_adapters },
#endif
-
{ 0, NULL, "Server Connectivity", OPT_BOOL, NULL },
+ { '6', "ipv6", "Listen on IPv6", OPT_BOOL, &opt_ipv6 },
{ 0, "http_port", "Specify alternative http port",
OPT_INT, &tvheadend_webui_port },
{ 0, "http_root", "Specify alternative http webroot",
timeshift_init();
#endif
- tcp_server_init();
+ tcp_server_init(opt_ipv6);
http_server_init();
webui_init();
#include "tcp.h"
#include "tvheadend.h"
+int tcp_preferred_address_family = AF_INET;
/**
*
ressave = res;
while(res)
{
- if(res->ai_family == AF_INET6)
+ if(res->ai_family == tcp_preferred_address_family)
{
use = res;
break;
*
*/
void
-tcp_server_init(void)
+tcp_server_init(int opt_ipv6)
{
pthread_t tid;
+ if(opt_ipv6)
+ tcp_preferred_address_family = AF_INET6;
+
tcp_server_epoll_fd = epoll_create(10);
pthread_create(&tid, NULL, tcp_server_loop, NULL);
}
#include "htsbuf.h"
-void tcp_server_init(void);
+extern int tcp_preferred_address_family;
+
+void tcp_server_init(int opt_ipv6);
int tcp_connect(const char *hostname, int port, char *errbuf,
size_t errbufsize, int timeout);