Move the ip rule extra output to verbose mode only, and support verbose output on addresses and routes.

This commit is contained in:
Robin H. Johnson 2010-12-15 13:02:04 -08:00
parent 346148ceb8
commit f84d997d4c

View File

@ -141,6 +141,7 @@ _add_address()
;;
esac
veinfo ip addr add "$@" dev "${IFACE}"
ip addr add "$@" dev "${IFACE}"
}
@ -180,6 +181,7 @@ _add_route()
cmd="${cmd} metric ${metric}"
fi
veinfo ip ${family} route append ${cmd} dev "${IFACE}"
ip ${family} route append ${cmd} dev "${IFACE}"
eend $?
}
@ -215,19 +217,19 @@ _ip_rule_runner() {
local cmd rules OIFS="${IFS}"
cmd="$1"
rules="$2"
eindent
veindent
local IFS="$__IFS"
for ru in $rules ; do
unset IFS
ruN="$(trim "${ru}")"
[ -z "${ruN}" ] && continue
ebegin "${cmd} ${ruN}"
vebegin "${cmd} ${ruN}"
ip rule ${cmd} ${ru}
eend $?
veend $?
local IFS="$__IFS"
done
IFS="${OIFS}"
eoutdent
veoutdent
}
iproute2_pre_start()
@ -277,6 +279,7 @@ iproute2_post_start()
eerror "IP Policy Routing (CONFIG_IP_MULTIPLE_TABLES) needed for ip rule"
else
service_set_value "ip_rule" "${rules}"
einfo "Adding RPDB rules"
_ip_rule_runner add "${rules}"
fi
fi
@ -302,7 +305,10 @@ iproute2_post_stop()
# Kernel may not have IP built in
if [ -e /proc/net/route ]; then
local rules="$(service_get_value "ip_rule")"
[ -n "${rules}" ] && _ip_rule_runner del "${rules}"
if [ -n "${rules}" ]; then
einfo "Removing RPDB rules"
_ip_rule_runner del "${rules}"
fi
ip route flush table cache dev "${IFACE}"
fi