summaryrefslogtreecommitdiffstats
path: root/etc/rc.d
diff options
context:
space:
mode:
authorhrs <hrs@FreeBSD.org>2014-10-09 23:39:17 +0000
committerhrs <hrs@FreeBSD.org>2014-10-09 23:39:17 +0000
commitc277f8d098a8ab06ec6aa0425d4c60f8697c0c54 (patch)
treec2e644723437567c7445578d3b4a207630a59966 /etc/rc.d
parentb4afe774e43a6363cf751771ed91da1f19f91219 (diff)
downloadFreeBSD-src-c277f8d098a8ab06ec6aa0425d4c60f8697c0c54.zip
FreeBSD-src-c277f8d098a8ab06ec6aa0425d4c60f8697c0c54.tar.gz
MFC r270783:
Return false status only when adding a route is failed. It could erroneously return false due to an afexists() check loop in routing_start().
Diffstat (limited to 'etc/rc.d')
-rwxr-xr-xetc/rc.d/routing50
1 files changed, 24 insertions, 26 deletions
diff --git a/etc/rc.d/routing b/etc/rc.d/routing
index 284aa7d..4b0a5bc 100755
--- a/etc/rc.d/routing
+++ b/etc/rc.d/routing
@@ -23,32 +23,33 @@ ROUTE_CMD="/sbin/route"
routing_start()
{
- local _cmd _af _if _a
+ local _cmd _af _if _a _ret
_cmd=$1
_af=$2
_if=$3
+ _ret=0
case $_if in
""|[Aa][Ll][Ll]|[Aa][Nn][Yy]) _if="" ;;
esac
case $_af in
- inet|inet6|ipx|atm)
+ ""|[Aa][Ll][Ll]|[Aa][Nn][Yy])
+ for _a in inet inet6 atm; do
+ afexists $_a || continue
+ setroutes $_cmd $_a $_if || _ret=1
+ done
+ ;;
+ *)
if afexists $_af; then
- setroutes $_cmd $_af $_if
+ setroutes $_cmd $_af $_if || _ret=1
else
err 1 "Unsupported address family: $_af."
fi
- ;;
- ""|[Aa][Ll][Ll]|[Aa][Nn][Yy])
- for _a in inet inet6 ipx atm; do
- afexists $_a && setroutes $_cmd $_a $_if
- done
- ;;
- *)
- err 1 "Unsupported address family: $_af."
- ;;
+ ;;
esac
+
+ return $_ret
}
routing_stop()
@@ -62,17 +63,6 @@ routing_stop()
esac
case $_af in
- inet|inet6|ipx|atm)
- if afexists $_af; then
- eval static_${_af} delete $_if
- # When $_if is specified, do not flush routes.
- if ! [ -n "$_if" ]; then
- eval routing_stop_${_af}
- fi
- else
- err 1 "Unsupported address family: $_af."
- fi
- ;;
""|[Aa][Ll][Ll]|[Aa][Nn][Yy])
for _a in inet inet6 ipx atm; do
afexists $_a || continue
@@ -82,10 +72,18 @@ routing_stop()
eval routing_stop_${_a}
fi
done
- ;;
+ ;;
*)
- err 1 "Unsupported address family: $_af."
- ;;
+ if afexists $_af; then
+ eval static_${_af} delete $_if
+ # When $_if is specified, do not flush routes.
+ if ! [ -n "$_if" ]; then
+ eval routing_stop_${_af}
+ fi
+ else
+ err 1 "Unsupported address family: $_af."
+ fi
+ ;;
esac
}
OpenPOWER on IntegriCloud