summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobby Workman <rworkman@slackware.com>2017-01-07 19:10:49 -0600
committerRobby Workman <rworkman@slackware.com>2017-07-11 16:58:52 -0500
commite392f00ff431347d3b8a367ccbffc75ab33cd9d2 (patch)
treedcb0e00dcac34c357c59160e15c66024159fb6da
parentb6d44a0ea3113f6d4f86022ca98bdfd6ad08f72c (diff)
downloadslacknetsetup-e392f00ff431347d3b8a367ccbffc75ab33cd9d2.tar.xz
rc.inet1: migrate gateway functions
-rw-r--r--rc.inet112
1 files 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
}