|
Last change
on this file since 10417 was 10417, checked in by rick, 14 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 |
|
|---|
| 7 | lvrouted_enable=${lvrouted_enable:-"NO"}
|
|---|
| 8 | lvrouted_flags=${lvrouted_flags:-}
|
|---|
| 9 |
|
|---|
| 10 | . /etc/rc.subr
|
|---|
| 11 |
|
|---|
| 12 | name="lvrouted"
|
|---|
| 13 | rcvar=`set_rcvar`
|
|---|
| 14 | load_rc_config $name
|
|---|
| 15 |
|
|---|
| 16 | command="/usr/local/sbin/${name}"
|
|---|
| 17 | pid_file="/var/run/${name}.pid"
|
|---|
| 18 |
|
|---|
| 19 | # Import proxies
|
|---|
| 20 | wleiden_conf="/usr/local/etc/wleiden.conf"
|
|---|
| 21 | if [ -r $wleiden_conf ]; then
|
|---|
| 22 | . ${wleiden_conf}
|
|---|
| 23 | fi
|
|---|
| 24 |
|
|---|
| 25 | # If there are proxies specified, them add them with the z flag
|
|---|
| 26 | if [ -n "$PROXIES" ]; then
|
|---|
| 27 | PROXIES=`echo ${PROXIES} | sed 's/\ /\,/g'`
|
|---|
| 28 | lvrouted_flags="$lvrouted_flags -z $PROXIES"
|
|---|
| 29 | fi
|
|---|
| 30 |
|
|---|
| 31 | start_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
|
|---|
| 37 | lvrouted_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 |
|
|---|
| 51 | run_rc_command "$1"
|
|---|
| 52 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.