X-Git-Url: http://git.ipfire.org/?p=people%2Fstevee%2Fnetwork.git;a=blobdiff_plain;f=src%2Fnetwork;h=81bb3bb540b69354ac6d19893f084afee26e8575;hp=d6a0817ff3be746f354bf43346b331ff750fea17;hb=5dfc94a8b6045b1120789696b19658fb7f734f3d;hpb=e6fd23fd31b73042e461f3fd70e68a1fff3a9080 diff --git a/src/network b/src/network index d6a0817f..81bb3bb5 100644 --- a/src/network +++ b/src/network @@ -128,17 +128,20 @@ 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 # Print the link speed for ethernet devices. if device_is_up ${device} &>/dev/null; then - case "${type}" in - ethernet) - cli_print_fmt1 1 "Link" \ - "$(device_get_speed ${device}) MBit/s $(device_get_duplex ${device}) duplex" - ;; - esac + local link="$(device_get_link_string "${device}")" + if isset link; then + cli_print_fmt1 1 "Link" "${link}" + fi fi cli_print_fmt1 1 "MTU" "$(device_get_mtu ${device})" @@ -236,8 +239,8 @@ function cli_device_discover() { local device=${1} shift - local device_type=$(device_get_type ${device}) - if [ "${device_type}" != "real" ]; then + # This can only be executed for ethernet (or compatible) devices + if ! device_is_ethernet_compatible "${device}"; then return ${EXIT_OK} fi @@ -470,22 +473,9 @@ function cli_port() { action=${2} shift 2 - # Action aliases - case "${action}" in - start) - action="up" - ;; - stop) - action="down" - ;; - show) - action="status" - ;; - esac - case "${action}" in - edit|up|down|status) - port_${action} ${port} $@ + edit|create|remove|up|down|status) + port_${action} "${port}" $@ ;; *) error "Unrecognized argument: ${action}" @@ -497,7 +487,7 @@ function cli_port() { shift case "${action}" in - create|destroy) + new|destroy) port_${action} $@ ;; *) @@ -1055,7 +1045,7 @@ function cli_reset() { local port for port in $(ports_get --all); do - port_remove ${port} + port_destroy "${port}" done # Flush all DNS servers.