]> git.ipfire.org Git - people/arne_f/network.git/commitdiff
network: bridge ethernet: Add some nice status output.
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 17 Jun 2010 22:33:40 +0000 (00:33 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 17 Jun 2010 22:33:40 +0000 (00:33 +0200)
hooks/bridge.ports/ethernet

index 6428ef31627dc1a5d8fdfef062e79fa8225fef1a..d25448854bf9a69505b456078d1b93db466e866b 100755 (executable)
@@ -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 $@