2003-01-09 18:57:02 +03:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2008-01-31 18:21:32 +03:00
|
|
|
# $NetBSD: staticroute,v 1.3 2008/01/31 15:21:32 reed Exp $
|
2003-01-09 18:57:02 +03:00
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: staticroute
|
|
|
|
# REQUIRE: network
|
|
|
|
# BEFORE: NETWORKING
|
|
|
|
|
2008-01-31 18:21:32 +03:00
|
|
|
# See the route.conf(5) manual page for details.
|
|
|
|
|
2004-08-13 22:08:03 +04:00
|
|
|
$_rc_subr_loaded . /etc/rc.subr
|
2003-01-09 18:57:02 +03:00
|
|
|
|
|
|
|
name="staticroute"
|
|
|
|
start_cmd="staticroute_doit Adding add"
|
|
|
|
stop_cmd="staticroute_doit Deleting delete"
|
|
|
|
|
|
|
|
staticroute_doit() {
|
|
|
|
if [ -s /etc/route.conf ]; then
|
|
|
|
echo "$1 static routes."
|
|
|
|
while read args; do
|
|
|
|
[ -z "$args" ] && continue
|
|
|
|
case "$args" in
|
|
|
|
"#"*)
|
|
|
|
;;
|
|
|
|
"+"*)
|
|
|
|
[ $2 = "add" ] && eval ${args#*+}
|
|
|
|
;;
|
|
|
|
"-"*)
|
|
|
|
[ $2 = "delete" ] && eval ${args#*-}
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
route -q $2 -$args
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done < /etc/route.conf
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command "$1"
|