]> git.ipfire.org Git - people/ms/network.git/commitdiff
Show if the device is able to transport Ethernet frames
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 23 Dec 2014 00:51:59 +0000 (00:51 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 23 Dec 2014 00:51:59 +0000 (00:51 +0000)
src/functions/functions.device
src/network

index 97eb17f794bd174f8c42a69eef005ceca7b49cb4..d4318f843a20f360b7490d9f0bfa70e7b385dcfa 100644 (file)
@@ -389,6 +389,14 @@ function device_get_type() {
        fi
 }
 
+function device_is_ethernet_compatible() {
+       local device="${1}"
+
+       # /sys/class/net/*/type must equal 1 for ethernet compatible devices
+       local type="$(__device_get_file "${device}" "type")"
+       [[ "${type}" = "1" ]]
+}
+
 function device_get_status() {
        local device=${1}
        assert isset device
index eccf2f43c9990101173a61e0b95b89c0694d91ef..fda05a23c8525ac01b479a148882fe6b75726f1f 100644 (file)
@@ -128,6 +128,11 @@ function cli_device_status() {
 
        cli_print_fmt1 1 "Status"       "${status}"
        cli_print_fmt1 1 "Type"         "${type}"
+
+       # Ethernet-compatible?
+       device_is_ethernet_compatible "${device}" &>/dev/null
+       cli_print_fmt1 1 "Ethernet-compatible" "$(cli_print_bool $?)"
+
        cli_print_fmt1 1 "Address"      "$(device_get_address ${device})"
        cli_space