]> git.ipfire.org Git - people/ms/network.git/commitdiff
vlan: Convert hook to use parse_cmdline function
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 3 Jun 2019 09:55:35 +0000 (11:55 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 3 Jun 2019 09:55:35 +0000 (11:55 +0200)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/hooks/ports/vlan

index f5119864131d89e2ea5c1c91dbe8064fcb7e9031..69f5144cbcbdf5c33fb862d4ac3239af398fbfb3 100644 (file)
@@ -51,7 +51,14 @@ hook_check_settings() {
        done
 }
 
        done
 }
 
-hook_new() {
+hook_find_port_name() {
+       assert isset PARENT_DEVICE
+       assert isset TAG
+
+       print "${PARENT_DEVICE}${VLAN_PORT_INTERFIX}${TAG}"
+}
+
+hook_parse_cmdline() {
        while [ $# -gt 0 ]; do
                case "${1}" in
                        --parent-device=*)
        while [ $# -gt 0 ]; do
                case "${1}" in
                        --parent-device=*)
@@ -63,42 +70,9 @@ hook_new() {
                        --tag=*)
                                TAG=$(cli_get_val "${1}")
                                ;;
                        --tag=*)
                                TAG=$(cli_get_val "${1}")
                                ;;
-                       *)
-                               warning "Unknown argument '${1}'"
-                               ;;
-               esac
-               shift
-       done
-
-       local port="${PARENT_DEVICE}${VLAN_PORT_INTERFIX}${TAG}"
-
-       port_settings_write "${port}"
-
-       exit ${EXIT_OK}
-}
-
-hook_edit() {
-       local port=${1}
-       assert isset port
-       shift
-
-       port_settings_read "${port}"
-
-       while [ $# -gt 0 ]; do
-               case "${1}" in
-                       --address=*)
-                               ADDRESS=$(cli_get_val "${1}")
-                               ;;
-                       *)
-                               warning "Unknown argument '${1}'"
-                               ;;
                esac
                shift
        done
                esac
                shift
        done
-
-       port_settings_write "${port}"
-
-       exit ${EXIT_OK} 
 }
 
 hook_create() {
 }
 
 hook_create() {