Re: [vdr] Multiple vdr peers on same machine

2018-09-26 Thread Mikko Tuumanen
> Actually it should be possible to run several VDRs on the same machine
> without any exta efforts. All you need to do is use separate SVDRP ports
> via the --port option.

I was missing address of the machine from the other svdrphosts.conf. 127.0.0.1 
there didn't help, because peering doesn't use that address.



___
vdr mailing list
vdr@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


Re: [vdr] Multiple vdr peers on same machine

2018-09-25 Thread Klaus Schmidinger

On 9/25/18 8:52 PM, Mikko Tuumanen wrote:

I have two vdr instances running on the same machine, one for recording and
other for viewing. Then I wanted them to use the new vdr peer system to be
able to edit timers from the viewing side.

Running two vdr's didn't work because they both want to bind the 6419 port,
...


Actually it should be possible to run several VDRs on the same machine
without any exta efforts. All you need to do is use separate SVDRP ports
via the --port option.

Klaus

___
vdr mailing list
vdr@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr


[vdr] Multiple vdr peers on same machine

2018-09-25 Thread Mikko Tuumanen
I have two vdr instances running on the same machine, one for recording and 
other for viewing. Then I wanted them to use the new vdr peer system to be 
able to edit timers from the viewing side.

Running two vdr's didn't work because they both want to bind the 6419 port, so 
I made a work-around with network namespaces like this:

First, a helper script to create a network namespace if not already created 
and run a command there:

/usr/local/sbin/Nsenter_vdr2

#!/bin/bash

mp=/home/vdr/vdr2/netns
addr=192.168.8.2/24
gw=192.168.8.1

if ! mountpoint -q $mp ; then
unshare --net=$mp true || exit 1
ip link add vdr2eth type veth peer name eth0 netns $mp
nsenter --net=$mp sh -c "ip link set eth0 up \
&& ip a add $addr dev eth0 \
&& ip link set lo up \
&& ip -4 route add default via $gw"
fi

if test -n "$SUDO_USER" -a "$SUDO_USER" != root ; then
exec nsenter --net=$mp sudo -u "$SUDO_USER" "$@"
else
exec nsenter --net=$mp "$@"
fi


The name space mount point is a reqular file (empty) and not a directory.
Nsenter script creates a veth pair named vdr2eth on the outside and eth0 
inside.

I used /etc/network/interfaces to set vdr2eth address, but it coud be done in 
the Nsenter script too. 

allow-hotplug vdr2eth
iface vdr2eth inet static
address 192.168.8.1
netmask 255.255.255.0

Then I run the recording instance of vdr normally on the outside and add 
permissions for 192.168.8.2 in svdrphosts and streamdevhosts.

Viewing vdr is run in the network namespace something like this:

#!/bin/bash

if test "$1" = "nsentered" ; then
 shift
 exec vdr -D- "-Psofthddevice -f" -i 1 -Pstreamdev-client "$@"
 exit 1
fi

while true ; do
 sudo Nsenter_vdr2 "$0" nsentered "$@"
done


I don't need to peer the viewing vdr to other computers in the local network. 
If that were the case, then the outside end of the veth pair would need to be 
bridged with the physical network card of the machine.


___
vdr mailing list
vdr@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr