From: Michael Tremer Date: Thu, 17 Jun 2010 22:35:53 +0000 (+0200) Subject: network: bridge ipv4-static: Add some nice status output. X-Git-Tag: 001~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae1def398927b144d59bb45aa08f3c8745c97be8;p=network.git network: bridge ipv4-static: Add some nice status output. --- diff --git a/hooks/bridge.configs/ipv4-static b/hooks/bridge.configs/ipv4-static index 3071ef3b..6ff7f7d8 100755 --- a/hooks/bridge.configs/ipv4-static +++ b/hooks/bridge.configs/ipv4-static @@ -108,6 +108,33 @@ function _down() { exit ${EXIT_OK} } +function _status() { + local zone=${1} + local config=${2} + shift 2 + + if ! device_exists ${zone}; then + error "Zone '${zone}' doesn't exist." + exit ${EXIT_ERROR} + fi + + config_read $(zone_dir ${zone})/${config} + + echo -n " ${HOOK} - ${ADDRESS}/${PREFIX} - " + if zone_has_ipv4 ${zone} ${ADDRESS}/${PREFIX}; then + echo -ne "${COLOUR_OK}OK ${COLOUR_NORMAL}" + else + echo -ne "${COLOUR_ERROR}ERROR${COLOUR_NORMAL}" + fi + echo # End line + + if [ -n "${GATEWAY}" ]; then + echo " Gateway: ${GATEWAY}" + fi + + exit ${EXIT_OK} +} + function ipv4_mask_to_cidr() { local mask=0