Project

General

Profile

IPv6 accessing web interface on port 9981 and htsp 9982

Added by Marc Ominus over 6 years ago

Is there plan to implement support for IPv6 in TVHeadEnd.

I have just tried accessing the web interface on all of the 3 IPv6 addresses my machine has assigned and none works ..
IPv4 works great.

I have 4.2.6-7~g561355130~stretch running on 4.9.0-6-amd64 #1 SMP Debian 4.9.88-1+deb9u1 (2018-05-07) x86_64 GNU/Linux

$ netstat -ltn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:9981 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:9982 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:4200 0.0.0.0:* LISTEN
tcp6 0 0 :::22 :::* LISTEN
tcp6 0 0 ::1:631 :::* LISTEN
tcp6 0 0 ::1:25 :::* LISTEN


Replies (6)

RE: IPv6 accessing web interface on port 9981 and htsp 9982 - Added by Robert Cameron over 6 years ago

Are you starting Tvheadend with IPv6 support? Add the -6 command line option when starting Tvheadend and it ought to start listening on your IPv6 interfaces ...

RE: IPv6 accessing web interface on port 9981 and htsp 9982 - Added by Marc Ominus over 6 years ago

I have installed the TVHeadEnd from bintray.com repo,
so how would I add support for IPv6?

Where would be the best place to add -6?

Here?
sudo cat /etc/init.d/tvheadend

ARGS="-f"
[ -z "$TVH_USER" ] || ARGS="$ARGS -u $TVH_USER"
[ -z "$TVH_GROUP" ] || ARGS="$ARGS -g $TVH_GROUP"
[ -z "$TVH_CONF_DIR" ] || ARGS="$ARGS -c $TVH_CONF_DIR"
[ -z "$TVH_ADAPTERS" ] || ARGS="$ARGS -a $TVH_ADAPTERS"
[ "$TVH_IPV6" = "1" ] && ARGS="$ARGS -6"
[ -z "$TVH_HTTP_PORT" ] || ARGS="$ARGS --http_port $TVH_HTTP_PORT"
[ -z "$TVH_HTTP_ROOT" ] || ARGS="$ARGS --http_root $TVH_HTTP_ROOT"
[ -z "$TVH_HTSP_PORT" ] || ARGS="$ARGS --htsp_port $TVH_HTSP_PORT"
[ -z "$TVH_ARGS" ] || ARGS="$ARGS $TVH_ARGS"
[ "$TVH_DEBUG" = "1" ] && ARGS="$ARGS -s"

RE: IPv6 accessing web interface on port 9981 and htsp 9982 - Added by Robert Cameron over 6 years ago

Where, wherever the environment variables that govern your Tvheadend installation are set, you obviously need to set TVH_IPV6 to 1, as there is a line in that startup script that will enable IPv6 if it's set:

[ "$TVH_IPV6" = "1" ] && ARGS="$ARGS -6" 

That line says "check if ${TVH_IPV6} is set to 1, and if it is, add -6 to the list of arguments passed to Tvheadend at startup." So, wherever you are setting ${TVH_USER}, ${TVH_GROUP}, and all those other settings, in the same place set ${TVH_IPV6} to 1.

RE: IPv6 accessing web interface on port 9981 and htsp 9982 - Added by Marc Ominus over 6 years ago

I am confused with your answer to my question, as I am not really technically minded
see below output of my "/etc/init.d/tvheadend":

sudo cat /etc/init.d/tvheadend #############################################################
#! /bin/sh
  1. BEGIN INIT INFO
  1. Provides: tvheadend
  2. Required-Start: $local_fs $remote_fs udev
  3. Required-Stop: $local_fs $remote_fs
  4. Default-Start: 2 3 4 5
  5. Default-Stop: 0 1 6
    1. END INIT INFO
  1. Author: Andreas Öman
  1. Do NOT "set -e"
  1. PATH should only include /usr/* if it runs after the mountnfs.sh script
    PATH=/usr/sbin:/usr/bin:/sbin:/bin
    DESC="Tvheadend"
    NAME=tvheadend
    DAEMON=/usr/bin/$NAME
    PIDFILE=/var/run/$NAME.pid
    SCRIPTNAME=/etc/init.d/$NAME
  1. Exit if the package is not installed
    [ -x "$DAEMON" ] || exit 0
  1. Read configuration variable file if it is present
    [ -r /etc/default/$NAME ] && . /etc/default/$NAME
  1. Configure command line options
    [ "$TVH_ENABLED" = "1" ] || exit 0

ARGS="-f"
[ -z "$TVH_USER" ] || ARGS="$ARGS -u $TVH_USER"
[ -z "$TVH_GROUP" ] || ARGS="$ARGS -g $TVH_GROUP"
[ -z "$TVH_CONF_DIR" ] || ARGS="$ARGS -c $TVH_CONF_DIR"
[ -z "$TVH_ADAPTERS" ] || ARGS="$ARGS -a $TVH_ADAPTERS"
[ "$TVH_IPV6" = "1" ] && ARGS="$ARGS -6"
[ -z "$TVH_HTTP_PORT" ] || ARGS="$ARGS --http_port $TVH_HTTP_PORT"
[ -z "$TVH_HTTP_ROOT" ] || ARGS="$ARGS --http_root $TVH_HTTP_ROOT"
[ -z "$TVH_HTSP_PORT" ] || ARGS="$ARGS --htsp_port $TVH_HTSP_PORT"
[ -z "$TVH_ARGS" ] || ARGS="$ARGS $TVH_ARGS"
[ "$TVH_DEBUG" = "1" ] && ARGS="$ARGS -s"

  1. Load the VERBOSE setting and other rcS variables
    [ -f /etc/default/rcS ] && . /etc/default/rcS
  1. Define LSB log_* functions.
  2. Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
    . /lib/lsb/init-functions
#
  1. Function that starts the daemon/service #
    do_start() { # Return # 0 if daemon has been started # 1 if daemon was already running # 2 if daemon could not be started
    udevadm settle
    start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ || return 1
    start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
    $ARGS \ || return 2
    }
#
  1. Function that stops the daemon/service #
    do_stop() { # Return # 0 if daemon has been stopped # 1 if daemon was already stopped # 2 if daemon could not be stopped # other if a failure occurred
    start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
    RETVAL="$?"
    [ "$RETVAL" = 2 ] && return 2 # Many daemons don't delete their pidfiles when they exit.
    rm -f $PIDFILE
    return "$RETVAL"
    }

case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
restart|force-reload) # # If the "reload" option is implemented then remove the # 'force-reload' alias #
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*) # Failed to stop
log_end_msg 1
;;
esac
;;
status)
status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 3
;;
esac

: #############################################################

And it looks like IPv6 is enabled but TVHeadEnd is ignoring it ...

Or is it somewhere else I need to set the -6 parameter?

RE: IPv6 accessing web interface on port 9981 and htsp 9982 - Added by Robert Cameron over 6 years ago

The lines that matter are:

...
NAME="tvheadend" 
...
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
...
[ "$TVH_IPV6" = "1" ] && ARGS="$ARGS -6" 

So, look for the file /etc/default/tvheadend. If it doesn't exist, create it:
# touch /etc/default/tvheadend

Then, in that file add a line setting the ${TVH_IPV6} variable:
# echo "TVH_IPV6=1" >> /etc/default/tvheadend

Now you can restart Tvheadend, and it'll pick up the new settings you just created. If you don't want to run those commands as root and would rather use sudo to execute them, then you can do:
$ sudo touch /etc/default/tvheadend
$ echo "TVH_IPV6=1" | sudo tee -a /etc/default/tvheadend

RE: IPv6 accessing web interface on port 9981 and htsp 9982 - Added by Marc Ominus over 6 years ago

Thank you, IPv6 is on :)

netstat -ltn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:38673 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:58741 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:40505 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:993 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:2049 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:514 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:56999 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:8200 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:4200 0.0.0.0:* LISTEN
tcp 0 0 192.168.1.30:554 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:11211 0.0.0.0:* LISTEN
tcp6 0 0 :::111 :::* LISTEN
tcp6 0 0 :::80 :::* LISTEN
tcp6 0 0 :::36881 :::* LISTEN
tcp6 0 0 :::42007 :::* LISTEN
tcp6 0 0 ::1:25 :::* LISTEN
tcp6 0 0 :::52025 :::* LISTEN
tcp6 0 0 :::9981 :::* LISTEN
tcp6 0 0 :::9982 :::* LISTEN
tcp6 0 0 :::993 :::* LISTEN
tcp6 0 0 :::2049 :::* LISTEN
tcp6 0 0 :::514 :::* LISTEN
tcp6 0 0 :::37929 :::* LISTEN

$ sudo cat /etc/default/tvheadend #
  1. Default configuration for tvheadend #
  1. TVH_ENABLED
  2. set to 0 to disable upstart job
    TVH_ENABLED=1
  1. TVH_USER
  2. if set to "" will run as root
    TVH_USER="hts"
  1. TVH_GROUP
  2. if set to "" will run as root
    TVH_GROUP="video"
  1. TVH_CONF_DIR
  2. if set to "" will use ~TVH_USER/.hts/tvheadend
    TVH_CONF_DIR=""
  1. TVH_ADAPTERS
  2. if set to "" will use all available adapters
  3. for select adapters use comma seperated list of adapter
  4. numbers, i.e. to use /dev/dvb/adapter0 and /dev/dvb/adapter1 only
  5. set as "0,1"
    TVH_ADAPTERS=""
  1. TVH_IPV6
  2. if set to 1 will enable IPv6 support
    TVH_IPV6=1
  1. TVH_HTTP_PORT
  2. if set to "" will use binary default
    TVH_HTTP_PORT=""
  1. TVH_HTTP_ROOT
  2. if set to "" will use binary default
  3. else will change the webui root context, useful for proxied
  4. servers
    TVH_HTTP_ROOT=""
  1. TVH_HTSP_PORT
  2. if set to "" will use binary default
    TVH_HTSP_PORT=""
  1. TVH_DEBUG
  2. if set to 1 will output debug to syslog
    TVH_DEBUG=0
  1. TVH_ARGS
  2. add any other arguments
    TVH_ARGS=""
    (1-6/6)