From fa3bb0bc48de1b717bbd8721b40c9dff73a069ed Mon Sep 17 00:00:00 2001 From: Darren 'Tadgy' Austin Date: Mon, 13 Aug 2018 18:42:02 +0100 Subject: Added ipv6 gateway up/down function Signed-off-by: Robby Workman --- rc.inet1 | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/rc.inet1 b/rc.inet1 index a919e28..5b210a0 100644 --- a/rc.inet1 +++ b/rc.inet1 @@ -357,18 +357,29 @@ if_down() { gateway_up() { # Bring up the IPv4 gateway: if [ -n "$GATEWAY" ]; then - if ! /sbin/ip -4 route show | grep -wq default ; then + if ! /sbin/ip -4 route show | grep -wq default; then echo "/etc/rc.d/rc.inet1: /sbin/ip -4 route add default via ${GATEWAY}" | $LOGGER /sbin/ip -4 route add default via ${GATEWAY} fi fi + # Bring up the IPv6 gateway: + if [ -n "$GATEWAY6" ]; then + if ! /sbin/ip -6 route show | grep -wq default; then + echo "/etc/rc.d/rc.inet1: /sbin/ip -6 route add default via ${GATEWAY6}" | $LOGGER + /sbin/ip -6 route add default via ${GATEWAY6} + fi + fi } # Function to take down an existing default gateway: gateway_down() { - if /sbin/ip route show | grep -wq default ; then - echo "/etc/rc.d/rc.inet1: /sbin/ip route del default" | $LOGGER - /sbin/ip route del default + if /sbin/ip -4 route show | grep -wq default ; then + echo "/etc/rc.d/rc.inet1: /sbin/ip -4 route del default" | $LOGGER + /sbin/ip -4 route del default + fi + if /sbin/ip -6 route show | grep -wq default ; then + echo "/etc/rc.d/rc.inet1: /sbin/ip -6 route del default" | $LOGGER + /sbin/ip -6 route del default fi } -- cgit v1.2.3