--- linux.sh.orig 2014-04-25 18:48:24.061563150 +1000 +++ linux.sh 2014-04-25 21:05:34.088637714 +1000 @@ -164,10 +164,12 @@ ExecNoCheck $ifconfig $TSP_HOME_INTERFACE inet6 del $TSP_PREFIX::1/64 subif="`SubInterfaces`" - echo "$subif" | while read sub int ; do - PREF="`SubNet "${TSP_PREFIX}::0/${TSP_PREFIXLEN}" "$sub"`" - ExecNoCheck $ifconfig "$int" inet6 del ${PREF}::1/64 - done + if [ ! -z "$subif" ]; then + echo "$subif" | while read sub int ; do + PREF="`SubNet "${TSP_PREFIX}::0/${TSP_PREFIXLEN}" "$sub"`" + ExecNoCheck $ifconfig "$int" inet6 del ${PREF}::1/64 + done + fi fi # Delete default IPv6 route(s). @@ -276,17 +278,19 @@ Exec $ifconfig $TSP_HOME_INTERFACE add $TSP_PREFIX::1/64 subif="`SubInterfaces`" - echo "$subif" | while read sub int ; do - PREF=`echo $TSP_PREFIX | sed 's/00$//'` - OLDADDR=`$ifconfig "$int" | grep "inet6.* $PREF" | sed -e "s/^.*inet6 addr: //" -e "s/ Scope.*\$//"` - if [ ! -z $OLDADDR ]; then - Display 1 "Removing old IPv6 address $OLDADDR from $int" - Exec $ifconfig "$int" inet6 del $OLDADDR - fi - PREF="`SubNet "${TSP_PREFIX}::0/${TSP_PREFIXLEN}" "$sub"`" - Display 1 "Adding prefix ${PREF} to $int" - Exec $ifconfig "$int" inet6 add "${PREF}::1/64" - done + if [ ! -z "$subif" ]; then + echo "$subif" | while read sub int ; do + PREF=`echo $TSP_PREFIX | sed 's/00$//'` + OLDADDR=`$ifconfig "$int" | grep "inet6.* $PREF" | sed -e "s/^.*inet6 addr: //" -e "s/ Scope.*\$//"` + if [ ! -z $OLDADDR ]; then + Display 1 "Removing old IPv6 address $OLDADDR from $int" + Exec $ifconfig "$int" inet6 del $OLDADDR + fi + PREF="`SubNet "${TSP_PREFIX}::0/${TSP_PREFIXLEN}" "$sub"`" + Display 1 "Adding prefix ${PREF} to $int" + Exec $ifconfig "$int" inet6 add "${PREF}::1/64" + done + fi # Stop radvd daemon if it was running. Twice. /etc/init.d/radvd stop @@ -309,9 +313,10 @@ }; EOF - echo "$subif" | while read sub int ; do - PREF="`SubNet "${TSP_PREFIX}::0/${TSP_PREFIXLEN}" "$sub"`" - cat >> "$rtadvdconfigfile" <> "$rtadvdconfigfile" <