Subject: Error in /etc/rc.d/staticroute
To: None <current-users@netbsd.org>
From: Paul Goyette <paul@whooppee.com>
List: current-users
Date: 01/31/2008 05:23:11
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   |
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette@juniper.net |
----------------------------------------------------------------------