source: hybrid/branches/releng-10/nanobsd/ports/net/lvrouted/files/lvrouted.in

Last change on this file was 12897, checked in by rick, 10 years ago

Not used in 10 anymore.

File size: 1.0 KB
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
16name="lvrouted"
17
18rcvars="${name}_flags"
19load_rc_config $name
20
21command="%%PREFIX%%/sbin/${name}"
22pid_file="/var/run/${name}.pid"
23
24start_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
30lvrouted_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
44run_rc_command "$1"
Note: See TracBrowser for help on using the repository browser.