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

index b82ad195678d308b9ef466774066a0d855bed6e3..0e350bbb8379a9e496dffddfccd6190c3e330a23 100755 (executable)
@@ -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 $@