]> git.ipfire.org Git - people/ms/network.git/blobdiff - src/hooks/ports/vlan
ports: Drop HOOK_SETTINGS variable
[people/ms/network.git] / src / hooks / ports / vlan
index b95f6a980fa7f4b081e78d4d033096ba2fda9c3e..f5119864131d89e2ea5c1c91dbe8064fcb7e9031 100644 (file)
 
 . /usr/lib/network/header-port
 
-HOOK_SETTINGS="HOOK ADDRESS PARENT_DEVICE TAG"
+HOOK_SETTINGS=(
+       "ADDRESS"
+       "PARENT_DEVICE"
+       "TAG"
+)
 
 PORT_PARENTS_VAR="PARENT"
 
-function hook_check_settings() {
+hook_check_settings() {
        assert isset PARENT_DEVICE
        assert isinteger TAG
 
@@ -47,17 +51,17 @@ function hook_check_settings() {
        done
 }
 
-function hook_new() {
+hook_new() {
        while [ $# -gt 0 ]; do
                case "${1}" in
                        --parent-device=*)
-                               PARENT_DEVICE=$(cli_get_val ${1})
+                               PARENT_DEVICE=$(cli_get_val "${1}")
                                ;;
                        --address=*)
-                               ADDRESS=$(cli_get_val ${1})
+                               ADDRESS=$(cli_get_val "${1}")
                                ;;
                        --tag=*)
-                               TAG=$(cli_get_val ${1})
+                               TAG=$(cli_get_val "${1}")
                                ;;
                        *)
                                warning "Unknown argument '${1}'"
@@ -68,22 +72,22 @@ function hook_new() {
 
        local port="${PARENT_DEVICE}${VLAN_PORT_INTERFIX}${TAG}"
 
-       port_settings_write "${port}" ${HOOK_SETTINGS}
+       port_settings_write "${port}"
 
        exit ${EXIT_OK}
 }
 
-function hook_edit() {
+hook_edit() {
        local port=${1}
        assert isset port
        shift
 
-       port_settings_read "${port}" ${HOOK_SETTINGS}
+       port_settings_read "${port}"
 
        while [ $# -gt 0 ]; do
                case "${1}" in
                        --address=*)
-                               ADDRESS=$(cli_get_val ${1})
+                               ADDRESS=$(cli_get_val "${1}")
                                ;;
                        *)
                                warning "Unknown argument '${1}'"
@@ -92,19 +96,19 @@ function hook_edit() {
                shift
        done
 
-       port_settings_write "${port}" ${HOOK_SETTINGS}
+       port_settings_write "${port}"
 
        exit ${EXIT_OK} 
 }
 
-function hook_create() {
+hook_create() {
        local port="${1}"
        assert isset port
 
        device_exists "${port}" && exit ${EXIT_OK}
 
        # Read configruation
-       port_settings_read "${port}" ${HOOK_SETTINGS}
+       port_settings_read "${port}"
 
        # Create the VLAN device
        vlan_create "${port}" "${PARENT_DEVICE}" "${TAG}" "${ADDRESS}"
@@ -112,7 +116,7 @@ function hook_create() {
        exit ${EXIT_OK}
 }
 
-function hook_remove() {
+hook_remove() {
        local port="${1}"
        assert isset port