Bug 106331 - ifup gives error message when no default route is present
ifup gives error message when no default route is present
Product: Red Hat Linux
Classification: Retired
Component: initscripts (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
Brock Organ
Depends On:
  Show dependency treegraph
Reported: 2003-10-05 20:08 EDT by Nickolai Zeldovich
Modified: 2014-03-16 22:39 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-10-06 01:32:13 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Nickolai Zeldovich 2003-10-05 20:08:32 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030701

Description of problem:
When no default route is installed, ifup produces an error message because the
variable counting default routes is not initialized.
This patch fixes it (apologies for whitespace-conversion problems
with the diff):

--- ifup        2003/10/04 02:21:57     1.1
+++ ifup        2003/10/04 02:48:12     1.2
@@ -264,7 +264,7 @@
     # DHCP likes to create duplicate routes.  Fix that up.
     NUMDEFROUTES=`ip -o route | \
                   grep "^default" | \
-                  awk '{ nlines++ } END { print nlines }'`
+                  awk 'BEGIN { nlines=0; } { nlines++ } END { print nlines }'`
     if [ -n "$NUMDEFROUTES" -a "$NUMDEFROUTES" -gt 1 ]; then
        # remove the default route for the new device (old route wins)
        ip route del default dev ${DEVICE}

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.Edit dhclient-script to not install a default route.
2.Bring up a DHCP interface.

Additional info:
Comment 1 Bill Nottingham 2003-10-06 01:32:13 EDT
This is fixed in current rawhide initscripts.

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