]> git.ipfire.org Git - people/ms/network.git/blobdiff - src/hooks/ports/ethernet
hooks: Use cli_get_bool convenience function where ever possible
[people/ms/network.git] / src / hooks / ports / ethernet
index 5f76e1588baf1ed80a6dae1e8bed8ff4bd87dd43..80b550312d5b4e3098cc4763bb891bb03bcf39d1 100644 (file)
@@ -85,16 +85,7 @@ hook_parse_cmdline() {
                                ;;
 
                        --offloading=*)
-                               OFFLOADING="$(cli_get_val "${1}")"
-
-                               if enabled OFFLOADING; then
-                                       OFFLOADING="on"
-                               elif disabled OFFLOADING; then
-                                       OFFLOADING="off"
-                               else
-                                       error "Invalid value for offloading: ${OFFLOADING}"
-                                       return ${EXIT_ERROR}
-                               fi
+                               OFFLOADING="$(cli_get_bool "${1}")"
                                ;;
 
                        *)
@@ -173,25 +164,5 @@ hook_remove() {
 }
 
 hook_hotplug_rename() {
-       local port=${1}
-       assert isset port
-
-       local device=${2}
-       assert isset device
-
-       # Read in the conifguration file.
-       port_settings_read "${port}"
-
-       # Get the current MAC address of the device.
-       local address=$(device_get_address ${device})
-       assert isset address
-
-       # Check if the address matches with the configuration.
-       if list_match "${address}" ${DEVICE} ${ADDRESS}; then
-               log DEBUG "Device '${device}' equals port '${port}'."
-               exit ${EXIT_OK}
-       fi
-
-       log DEBUG "Device '${device}' does not equal port '${port}'."
-       exit ${EXIT_ERROR}
+       hook_hotplug_rename_by_address "$@"
 }