From: Michael Tremer Date: Thu, 17 Jun 2010 22:33:40 +0000 (+0200) Subject: network: bridge ethernet: Add some nice status output. X-Git-Tag: 001~80 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=73c677554b238bcce58e18e843819f6f7b137e66;p=network.git network: bridge ethernet: Add some nice status output. --- diff --git a/hooks/bridge.ports/ethernet b/hooks/bridge.ports/ethernet index 6428ef31..d2544885 100755 --- a/hooks/bridge.ports/ethernet +++ b/hooks/bridge.ports/ethernet @@ -92,4 +92,28 @@ function _down() { exit ${EXIT_OK} } +function _status() { + local zone=${1} + local port=${2} + + config_read $(zone_dir ${zone})/${port} + + local device=$(devicify ${DEVICE}) + + 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 $@