]> git.ipfire.org Git - people/ms/network.git/blobdiff - src/network
Makefile: Fix typo in localstatedir
[people/ms/network.git] / src / network
index ae4016d68fc23030906d96c191631fbc25507f9b..30f87a0ec9b1142a9d8e084b8b1d8d29e582e67f 100644 (file)
@@ -148,6 +148,12 @@ cli_device_status() {
        cli_print_fmt1 1 "Status"       "${status}"
        cli_print_fmt1 1 "Type"         "${type}"
 
+       # Print the driver name
+       local driver="$(device_get_driver "${device}")"
+       if isset driver; then
+               cli_print_fmt1 1 "Driver" "${driver}"
+       fi
+
        # Ethernet-compatible?
        device_is_ethernet_compatible "${device}" &>/dev/null
        cli_print_fmt1 1 "Ethernet-compatible" "$(cli_print_bool $?)"
@@ -245,28 +251,6 @@ cli_device_status_serial() {
        fi
 }
 
-cli_device_status_phy() {
-       local phy="${1}"
-       assert phy_exists "${phy}"
-
-       local address="$(phy_get_address "${phy}")"
-       cli_print_fmt1 1 "Address" "${address}"
-       cli_space
-
-       local devices="$(phy_get_devices "${phy}")"
-       if isset devices; then
-               cli_headline 2 "Soft interfaces"
-
-               local device
-               for device in ${devices}; do
-                       cli_print 2 "* %s" "${device}"
-               done
-               cli_space
-       fi
-
-       return ${EXIT_OK}
-}
-
 cli_device_discover() {
        local device=${1}
        shift
@@ -1108,11 +1092,40 @@ cli_status() {
        local log_disable_stdout=${LOG_DISABLE_STDOUT}
        LOG_DISABLE_STDOUT="true"
 
-       local zones=$(zones_get "$@")
+       local arguments=( $@ )
 
-       local zone
-       for zone in ${zones}; do
-               zone_status ${zone}
+       # Show all zones when no arguments are given
+       if ! isset arguments; then
+               local zone
+               for zone in $(zones_get_all); do
+                       zone_status "${zone}"
+               done
+
+               return ${EXIT_OK}
+       fi
+
+       local arg
+       for arg in ${arguments[@]}; do
+               # Is this a zone?
+               if zone_exists "${arg}"; then
+                       zone_status "${arg}"
+
+               # Is this a port?
+               elif port_exists "${arg}"; then
+                       port_status "${arg}"
+
+               # Is this a PHY?
+               elif phy_exists "${arg}"; then
+                       cli_device_status "${arg}"
+
+               # Is this a device?
+               elif device_exists "${arg}"; then
+                       cli_device_status "${arg}"
+
+               # Unknown argument
+               else
+                       error "Unknown argument: ${arg}"
+               fi
        done
 
        # Reset logging.
@@ -1167,12 +1180,12 @@ cli_reset() {
        done
 
        local zone
-       for zone in $(zones_get --all); do
+       for zone in $(zones_get_all); do
                zone_destroy "${zone}"
        done
 
        local port
-       for port in $(ports_get --all); do
+       for port in $(ports_get_all); do
                port_destroy "${port}"
        done