From e392f00ff431347d3b8a367ccbffc75ab33cd9d2 Mon Sep 17 00:00:00 2001 From: Robby Workman Date: Sat, 7 Jan 2017 19:10:49 -0600 Subject: rc.inet1: migrate gateway functions --- rc.inet1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rc.inet1 b/rc.inet1 index 1326224..cd18729 100644 --- a/rc.inet1 +++ b/rc.inet1 @@ -228,19 +228,19 @@ if_down() { # Function to bring up the gateway if there is not yet a default route: gateway_up() { - if ! /sbin/route -n | grep "^0.0.0.0" 1> /dev/null ; then + if ! /sbin/ip route show | grep -wq default ; then if [ ! "$GATEWAY" = "" ]; then - echo "/etc/rc.d/rc.inet1: /sbin/route add default gw ${GATEWAY} metric 1" | $LOGGER - /sbin/route add default gw ${GATEWAY} metric 1 2>&1 | $LOGGER + echo "/etc/rc.d/rc.inet1: /sbin/ip route add default via ${GATEWAY}" | $LOGGER + /sbin/ip route add default via ${GATEWAY} | $LOGGER fi fi } # Function to take down an existing default gateway: gateway_down() { - if /sbin/route -n | grep "^0.0.0.0" 1> /dev/null ; then - echo "/etc/rc.d/rc.inet1: /sbin/route del default" | $LOGGER - /sbin/route del default + 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 fi } -- cgit v1.2.3