Line | |
---|
1 | #!/bin/sh
|
---|
2 | #
|
---|
3 | # Control lvrouted routing daemon status
|
---|
4 | #
|
---|
5 |
|
---|
6 | # PROVIDE: lvrouted
|
---|
7 | # REQUIRE: NETWORKING
|
---|
8 | # BEFORE: netwait
|
---|
9 | # KEYWORD: nojail
|
---|
10 |
|
---|
11 | . /etc/rc.subr
|
---|
12 |
|
---|
13 | : ${lvrouted_enable="NO"}
|
---|
14 | : ${lvrouted_flags=""}
|
---|
15 |
|
---|
16 | name="lvrouted"
|
---|
17 |
|
---|
18 | rcvars="${name}_flags"
|
---|
19 | load_rc_config $name
|
---|
20 |
|
---|
21 | command="%%PREFIX%%/sbin/${name}"
|
---|
22 | pid_file="/var/run/${name}.pid"
|
---|
23 |
|
---|
24 | start_precmd="lvrouted_flush_routes"
|
---|
25 |
|
---|
26 | # XXX: Needs to be a flag to disable
|
---|
27 | # XXX: lvrouted should mark their added routed protocol specific (see: man 8 route)
|
---|
28 | # lvrouted requires no route to exists before start as it is not able to alter
|
---|
29 | # old routes, so make it flush all dynamic generated routes
|
---|
30 | lvrouted_flush_routes() {
|
---|
31 |
|
---|
32 | # XXX: Does the looping bug still exists?
|
---|
33 | # Keep looping till we whiped _all_ dynamic generated routes
|
---|
34 | while true; do
|
---|
35 | netstat -nr -f inet | awk '{if ($3 ~ /.*D.*/) { exit 1} }'
|
---|
36 | if [ $? -eq 0 ]; then
|
---|
37 | break
|
---|
38 | fi
|
---|
39 | echo "WARNING: Flushing all existing DYNAMIC routes" 1>&2
|
---|
40 | netstat -nr -f inet | awk '{if ($3 ~ /.*D.*/) {print $1} }' | xargs -n 1 route delete
|
---|
41 | done
|
---|
42 | }
|
---|
43 |
|
---|
44 | run_rc_command "$1"
|
---|
Note:
See
TracBrowser
for help on using the repository browser.