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})"
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
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}"
shift
case "${action}" in
- create|destroy)
+ new|destroy)
port_${action} $@
;;
*)
local port
for port in $(ports_get --all); do
- port_remove ${port}
+ port_destroy "${port}"
done
# Flush all DNS servers.