From 15c4be1555400def1a8adddec32c713e7b17f5f0 Mon Sep 17 00:00:00 2001 From: Preston Brown Date: Thu, 27 Jun 2002 17:51:57 +0000 Subject: handle duplicate default routes better. --- sysconfig/network-scripts/ifup | 10 ++++++++++ sysconfig/network-scripts/network-functions | 1 + 2 files changed, 11 insertions(+) (limited to 'sysconfig/network-scripts') diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup index 0115310f..ab7f39ed 100755 --- a/sysconfig/network-scripts/ifup +++ b/sysconfig/network-scripts/ifup @@ -198,6 +198,16 @@ if [ -n "${DYNCONFIG}" ]; then fi [ -n "$FWHACK" ] && ipchains -D input -s 0/0 53 -d 0/0 1025:65535 -p udp -j ACCEPT + + # DHCP likes to create duplicate routes. Fix that up. + NUMDEFROUTES=`ip -o route | \ + grep default | \ + awk '{ nlines++ } END { print nlines }'` + if [ "$NUMDEFROUTES" -gt 1 ]; then + # remove the default route for the new device (old route wins) + ip route del default dev ${DEVICE} + fi +# end dynamic device configuration else if [ -z "${IPADDR}" ]; then # enable device without IP, useful for e.g. PPPoE diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index 5ce5fd6c..42384882 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -178,6 +178,7 @@ find_gateway_dev () add_default_route () { . /etc/sysconfig/network + check_default_route && return 0 find_gateway_dev if [ "$GATEWAYDEV" != "" -a \ "${GATEWAY}" != "" -a \ -- cgit v1.2.1