From: Michael Tremer Date: Thu, 17 Jun 2010 22:33:59 +0000 (+0200) Subject: network: bridge virtual: Add some nice status output. X-Git-Tag: 001~79 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7026b865ae0d55e3ffe5c61e0db4dc73ac6b2dac;p=network.git network: bridge virtual: Add some nice status output. --- diff --git a/hooks/bridge.ports/virtual b/hooks/bridge.ports/virtual index b82ad195..0e350bbb 100755 --- a/hooks/bridge.ports/virtual +++ b/hooks/bridge.ports/virtual @@ -122,4 +122,28 @@ function _down() { exit ${EXIT_OK} } +function _status() { + local zone=${1} + local port=${2} + + config_read $(zone_dir ${zone})/${port} + + local device=$(devicify ${DEVICE_MAC}) + + printf " %-10s - " "${device}" + if ! device_is_up ${device}; then + echo -ne "${COLOUR_DOWN} DOWN ${COLOUR_NORMAL}" + else + local state=$(stp_port_state ${zone} ${device}) + local colour="COLOUR_STP_${state}" + printf "${!colour}%10s${COLOUR_NORMAL}" ${state} + fi + + echo -n " - DSR: $(stp_port_designated_root ${zone} ${device})" + echo -n " - Cost: $(stp_port_pathcost ${zone} ${device})" + echo + + exit ${EXIT_OK} +} + run $@