source: hybrid/branches/releng-9.0/nanobsd/files/etc/local/rc.d/lvrouted@ 10417

Last change on this file since 10417 was 10417, checked in by rick, 13 years ago

Merging and cleanups of files found in various other places and trees of SVN.

  • Property svn:executable set to *
File size: 1.3 KB
Line 
1#!/bin/sh
2#
3# PROVIDE: lvrouted
4# REQUIRE: netif routing
5# KEYWORD: nojail
6
7lvrouted_enable=${lvrouted_enable:-"NO"}
8lvrouted_flags=${lvrouted_flags:-}
9
10. /etc/rc.subr
11
12name="lvrouted"
13rcvar=`set_rcvar`
14load_rc_config $name
15
16command="/usr/local/sbin/${name}"
17pid_file="/var/run/${name}.pid"
18
19# Import proxies
20wleiden_conf="/usr/local/etc/wleiden.conf"
21if [ -r $wleiden_conf ]; then
22 . ${wleiden_conf}
23fi
24
25# If there are proxies specified, them add them with the z flag
26if [ -n "$PROXIES" ]; then
27 PROXIES=`echo ${PROXIES} | sed 's/\ /\,/g'`
28 lvrouted_flags="$lvrouted_flags -z $PROXIES"
29fi
30
31start_precmd="lvrouted_flush_routes"
32
33# XXX: Needs to be a flag to disable
34# XXX: lvrouted should mark their added routed protocol specific (see: man 8 route)
35# lvrouted requires no route to exists before start as it is not able to alter
36# old routes, so make it flush all dynamic generated routes
37lvrouted_flush_routes() {
38
39 # XXX: Does the looping bug still exists?
40 # Keep looping till we whiped _all_ dynamic generated routes
41 while true; do
42 netstat -nr -f inet | awk '{if ($3 ~ /.*D.*/) { exit 1} }'
43 if [ $? -eq 0 ]; then
44 break
45 fi
46 echo "WARNING: Flushing all existing DYNAMIC routes" 1>&2
47 netstat -nr -f inet | awk '{if ($3 ~ /.*D.*/) {print $1} }' | xargs -n 1 route delete
48 done
49}
50
51run_rc_command "$1"
52
Note: See TracBrowser for help on using the repository browser.