Bug 17371 - Incorrect (reversed) test in add_default_route
Summary: Incorrect (reversed) test in add_default_route
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: initscripts
Version: 6.2
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-09-08 23:20 UTC by Need Real Name
Modified: 2014-03-17 02:16 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2005-02-15 20:56:45 UTC
Embargoed:


Attachments (Terms of Use)

Description Need Real Name 2000-09-08 23:20:13 UTC
In /etc/sysconfig/network-scripts/network-functions,  add_default _route
tests  check_device_down before restoriing the default route defined in
$GATEWAY and $GATEWAYDEV.  The test is reversed, since  check_device_down
returns zero if the tested interface is down, and the ! in the test  will
cause the route to be added if the interface is still up.

I found this when trying to setup a ppp connection in addition to my nornal
lan connection on eth0. Starting ppp replaces the default route by its own
default, and the original default should be reactivated when ppp goes down.
This did not work until I changed the code as shown below.

Here is the code as I have modified it:

add_default_route ()
{
    . /etc/sysconfig/network
    find_gateway_dev
    if [ "${GATEWAY}" != "" -a "${GATEWAY}" != "none" -a "${GATEWAYDEV}" !=
"" ] ; then
#        if ! check_device_down ; then  # direction of test reversed by BEB
6 sept 2000
        if  check_device_down ; then
            /sbin/route add default gw ${GATEWAY} ${GATEWAYDEV}
        fi
    fi
}

Comment 1 Need Real Name 2000-09-09 02:36:12 UTC
It occurs to me that there may be something else going on here. Perhaps the
original test is correct, but that the wrong interface is being checked. that
is, instead of "add default route (for eth0) if ppp0 has gone down", it should
be "add default route (for eth0) if eth0 is still up". In this case, when
check_device_down  checks $DEVICE, $DEVICE should be eth0, not ppp0.

Comment 2 Bill Nottingham 2005-02-15 20:56:45 UTC
Closing out bugs on older, no longer supported, releases. Please open a new bug
if this persists on current releases.


Note You need to log in before you can comment on or make changes to this bug.