]> git.ipfire.org Git - people/ms/network.git/blobdiff - src/header-port
wireless-ap: Allow to disable DFS in configuration
[people/ms/network.git] / src / header-port
index 68cb62dec2e0b8f0340b171aa7402df76443471f..ce1c1923945adefd8879303f560944d8d88cddee 100644 (file)
@@ -21,6 +21,8 @@
 
 INFO_SETTINGS="HOOK PORT_PARENTS PORT_CHILDREN"
 
+HOOK_PORT_PATTERN="${PORT_PATTERN}"
+
 # This function is called after a device has been plugged
 # into the system and got its correct name.
 # The function is intended to create child ports and things
@@ -41,6 +43,7 @@ hook_hotplug_rename() {
 }
 
 hook_default_new() {
+       local ${HOOK_SETTINGS}
        if ! hook_parse_cmdline "$@"; then
                return ${EXIT_ERROR}
        fi
@@ -64,13 +67,25 @@ hook_default_edit() {
        assert isset port
        shift
 
-       port_settings_read "${port}" ${HOOK_SETTINGS}
+       # Read settings
+       if ! port_settings_read "${port}" ${HOOK_SETTINGS}; then
+               error "Could not read settings for port ${port}"
+               return ${EXIT_ERROR}
+       fi
 
+       # Parse command line arguments
        if ! hook_parse_cmdline "$@"; then
                return ${EXIT_ERROR}
        fi
 
-       port_settings_write "${port}" ${HOOK_SETTINGS}
+       # Save settings
+       if ! port_settings_write "${port}" ${HOOK_SETTINGS}; then
+               error "Could not write settings for port ${port}"
+               return ${EXIT_ERROR}
+       fi
+
+       # Apply settings
+       port_restart "${port}"
 
        return ${EXIT_OK}
 }