diff options
-rwxr-xr-x | sysconfig/network-scripts/ifup | 10 | ||||
-rw-r--r-- | sysconfig/network-scripts/network-functions | 1 |
2 files changed, 11 insertions, 0 deletions
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 \ |