From 8a998885175388ada90c32ed06000e22648d5b18 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Thu, 9 Aug 2001 03:42:16 +0000 Subject: switch some more things to /sbin/ip; allow adding back of default route for DHCP devices (#48994) --- sysconfig/network-scripts/ifup | 4 ++-- sysconfig/network-scripts/ifup-ppp | 2 ++ sysconfig/network-scripts/network-functions | 9 +++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup index 7bc43c4c..093b093c 100755 --- a/sysconfig/network-scripts/ifup +++ b/sysconfig/network-scripts/ifup @@ -233,10 +233,10 @@ else if [ -z "${GATEWAYDEV}" -o "${GATEWAYDEV}" = "${DEVICE}" ]; then # set up default gateway if [ -n "${GATEWAY}" -a "`ipcalc --network ${GATEWAY} ${NETMASK} 2>/dev/null`" = "NETWORK=${NETWORK}" ]; then - route add default gw ${GATEWAY} ${DEVICE} + ip route add default via ${GATEWAY} DEFGW=${GATEWAY} elif [ "${GATEWAYDEV}" = "${DEVICE}" ]; then - route add default ${DEVICE} + ip route add default dev ${DEVICE} fi fi fi diff --git a/sysconfig/network-scripts/ifup-ppp b/sysconfig/network-scripts/ifup-ppp index 147dc858..bca290d0 100755 --- a/sysconfig/network-scripts/ifup-ppp +++ b/sysconfig/network-scripts/ifup-ppp @@ -96,6 +96,8 @@ fi if [ "${DEFROUTE}" != no ] ; then # pppd will no longer delete an existing default route # so we have to help it out a little here. + DEFRT=`ip route list | awk '/^default / { print $3 }'` + [ -n "${DEFRT}" ] && echo $DEFRT > /etc/default-route route del default >/dev/null 2>&1 opts="$opts defaultroute" fi diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index ee6b3356..2f181d73 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -166,11 +166,16 @@ add_default_route () if [ "${GATEWAY}" != "" -a "${GATEWAY}" != "none" -a "${GATEWAYDEV}" != "" ] ; then if ! check_device_down $1; then if [ "$GATEWAY" = "0.0.0.0" ]; then - /sbin/route add default ${GATEWAYDEV} + /sbin/ip route add default ${GATEWAYDEV} else - /sbin/route add default gw ${GATEWAY} ${GATEWAYDEV} + /sbin/ip route add default via ${GATEWAY} fi fi + else + if [ -f /etc/default-route ]; then + /sbin/ip route add default via `cat /etc/default-route` + rm -f /etc/default-route + fi fi } -- cgit v1.2.1