--- net.eth0~orig 2004-04-13 15:10:42.000000000 -0500 +++ net.eth0 2004-04-13 21:50:27.000000000 -0500 @@ -162,6 +162,36 @@ } fi fi + # Set default route if applicable to this interface on inet6 + if [[ ${gateway6} == ${IFACE}/* ]]; then + local ogw6=$(/bin/netstat -A inet6 -rn | awk '$1 == "::/0" {print $2}' | head -n1) + local gw6=${gateway6#*/} + if [[ ${ogw6} != ${gw6} ]]; then + ebegin " Setting default IPv6 gateway ($gw6)" + + # First delete any existing route if it was setup by kernel... + /sbin/route -A inet6 del default dev ${IFACE} &>${devnull} + + # Second delete old gateway if it was set... + /sbin/route -A inet6 del default gw ${ogw6} &>${devnull} + + # Third add our new default gateway + /sbin/route -A inet6 add default gw ${gw6} >${devnull} + eend $? || { + true # need to have some command in here + # Note: This originally called stop, which is obviously + # wrong since it's calling with a local version of IFACE. + # The below code works correctly to abort configuration of + # the interface, but is commented because we're assuming + # that default route failure should not cause the interface + # to be unconfigured. + #local error=$? + #ewarn "Aborting configuration of ${IFACE}" + #iface_stop ${IFACE} + #return ${error} + } + fi + fi # Enabling rp_filter causes wacky packets to be auto-dropped by # the kernel. Note that we only do this if it is not set via @@ -198,7 +228,7 @@ for i in ${aliases} ${IFACE}; do # Delete all the inet6 addresses for this interface - inet6="$(ifconfig ${i} | awk '$1 == "inet6" {print $2}')" + inet6="$(ifconfig ${i} | awk '$1 == "inet6" {print $3}')" if [[ -n ${inet6} ]]; then einfo " Removing inet6 addresses" for x in ${inet6}; do