Package: tayga
Version: 0.9.2
Severity: normal

After installing tayga and creating its configuration file it is necessary to 
manually run many commands to create the tun device and to add the addresses.  
From the program's web page:

# tayga --mktun
# ip link set nat64 up
# ip addr add 192.168.0.1 dev nat64      (replace with your router's IPv4 
address)
# ip addr add 2001:db8:1::1 dev nat64    (replace with your router's IPv6 
address)
# ip route add 192.168.255.0/24 dev nat64
# ip route add 2001:db8:1:ffff::/96 dev nat64
# tayga

The attached patch reads /etc/tayga.conf and runs those commands.  It also 
destroys the tunnel when tayga is stopped.

-- System Information:
Debian Release: 6.0.1
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-2-686 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
--- tayga.orig  2011-08-15 11:07:43.000000000 -0300
+++ tayga       2011-08-15 10:52:04.000000000 -0300
@@ -59,6 +59,13 @@
                         # be a false positive (says it did not start
                         # when it actually did)
 
+TUN_DEVICE=$(grep "^[:space:]*tun-device" /etc/tayga.conf | awk '{print $2}')
+IPV4_ADDR=$(grep "^[:space:]*ipv4-addr" /etc/tayga.conf | awk '{print $2}')
+IPV6_ADDR=$(grep "^[:space:]*ipv6-addr" /etc/tayga.conf | awk '{print $2}')
+IPV6_PREFIX=$(grep "^[:space:]*prefix" /etc/tayga.conf | awk '{print $2}')
+IPV6_ADDR=${IPV6_ADDR:-${IPV6_PREFIX%%/*}$IPV4_ADDR}
+DYNAMIC_POOL=$(grep "^[:space:]*dynamic-pool" /etc/tayga.conf | awk '{print 
$2}')
+
 # Include defaults if available
 if [ -f /etc/default/$NAME ] ; then
     . /etc/default/$NAME
@@ -93,6 +100,13 @@
 }
 
 start_server() {
+       $DAEMON --mktun
+       ip link set $TUN_DEVICE up
+       ip addr add $IPV4_ADDR dev nat64
+       ip addr add $IPV6_ADDR dev nat64
+       ip route add $DYNAMIC_POOL dev nat64
+       ip route add $IPV6_PREFIX dev nat64
+
        start-stop-daemon --start --quiet \
                -b --exec $DAEMON --  --pidfile $PIDFILE $DAEMON_OPTS
 }
@@ -100,6 +114,7 @@
 stop_server() {
        start-stop-daemon --stop --quiet --pidfile $PIDFILE
        errcode=$?
+       $DAEMON --rmtun
        if $errorcode ; then
                rm $PIDFILE
        fi

Reply via email to