]> git.ipfire.org Git - people/ms/network.git/blobdiff - src/network
network: Show when a PHY supports ACS
[people/ms/network.git] / src / network
index 71b0cdec734ed2e51d733ec2a851be6ea39486fa..3535133d586434695fcde2689da6bd68734559e7 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 $?)"
@@ -251,6 +257,13 @@ cli_device_status_phy() {
 
        local address="$(phy_get_address "${phy}")"
        cli_print_fmt1 1 "Address" "${address}"
+
+       # Show kernel module
+       local driver="$(phy_get_driver "${phy}")"
+       if isset driver; then
+               cli_print_fmt1 1 "Driver" "${driver}"
+       fi
+
        cli_space
 
        local devices="$(phy_get_devices "${phy}")"
@@ -264,6 +277,15 @@ cli_device_status_phy() {
                cli_space
        fi
 
+       cli_headline 2 "Features"
+
+       cli_print_fmt1 2 "Automatic Channel Selection" \
+               "$(phy_supports_acs "${phy}" && print "Supported" || print "Not Supported")"
+       cli_print_fmt1 2 "DFS" \
+               "$(phy_supports_dfs "${phy}" && print "Supported" || print "Not Supported")"
+
+       cli_space
+
        return ${EXIT_OK}
 }
 
@@ -637,17 +659,15 @@ cli_zone_destroy() {
        fi
 
        local zone="${1}"
-       assert zone_exists "${zone}"
 
-       if zone_is_up ${zone}; then
-               echo "Zone '${zone}' is up and will be removed when it goes down the next time."
-               zone_destroy "${zone}"
-       else
-               echo "Removing zone '${zone}' now..."
-               zone_destroy_now "${zone}"
+       # Check if the zone exists
+       if ! zone_exists "${zone}"; then
+               error "Zone '${zone}' does not exist"
+               return ${EXIT_ERROR}
        fi
 
-       exit ${EXIT_OK}
+       echo "Removing zone '${zone}'..."
+       zone_destroy "${zone}" || exit $?
 }
 
 cli_zone_port() {
@@ -1110,11 +1130,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.
@@ -1169,20 +1218,20 @@ cli_reset() {
        done
 
        local zone
-       for zone in $(zones_get --all); do
-               zone_destroy_now "${zone}"
+       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
 
        # Flush all DNS servers.
        dns_server_flush
 
-       # Re-run the initialization functions
-       init_run
+       # Trigger udev to re-add all physical network devices
+       cmd_quiet udevadm trigger --action=add --subsystem-match=net
 
        exit ${EXIT_OK}
 }
@@ -1286,6 +1335,9 @@ cli_raw() {
                db-dump)
                        db_dump
                        ;;
+               device-get-by-mac-address)
+                       device_get_by_mac_address "$@"
+                       ;;
                ipsec-connection-exists)
                        ipsec_connection_exists "$@"
                        ;;
@@ -1364,10 +1416,17 @@ cli_raw() {
 # Process the given action
 case "${action}" in
        init)
-               init_run
+               # Update resolv.conf(5) when initializing the network
+               dns_generate_resolvconf
+
+               # Update bird configuration
+               bird_generate_config
+
+               # Also execute all triggers
+               triggers_execute_all "init"
                ;;
 
-       settings|hostname|port|device|zone|start|stop|restart|status|reset|route|vpn)
+       settings|hostname|port|device|zone|start|stop|restart|status|reset|route|vpn|wireless)
                cli_${action} "$@"
                ;;