Bug 114548

Summary: ifup-routes no longer allows comments in route definition files
Product: Red Hat Enterprise Linux 3 Reporter: Nick Strugnell <nstrug>
Component: initscriptsAssignee: Miloslav Trmač <mitr>
Status: CLOSED DUPLICATE QA Contact: Brock Organ <borgan>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0CC: dag, link, notting, oggust
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2005-607 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-05-01 21:57:29 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
patch for this issue none

Description Nick Strugnell 2004-01-29 14:23:33 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030922

Description of problem:
/etc/sysconfig/network-scripts/ifup-routes is invoked to add static
routes when interfaces are brought up. It handles 'old' (pre RHEL
3/RHL 9) and new format files defining the routes, however it no
longer handles comments in old-style route definition files.

This breaks systems that have been migrated from RHEL 2.1.



Version-Release number of selected component (if applicable):
7.31.9.EL-1

How reproducible:
Always

Steps to Reproduce:
1. create an 'old-style' file e.g.:
/etc/sysconfig/network-scripts/route-eth0 as:
129.16.30.196/32 dev eth0
2. Add a hashed-out comment
3. Try to bring up interface
    

Actual Results:  'ip route add' in ifup-routes throws an error

Expected Results:  ifup-routes should work

Additional info:

Comment 1 Terje Bless 2005-04-10 21:19:21 UTC
This is still present as of RHEL4 as well as initscripts-8.07-1 in Fedora Core
Rawhide today. Bug #154353 deals with a superset of this issue and has a
possible patch.

Comment 2 Bill Nottingham 2005-04-11 20:46:13 UTC
Created attachment 112994 [details]
patch for this issue

Please try the attached.

Comment 8 Bill Nottingham 2005-07-01 21:10:31 UTC
Fixed in 7.31.24.EL-1 for RHEL 3.

Comment 9 Bill Nottingham 2005-07-01 21:16:06 UTC
Fixed in 7.93.14.EL-1 for RHEL-4.

Comment 10 Red Hat Bugzilla 2005-09-28 15:53:31 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2005-606.html


Comment 11 Red Hat Bugzilla 2005-10-05 15:45:20 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2005-607.html


Comment 12 Dag Wieers 2006-04-13 09:54:14 UTC
Does this errata fix it only for old-style route-<if> files ?

I am still not able to add comments on a new-style route-<if> on RHEL3AS U7.

One of the advantages of text config-files on Unix, is that one can add comments
in configuration files in order to work together much more efficiently.

For each comment like:

    ### Route to NTP servers (ntpserver1 and ntpserver2)
    1.2.3.0/24 via 4.3.2.1

I see an error like:

    Apr 12 14:29:33 server1 ifup: Error: an inet prefix is expected rather than
"###". 
    Apr 12 14:29:33 server1 ifup: RTNETLINK answers: No such device 

Comment 13 Björn Augustsson 2006-04-13 11:07:38 UTC
Just to clarify: The excerpt you showed is from an old-style file. New ones look
kind of like the ifcfg-<if> files, with entries like

    ADDRESSn=<network>
    NETMASKn=<network/prefix mask>
    GATEWAYn=<next-hop router/gateway IP address>

But anyway, I can reproduce your problem as well on RHEL3

RHEL 4 (where I can't reproduce it) has

           # older format
           while read line; do
               if [[ ! "$line" =~ '^[[:space:]]*(\#.*)?$' ]]; then
                   /sbin/ip route add $line
               fi
           done < "$file"

and RHEL3 has 

           # older format
           while read line; do
               if [ "$line" == "${line##[[:space:]]*\#}" ]; then
                   /sbin/ip route add $line
               fi
           done < "$file"

bash in rhel3 hasn't got the "=~" operator, so it's not that easy though.

/August, also ran into this, the original bug report stems from an install RH
did here.

Comment 14 Bill Nottingham 2006-04-13 13:25:36 UTC
I suspect that just changing it to:

 if [ "$line" == "${line##\#}" ]; then
...

as in the original patch will fix it for you?

Comment 15 Björn Augustsson 2006-04-13 13:42:23 UTC
Works for me.

/August.

Comment 19 Miloslav Trmač 2006-05-01 21:57:29 UTC

*** This bug has been marked as a duplicate of 190395 ***