Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Error in /etc/rc.d/staticroute



It appears that /etc/rc.d/staticroute expects the file /etc/route.conf to contain lines of text that describe individual static routes. If the line starts with a '+' it is processed only during the "start" command, and if the line starts with a '-' it is processed only during the "stop" command.

But if the line does not start with either '+' or '-' it should be processed during both "start" and "stop". Unfortunately the current /etc/rc.d/staticroute.conf seems to prepend a '-' in this case, leading to a command syntax error when the rest of the line is passed to /sbin/route

I think the following patch should be applied. Either that, or my understanding of what was intended is rather broken!

Index: staticroute
===================================================================
RCS file: /cvsroot/src/etc/rc.d/staticroute,v
retrieving revision 1.2
diff -u -p -r1.2 staticroute
--- staticroute 13 Aug 2004 18:08:03 -0000      1.2
+++ staticroute 31 Jan 2008 13:21:03 -0000
@@ -28,7 +28,7 @@ staticroute_doit() {
                                [ $2 = "delete" ] && eval ${args#*-}
                                ;;
                        *)
-                               route -q $2 -$args
+                               route -q $2 $args
                                ;;
                        esac
                done < /etc/route.conf


----------------------------------------------------------------------
|   Paul Goyette   | PGP DSS Key fingerprint: |  E-mail addresses:   |
| Customer Service | FA29 0E3B 35AF E8AE 6651 |  paul%whooppee.com@localhost   |
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette%juniper.net@localhost |
----------------------------------------------------------------------



Home | Main Index | Thread Index | Old Index