Date: Fri, 29 Aug 2014 08:02:35 +0000 (UTC) From: Hiroki Sato <hrs@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r270783 - head/etc/rc.d Message-ID: <201408290802.s7T82Zvq098994@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hrs Date: Fri Aug 29 08:02:35 2014 New Revision: 270783 URL: http://svnweb.freebsd.org/changeset/base/270783 Log: Return false status only when adding a route is failed. It could erroneously return false due to an afexists() check loop in routing_start(). Modified: head/etc/rc.d/routing Modified: head/etc/rc.d/routing ============================================================================== --- head/etc/rc.d/routing Fri Aug 29 07:51:47 2014 (r270782) +++ head/etc/rc.d/routing Fri Aug 29 08:02:35 2014 (r270783) @@ -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|atm) - if afexists $_af; then - setroutes $_cmd $_af $_if - else - err 1 "Unsupported address family: $_af." - fi - ;; ""|[Aa][Ll][Ll]|[Aa][Nn][Yy]) for _a in inet inet6 atm; do - afexists $_a && setroutes $_cmd $_a $_if + afexists $_a || continue + setroutes $_cmd $_a $_if || _ret=1 done - ;; + ;; *) - err 1 "Unsupported address family: $_af." - ;; + if afexists $_af; then + setroutes $_cmd $_af $_if || _ret=1 + else + err 1 "Unsupported address family: $_af." + fi + ;; esac + + return $_ret } routing_stop() @@ -62,17 +63,6 @@ routing_stop() esac case $_af in - inet|inet6|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 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 }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201408290802.s7T82Zvq098994>