From c1d21f7c44405f0fd8bf5d18e6465a49177c070b Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Fri, 20 Apr 2012 14:13:37 -0400 Subject: Remove some more uses of /sbin/route ; replace with /sbin/ip. (#682308) --- sysconfig/network-scripts/ifup-aliases | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'sysconfig/network-scripts/ifup-aliases') diff --git a/sysconfig/network-scripts/ifup-aliases b/sysconfig/network-scripts/ifup-aliases index 16005cbd..a647044f 100755 --- a/sysconfig/network-scripts/ifup-aliases +++ b/sysconfig/network-scripts/ifup-aliases @@ -143,9 +143,8 @@ function ini_env () function is_default_gateway () { - LC_ALL=C /sbin/route -n \ - | awk '$1 == "0.0.0.0" && $2 == "'"$1"'" { found = 1; } - END { exit found == 0; }' + LC_ALL=C /sbin/ip route ls default scope global \ + | awk '$3 == "'"$1"'" { found = 1; } END { exit found == 0; }' } # @@ -269,8 +268,7 @@ function new_interface () \( -z "${GATEWAYDEV}" -o "${GATEWAYDEV}" = "${DEVICE}" \) ]; then # set up default gateway, if it isn't already there if ! is_default_gateway "$GATEWAY"; then - route add default gw ${GATEWAY} \ - ${METRIC:+metric $METRIC} ${DEVICE} + ip route replace default ${METRIC:+metric $METRIC} via ${GATEWAY} dev ${DEVICE} fi fi -- cgit v1.2.1