blob: c0804a3a99c02f2759ad3265239ae4389d13a4bc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#!/bin/sh
#
# $NetBSD: staticroute,v 1.6 2012/05/02 15:57:15 gendalia Exp $
#
# PROVIDE: staticroute
# REQUIRE: network
# BEFORE: NETWORKING
# See the route.conf(5) manual page for details.
$_rc_subr_loaded . /etc/rc.subr
name="staticroute"
start_cmd="staticroute_doit Adding add"
stop_cmd="staticroute_doit Deleting delete"
staticroute_doit() {
retval=0
if [ -s /etc/route.conf ]; then
echo "$1 static routes."
( while read args; do
[ -z "$args" ] && continue
case "$args" in
"#"*)
;;
"+"*)
if [ $2 = "add" ]; then
eval "${args#*+}" || retval=1
fi
;;
"-"*)
if [ $2 = "delete" ]; then
eval "${args#*-}" || retval=1
fi
;;
"!"*)
eval "${args#*!}" || retval=1
;;
*)
eval "route -q $2 -$args" || retval=1
;;
esac
done < /etc/route.conf )
fi
return $retval
}
load_rc_config $name
run_rc_command "$1"
|