Rename all "config" to "settings"
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 4 Sep 2014 18:13:15 +0000 (20:13 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 4 Sep 2014 18:13:15 +0000 (20:13 +0200)
55 files changed:
Makefile.am
src/firewall-config
src/firewall4
src/firewall6
src/functions/functions.cli.firewall
src/functions/functions.config
src/functions/functions.constants
src/functions/functions.dhcpd
src/functions/functions.dns
src/functions/functions.firewall-zones
src/functions/functions.ports
src/functions/functions.settings [new file with mode: 0644]
src/functions/functions.wireless
src/functions/functions.zone
src/header-port
src/header-zone
src/helpers/aiccu-config-helper
src/helpers/bridge-stp
src/helpers/dhcpd-config-helper
src/helpers/firewall-kernel-init
src/helpers/hostapd-config-helper
src/helpers/miredo-config-helper
src/helpers/miredo-helper
src/helpers/pppd-angel
src/helpers/wpa_supplicant
src/helpers/wpa_supplicant-config-helper
src/hooks/configs/ipv4-dhcp
src/hooks/configs/ipv4-static
src/hooks/configs/ipv6-static
src/hooks/configs/pppoe-server
src/hooks/ports/batman-adv
src/hooks/ports/batman-adv-port
src/hooks/ports/bonding
src/hooks/ports/dummy
src/hooks/ports/ethernet
src/hooks/ports/macvlan
src/hooks/ports/vlan
src/hooks/ports/wireless-ap
src/hooks/zones/6rd
src/hooks/zones/6to4-tunnel
src/hooks/zones/aiccu
src/hooks/zones/bridge
src/hooks/zones/isdn
src/hooks/zones/isdn-server
src/hooks/zones/modem
src/hooks/zones/pppoe
src/hooks/zones/pptp
src/hooks/zones/teredo
src/hooks/zones/wireless
src/network
src/ppp/dialer
src/ppp/pppoe-server
src/udev/network-hotplug
src/udev/network-hotplug-rename
src/udev/network-hotplug-serial

index d49d37b..bd39d6d 100644 (file)
@@ -142,6 +142,7 @@ dist_network_SCRIPTS = \
        src/functions/functions.routing \
        src/functions/functions.serial \
        src/functions/functions.service \
+       src/functions/functions.settings \
        src/functions/functions.stp \
        src/functions/functions.sysctl \
        src/functions/functions.teredo \
index d8d8d4f..53ec175 100644 (file)
@@ -21,9 +21,9 @@
 
 . /usr/lib/network/functions
 
-# Read firewall configuration.
-firewall_config_read
+# Read firewall settings
+firewall_settings_read
 
-firewall_cli_config "$@"
+firewall_cli_settings "$@"
 
 exit ${EXIT_ERROR}
index 5de6bfa..55eed2c 100644 (file)
@@ -21,8 +21,8 @@
 
 . /usr/lib/network/functions
 
-# Read firewall configuration.
-firewall_config_read
+# Read firewall settings
+firewall_settings_read
 
 firewall_cli "ipv4" "$@"
 
index 70ae2ff..db7284c 100644 (file)
@@ -21,8 +21,8 @@
 
 . /usr/lib/network/functions
 
-# Read firewall configuration.
-firewall_config_read
+# Read firewall settings
+firewall_settings_read
 
 firewall_cli "ipv6" "$@"
 
index 7d3557d..9e99f31 100644 (file)
@@ -103,17 +103,17 @@ function firewall_cli_panic() {
        firewall_panic ${admin_hosts}
 }
 
-function firewall_cli_config() {
+function firewall_cli_settings() {
        if cli_help_requested $@; then
-               cli_show_man firewall-config
+               cli_show_man firewall-settings
                exit ${EXIT_OK}
        fi
 
        if [ -n "${1}" ]; then
-               config_set "$@"
-               firewall_config_write
+               settings_set "$@"
+               firewall_settings_write
        else
-               firewall_config_print
+               firewall_settings_print
        fi
 }
 
index a625c0f..ab1dadc 100644 (file)
 #                                                                             #
 ###############################################################################
 
-function config_read() {
-       local file=${1}
-       assert isset file
-       shift
-
-       local valid_keys=$@
-
-       # Exit if the file cannot be read.
-       [ -r "${file}" ] || return ${EXIT_ERROR}
-
-       local line key val
-       while read -r line; do
-               case "${line}" in
-                       *=*)
-                               key=$(cli_get_key ${line})
-
-                               # If valid keys is set, key must be in the list.
-                               if [ -n "${valid_keys}" ]; then
-                                       if ! listmatch ${key} ${valid_keys}; then
-                                               log DEBUG "Ignoring configuration setting: ${key}"
-                                               continue
-                                       fi
-                               fi
-
-                               val=$(cli_get_val ${line})
-                               val=$(config_strip ${val})
-
-                               # Assign variable.
-                               printf -v ${key} "%s" "${val}"
-                               ;;
-                       *)
-                               log DEBUG "Invalid line in configuration file: ${line}"
-                               ;;
-               esac
-       done < ${file}
-}
-
-function config_read_array() {
-       local file=${1}
-       assert isset file
-       shift
-
-       local array=${1}
-       assert isset array
-       shift
-
-       local valid_keys=$@
-
-       # Exit if the file cannot be read.
-       [ -r "${file}" ] || return ${EXIT_ERROR}
-
-       local line key val
-       while read -r line; do
-               case "${line}" in
-                       *=*)
-                               key=$(cli_get_key ${line})
-
-                               # If valid_keys is set, key must be in the list.
-                               if [ -n "${valid_keys}" ]; then
-                                       if ! listmatch ${key} ${valid_keys}; then
-                                               log DEBUG "Ignoring configuration setting: ${key}"
-                                               continue
-                                       fi
-                               fi
-
-                               val=$(cli_get_val ${line})
-                               val=$(config_strip ${val})
-
-                               # Assign variable.
-                               printf -v  "${array}["${key}"]" "%s" "${val}"
-                               ;;
-                       *)
-                               log DEBUG "Invalid line in configuration file: ${line}"
-                               ;;
-               esac
-       done < ${file}
-}
-
-# Strip leading and trailing "s.
-function config_strip() {
-       local var="$@"
-
-       # Do nothing for strings that contain spaces.
-       if contains_spaces ${var}; then
-               print "${var}"
-               return ${EXIT_OK}
-       fi
-
-       unquote "${var}"
-}
-
-function config_write() {
-       local config_file=${1}
-       assert isset config_file
-       shift
-
-       # Check if all values to be written are sane
-       if ! config_check; then
-               log CRITICAL "Configuration check failed. No config has been written."
-               return ${EXIT_ERROR}
-       fi
-
-       log DEBUG "Writing configuration file ${config_file}."
-
-       mkdir -p $(dirname ${config_file}) 2>/dev/null
-       > ${config_file}
-
-       local param
-       for param in $(listsort $@); do
-               echo "${param}=\"${!param}\"" >> ${config_file}
-       done
-}
-
-function config_remove() {
-       local config_file="${1}"
-
-       local abspath="$(readlink -e "${config_file}")"
-       if [ "${config_file}" != "${abspath}" ]; then
-               log ERROR "Can only handle absolute paths"
-               return ${EXIT_ERROR}
-       fi
-
-       rm -f "${config_file}"
-}
-
-function config_print() {
-       local param
-
-       for param in $(listsort $@); do
-               printf "%-32s = %s\n" "${param}" "${!param}"
-       done
-}
-
-function config_check() {
-       # If there is a function defined that is called __check
-       # we call that function
-       if [ -n "$(type -t _check)" ]; then
-               _check || return $?
-       fi
-
-       return ${EXIT_OK}
-}
-
 function config_header() {
        local what=${1}
        assert isset what
@@ -194,57 +51,3 @@ function config_domainname() {
        # the domain part.
        print "${hostname#*.}"
 }
-
-function config_set() {
-       while [ $# -gt 0 ]; do
-               case "${1}" in
-                       *=*)
-                               local key=$(cli_get_key ${1})
-                               local val=$(cli_get_val ${1})
-
-                               log INFO "Setting configuration option '${key}=${val}'".
-
-                               printf -v ${key} "%s" "${val}"
-                               ;;
-                       *)
-                               warning "Invalid parameter given: ${1}"
-                               ;;
-               esac
-               shift
-       done
-}
-
-function network_config_read() {
-       local options=${NETWORK_CONFIG_FILE_PARAMS}
-
-       # If the DEBUG variable has already been set,
-       # don't overwrite it.
-       if [ -n "${DEBUG}" ]; then
-               list_remove options DEBUG
-       fi
-
-       config_read ${NETWORK_CONFIG_FILE} ${options}
-}
-
-function network_config_write() {
-       config_write ${NETWORK_CONFIG_FILE} ${NETWORK_CONFIG_FILE_PARAMS}
-
-       # Update DNS configuration.
-       dns_generate_resolvconf
-}
-
-function network_config_print() {
-       config_print ${NETWORK_CONFIG_FILE_PARAMS}
-}
-
-function firewall_config_read() {
-       config_read "${FIREWALL_CONFIG_FILE}" "${FIREWALL_CONFIG_PARAMS}"
-}
-
-function firewall_config_write() {
-       config_write "${FIREWALL_CONFIG_FILE}" "${FIREWALL_CONFIG_PARAMS}"
-}
-
-function firewall_config_print() {
-       config_print "${FIREWALL_CONFIG_PARAMS}"
-}
index 3f570ea..c9ad263 100644 (file)
@@ -34,8 +34,8 @@ NETWORK_ZONE_DIR="${NETWORK_CONFIG_DIR}"
 NETWORK_HOOKS_DIR=/usr/lib/network/hooks
 
 # Network file configuration.
-NETWORK_CONFIG_FILE=${NETWORK_CONFIG_DIR}/config
-NETWORK_CONFIG_FILE_PARAMS="DEBUG"
+NETWORK_SETTINGS_FILE=${NETWORK_CONFIG_DIR}/config
+NETWORK_SETTINGS_FILE_PARAMS="DEBUG"
 CONFIG_HOSTNAME="/etc/hostname"
 
 RED_DB_DIR=${RUN_DIR}/red
index 75153ea..51272e9 100644 (file)
@@ -359,7 +359,7 @@ function dhcpd_global_settings_read() {
        assert isset settings
 
        dhcpd_global_settings_defaults ${proto}
-       config_read ${file} ${settings}
+       settings_read ${file} ${settings}
 }
 
 function dhcpd_global_settings_write() {
@@ -372,7 +372,7 @@ function dhcpd_global_settings_write() {
        local settings=$(dhcpd_settings ${proto})
        assert isset settings
 
-       config_write ${file} ${settings}
+       settings_write ${file} ${settings}
 }
 
 function dhcpd_global_options_read() {
@@ -382,7 +382,7 @@ function dhcpd_global_options_read() {
        local options_file=$(dhcpd_options_file ${proto})
        local options_list=$(dhcpd_options_list ${proto})
 
-       config_read_array ${options_file} options ${!options_list}
+       settings_read_array ${options_file} options ${!options_list}
 
        # Check if domain-name is set.
        if [ -z "${options["domain-name"]}" ]; then
@@ -566,7 +566,7 @@ function dhcpd_subnet_edit() {
        # XXX Check for subnet collisions!
 
        local file="$(dhcpd_subnet_path ${proto} ${id})/settings"
-       config_write ${file} ${settings}
+       settings_write ${file} ${settings}
 }
 
 function dhcpd_subnet_remove() {
@@ -610,7 +610,7 @@ function dhcpd_subnet_read() {
        assert isset id
 
        local file="$(dhcpd_subnet_path ${proto} ${id})/settings"
-       config_read ${file}
+       settings_read ${file}
 }
 
 function dhcpd_subnet_range_path() {
@@ -773,7 +773,7 @@ function dhcpd_subnet_range_edit() {
        local file=$(dhcpd_subnet_range_path ${proto} ${subnet_id} ${range_id})
        assert isset file
 
-       config_write ${file} ${settings}
+       settings_write ${file} ${settings}
 }
 
 function dhcpd_subnet_range_remove() {
@@ -815,7 +815,7 @@ function dhcpd_subnet_range_read() {
        assert isset range_id
 
        local file=$(dhcpd_subnet_range_path ${proto} ${subnet_id} ${range_id})
-       config_read ${file}
+       settings_read ${file}
 }
 
 function dhcpd_subnet_settings() {
@@ -931,7 +931,7 @@ function _dhcpd_read_options() {
        local options_list=${2}
        assert isset options_list
 
-       config_read_array ${file} options ${!options_list}
+       setttings_read_array ${file} options ${!options_list}
 }
 
 function _dhcpd_write_subnet() {
index 2563f9c..5f2e370 100644 (file)
 
 # Set this to true if localhost should be added as the first DNS server.
 DNS_USE_LOCAL_RESOLVER=true
-NETWORK_CONFIG_FILE_PARAMS="${NETWORK_CONFIG_FILE_PARAMS} DNS_USE_LOCAL_RESOLVER"
+NETWORK_SETTINGS_FILE_PARAMS="${NETWORK_SETTINGS_FILE_PARAMS} DNS_USE_LOCAL_RESOLVER"
 
 # Set this option to true if the DNS servers should be queried in a random order.
 # This is useful to load balance between multiple servers.
 DNS_RANDOMIZE=false
-NETWORK_CONFIG_FILE_PARAMS="${NETWORK_CONFIG_FILE_PARAMS} DNS_RANDOMIZE"
+NETWORK_SETTINGS_FILE_PARAMS="${NETWORK_SETTINGS_FILE_PARAMS} DNS_RANDOMIZE"
 
 DNS_SEARCH_DOMAINS=""
-NETWORK_CONFIG_FILE_PARAMS="${NETWORK_CONFIG_FILE_PARAMS} DNS_SEARCH_DOMAINS"
+NETWORK_SETTINGS_FILE_PARAMS="${NETWORK_SETTINGS_FILE_PARAMS} DNS_SEARCH_DOMAINS"
 
 # Set this option to true if the DNS servers should be advertised by
 # radvd.
index 69129e3..397b2bd 100644 (file)
@@ -56,7 +56,7 @@ function firewall_zone_read() {
        local file=$(firewall_zone_config ${zone})
        assert isset file
 
-       config_read ${file} ${FIREWALL_ZONE_SETTINGS}
+       settings_read ${file} ${FIREWALL_ZONE_SETTINGS}
 
        local arg default
        for arg in ${FIREWALL_ZONE_SETTINGS}; do
@@ -76,7 +76,7 @@ function firewall_zone_write() {
        local file=$(firewall_zone_config ${zone})
        assert isset file
 
-       config_write ${file} ${FIREWALL_ZONE_SETTINGS}
+       settings_write ${file} ${FIREWALL_ZONE_SETTINGS}
        return ${EXIT_OK}
 }
 
@@ -86,7 +86,7 @@ function firewall_zone_print() {
 
        (
                firewall_zone_read ${zone}
-               config_print ${FIREWALL_ZONE_SETTINGS}
+               settings_print ${FIREWALL_ZONE_SETTINGS}
        )
 
        return ${EXIT_OK}
index 198a08b..836a377 100644 (file)
@@ -37,24 +37,26 @@ function port_config_dir() {
        return ${EXIT_OK}
 }
 
-function port_config_read() {
-       local port=${1}
+function port_settings_read() {
+       local port="${1}"
        assert isset port
+       shift
 
        # Save the HOOK variable.
        local hook="${HOOK}"
 
-       config_read $(port_file ${port})
+       settings_read "$(port_file "${port}")" "$@"
 
        # Restore hook.
        HOOK="${hook}"
 }
 
-function port_config_write() {
-       local port=${1}
+function port_settings_write() {
+       local port="${1}"
        assert isset port
+       shift
 
-       config_write $(port_file ${port})
+       settings_write "$(port_file "${port}")" "$@"
 }
 
 function ports_get_all() {
@@ -68,7 +70,7 @@ function ports_get_all() {
 }
 
 function port_file() {
-       local port=${1}
+       local port="${1}"
        assert isset port
 
        echo "$(port_dir)/${port}"
diff --git a/src/functions/functions.settings b/src/functions/functions.settings
new file mode 100644 (file)
index 0000000..52e519b
--- /dev/null
@@ -0,0 +1,217 @@
+#!/bin/bash
+###############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2014  IPFire Network Development Team                         #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
+
+function settings_read() {
+       local file=${1}
+       assert isset file
+       shift
+
+       local valid_keys=$@
+
+       # Exit if the file cannot be read.
+       [ -r "${file}" ] || return ${EXIT_ERROR}
+
+       local line key val
+       while read -r line; do
+               case "${line}" in
+                       *=*)
+                               key=$(cli_get_key ${line})
+
+                               # If valid keys is set, key must be in the list.
+                               if [ -n "${valid_keys}" ]; then
+                                       if ! listmatch ${key} ${valid_keys}; then
+                                               log DEBUG "Ignoring configuration setting: ${key}"
+                                               continue
+                                       fi
+                               fi
+
+                               val=$(cli_get_val ${line})
+                               val=$(settings_strip ${val})
+
+                               # Assign variable.
+                               printf -v ${key} "%s" "${val}"
+                               ;;
+                       *)
+                               log DEBUG "Invalid line in configuration file: ${line}"
+                               ;;
+               esac
+       done < ${file}
+}
+
+function settings_read_array() {
+       local file=${1}
+       assert isset file
+       shift
+
+       local array=${1}
+       assert isset array
+       shift
+
+       local valid_keys=$@
+
+       # Exit if the file cannot be read.
+       [ -r "${file}" ] || return ${EXIT_ERROR}
+
+       local line key val
+       while read -r line; do
+               case "${line}" in
+                       *=*)
+                               key=$(cli_get_key ${line})
+
+                               # If valid_keys is set, key must be in the list.
+                               if [ -n "${valid_keys}" ]; then
+                                       if ! listmatch ${key} ${valid_keys}; then
+                                               log DEBUG "Ignoring configuration setting: ${key}"
+                                               continue
+                                       fi
+                               fi
+
+                               val=$(cli_get_val ${line})
+                               val=$(settings_strip ${val})
+
+                               # Assign variable.
+                               printf -v  "${array}["${key}"]" "%s" "${val}"
+                               ;;
+                       *)
+                               log DEBUG "Invalid line in configuration file: ${line}"
+                               ;;
+               esac
+       done < ${file}
+}
+
+# Strip leading and trailing "s.
+function settings_strip() {
+       local var="$@"
+
+       # Do nothing for strings that contain spaces.
+       if contains_spaces ${var}; then
+               print "${var}"
+               return ${EXIT_OK}
+       fi
+
+       unquote "${var}"
+}
+
+function settings_write() {
+       local settings_file=${1}
+       assert isset settings_file
+       shift
+
+       # Check if all values to be written are sane
+       if ! settings_check; then
+               log CRITICAL "Configuration check failed. No settings have been written."
+               return ${EXIT_ERROR}
+       fi
+
+       log DEBUG "Writing settings file ${settings_file}."
+
+       mkdir -p $(dirname ${settings_file}) 2>/dev/null
+       > ${settings_file}
+
+       local param
+       for param in $(listsort $@); do
+               echo "${param}=\"${!param}\"" >> ${settings_file}
+       done
+}
+
+function settings_remove() {
+       local settings_file="${1}"
+
+       local abspath="$(readlink -e "${settings_file}")"
+       if [ "${settings_file}" != "${abspath}" ]; then
+               log ERROR "Can only handle absolute paths"
+               return ${EXIT_ERROR}
+       fi
+
+       rm -f "${settings_file}"
+}
+
+function settings_print() {
+       local param
+
+       for param in $(listsort $@); do
+               printf "%-32s = %s\n" "${param}" "${!param}"
+       done
+}
+
+function settings_check() {
+       # If there is a function defined that is called __check
+       # we call that function
+       if [ -n "$(type -t _check)" ]; then
+               _check || return $?
+       fi
+
+       return ${EXIT_OK}
+}
+
+function settings_set() {
+       while [ $# -gt 0 ]; do
+               case "${1}" in
+                       *=*)
+                               local key=$(cli_get_key ${1})
+                               local val=$(cli_get_val ${1})
+
+                               log INFO "Setting configuration option '${key}=${val}'".
+
+                               printf -v ${key} "%s" "${val}"
+                               ;;
+                       *)
+                               warning "Invalid parameter given: ${1}"
+                               ;;
+               esac
+               shift
+       done
+}
+
+function network_settings_read() {
+       local options="${NETWORK_SETTINGS_FILE_PARAMS}"
+
+       # If the DEBUG variable has already been set,
+       # don't overwrite it.
+       if [ -n "${DEBUG}" ]; then
+               list_remove options DEBUG
+       fi
+
+       settings_read "${NETWORK_SETTINGS_FILE}" ${options}
+}
+
+function network_settings_write() {
+       settings_write "${NETWORK_SETTINGS_FILE}" ${NETWORK_SETTINGS_FILE_PARAMS}
+
+       # Update DNS configuration.
+       dns_generate_resolvconf
+}
+
+function network_settings_print() {
+       settings_print ${NETWORK_SETTINGS_FILE_PARAMS}
+}
+
+function firewall_settings_read() {
+       settings_read "${FIREWALL_SETTINGS_FILE}" "${FIREWALL_SETTINGS_PARAMS}"
+}
+
+function firewall_settings_write() {
+       settings_write "${FIREWALL_SETTINGS_FILE}" "${FIREWALL_SETTINGS_PARAMS}"
+}
+
+function firewall_settings_print() {
+       settings_print "${FIREWALL_SETTINGS_PARAMS}"
+}
index 9090056..5035881 100644 (file)
@@ -21,7 +21,7 @@
 
 # Sets the global wireless country code. Default is 00 = world.
 WIRELESS_REGULATORY_DOMAIN="00"
-NETWORK_CONFIG_FILE_PARAMS="${NETWORK_CONFIG_FILE_PARAMS} WIRELESS_REGULATORY_DOMAIN"
+NETWORK_SETTINGS_FILE_PARAMS="${NETWORK_SETTINGS_FILE_PARAMS} WIRELESS_REGULATORY_DOMAIN"
 
 function wireless_create() {
        local device=${1}
index 5135117..55ca681 100644 (file)
@@ -543,35 +543,15 @@ function zone_config() {
        esac
 }
 
-function zone_config_option() {
-       local zone=${1}
-       local option=${2}
-       local default=${3}
-       shift 2
-
-       assert isset zone
-       assert isset option
-
-       (
-               VALUE="${default}"
-               zone_config_read ${zone}
-
-               VALUE="${!option}"
-               echo "${VALUE}"
-       )
-}
-
 function zone_config_create() {
-       local zone=${1}
-       shift
-
+       local zone="${1}"
        assert isset zone
+       shift
 
-       local hook=$(zone_get_hook ${zone})
-
+       local hook=$(zone_get_hook "${zone}")
        assert isset hook
 
-       hook_zone_exec ${hook} config_create ${zone} $@
+       hook_zone_exec "${hook}" "config_create" "${zone}" "$@"
 }
 
 function zone_show() {
@@ -792,7 +772,7 @@ function zone_file() {
        echo "$(zone_dir ${zone})/settings"
 }
 
-function zone_config_read() {
+function zone_settings_read() {
        local zone=${1}
 
        assert isset zone
@@ -800,21 +780,21 @@ function zone_config_read() {
        # Save the HOOK variable.
        local hook="${HOOK}"
 
-       config_read $(zone_file ${zone})
+       settings_read $(zone_file ${zone})
 
        # Restore hook.
        HOOK="${hook}"
 }
 
-function zone_config_write() {
+function zone_settings_write() {
        local zone=${1}
 
        assert isset zone
 
-       config_write $(zone_file ${zone}) ${HOOK_SETTINGS}
+       settings_write $(zone_file ${zone}) ${HOOK_SETTINGS}
 }
 
-function zone_config_set() {
+function zone_settings_set() {
        local zone=${1}
        shift
        local args="$@"
@@ -822,17 +802,17 @@ function zone_config_set() {
        assert isset zone
 
        (
-               zone_config_read ${zone}
+               zone_settings_read ${zone}
 
                for arg in ${args}; do
                        eval "${arg}"
                done
        
-               zone_config_write ${zone}
+               zone_settings_write ${zone}
        )
 }
 
-function zone_config_get() {
+function zone_settings_get() {
        local zone=${1}
        local key=${2}
 
@@ -840,8 +820,62 @@ function zone_config_get() {
        assert isset key
 
        (
-               zone_config_read ${zone}
+               zone_settings_read ${zone}
 
                echo "${!key}"
        )
 }
+
+function zone_config_settings_read() {
+       assert [ $# -gt 2 ]
+
+       local zone="${1}"
+       local config="${2}"
+       shift 2
+
+       local path="$(zone_dir "${zone}")/configs/${config}"
+       settings_read "${path}" "$@"
+}
+
+function zone_config_settings_write() {
+       assert [ $# -gt 2 ]
+
+       local zone="${1}"
+       local config="${2}"
+       shift 2
+
+       local path="$(zone_dir "${zone}")/configs/${config}"
+       settings_write "${path}" "$@"
+}
+
+function zone_port_settings_read() {
+       assert [ $# -gt 2 ]
+
+       local zone="${1}"
+       local port="${2}"
+       shift 2
+
+       local path="$(zone_dir "${zone}")/ports/${port}"
+       settings_read "${path}" "$@"
+}
+
+function zone_port_settings_write() {
+       assert [ $# -gt 2 ]
+
+       local zone="${1}"
+       local port="${2}"
+       shift 2
+
+       local path="$(zone_dir "${zone}")/ports/${port}"
+       settings_write "${path}" "$@"
+}
+
+function zone_port_settings_remove() {
+       assert [ $# -eq 2 ]
+
+       local zone="${1}"
+       local port="${2}"
+
+       local path="$(zone_dir "${zone}")/ports/${port}"
+       settings_remove "${path}"
+}
index 2e166a1..cf4ef0d 100644 (file)
@@ -47,7 +47,7 @@ function hook_info() {
        assert isset port
        shift
 
-       config_read "$(port_file ${port})"
+       settings_read "$(port_file ${port})"
 
        local key val
        for key in PORT_PARENTS PORT_CHILDREN; do
index eaebd1b..b5ab370 100644 (file)
@@ -28,11 +28,11 @@ function hook_create() {
        assert isset zone
        shift
 
-       config_read $(zone_dir ${zone})/settings
+       settings_read $(zone_dir ${zone})/settings
 
        hook_parse_cmdline $@
 
-       config_write $(zone_dir ${zone})/settings ${HOOK_SETTINGS}
+       settings_write $(zone_dir ${zone})/settings ${HOOK_SETTINGS}
 
        exit ${EXIT_OK}
 }
index a01e7cd..bd6d974 100644 (file)
@@ -21,6 +21,9 @@
 
 . /usr/lib/network/functions
 
+# Read network settings
+network_settings_read
+
 action="${1}"
 assert isset action
 
@@ -33,7 +36,7 @@ config_file="${RUN_DIR}/${zone}/aiccu.conf"
 case "${action}" in
        create)
                # Create the configuration file for this zone.
-               zone_config_read ${zone}
+               zone_settings_read "${zone}"
 
                config_dir="$(dirname ${config_file})"
                mkdir -p ${config_dir}
index c98d6a1..720324c 100644 (file)
@@ -27,8 +27,8 @@ LOG_FACILITY=$(basename ${0})
 
 . /usr/lib/network/functions
 
-# Read network configuration.
-network_config_read
+# Read network settings
+network_settings_read
 
 zone=${1}
 assert isset zone
@@ -42,8 +42,8 @@ if ! zone_exists ${zone}; then
        exit ${EXIT_KERNEL_STP}
 fi
 
-# Read zone configuration.
-zone_config_read ${zone}
+# Read zone settings
+zone_settings_read ${zone}
 
 # Make sure STP is enabled for this zone.
 assert enabled STP
index 80692b0..d02e148 100644 (file)
@@ -21,6 +21,9 @@
 
 . /usr/lib/network/functions
 
+# Read network settings
+network_settings_read
+
 action=${1}
 assert isset action
 
index dba615d..aea82c4 100644 (file)
@@ -21,8 +21,8 @@
 
 . /usr/lib/network/functions
 
-# Read firewall configuration.
-firewall_config_read
+# Read firewall settings
+firewall_setttings_read
 
 # Initialize kernel parameters for the firewall.
 firewall_kernel_init
index 5ad2d76..cb12af0 100644 (file)
@@ -21,6 +21,9 @@
 
 . /usr/lib/network/functions
 
+# Read network settings
+network_settings_read
+
 action="${1}"
 assert isset action
 
@@ -32,7 +35,7 @@ config_file="$(port_config_dir ${port})/hostapd.conf"
 case "${action}" in
        create)
                # Create the configuration file for this port.
-               port_config_read ${port} || exit $?
+               port_settings_read ${port} || exit $?
 
                hostapd_config_write ${port} ${config_file} \
                        --broadcast-ssid="${BROADCAST_SSID}" \
index 6f522ca..9fb1725 100644 (file)
@@ -21,6 +21,9 @@
 
 . /usr/lib/network/functions
 
+# Read network settings
+network_settings_read
+
 action="${1}"
 assert isset action
 
@@ -33,7 +36,7 @@ config_file="${RUN_DIR}/miredo/${zone}/client.conf"
 case "${action}" in
        create)
                # Create the configuration file for this zone.
-               zone_config_read ${zone}
+               zone_settings_read ${zone}
 
                teredo_write_config ${zone} ${config_file} \
                        --server="${SERVER}"
index 456fa66..c8b42b5 100644 (file)
@@ -23,6 +23,9 @@ LOG_FACILITY="miredo-helper"
 
 . /usr/lib/network/functions
 
+# Read network settings
+network_settings_read
+
 action="${STATE}"
 assert isset action
 
index b2489d1..678bf91 100644 (file)
@@ -21,6 +21,9 @@
 
 . /usr/lib/network/functions
 
+# Read network settings
+network_settings_read
+
 function main() {
        local zone="${1}"
        assert isset zone
index 3d1aa94..e0465d0 100644 (file)
@@ -21,6 +21,9 @@
 
 . /usr/lib/network/functions
 
+# Read network settings
+network_settings_read
+
 zone="${1}"
 assert isset zone
 assert zone_exists ${zone}
index 26805a9..97f15aa 100644 (file)
@@ -21,6 +21,9 @@
 
 . /usr/lib/network/functions
 
+# Read network settings
+network_settings_read
+
 action="${1}"
 assert isset action
 
@@ -33,7 +36,7 @@ config_file="$(wpa_supplicant_config_dir ${zone})/wpa_supplicant.conf"
 case "${action}" in
        create)
                # Create the configuration file for this zone.
-               zone_config_read ${zone} || exit $?
+               zone_settings_read ${zone} || exit $?
 
                wpa_supplicant_config_write ${zone} ${config_file} \
                        --mode="${ENCRYPTION}" \
index 783c122..b24cb11 100644 (file)
@@ -44,7 +44,7 @@ function hook_create() {
                shift
        done
 
-       config_write $(zone_dir ${zone})/configs/${HOOK} ${HOOK_SETTINGS}
+       zone_config_settings_write "${zone}" "${HOOK}" ${HOOK_SETTINGS}
 
        exit ${EXIT_OK}
 }
@@ -90,8 +90,8 @@ function hook_status() {
                error "Zone '${zone}' doesn't exist."
                exit ${EXIT_ERROR}
        fi
-       
-       config_read $(zone_dir ${zone})/configs/${config}
+
+       zone_config_settings_read "${zone}" "${config}" ${HOOK_SETTINGS}
 
        local status
        if dhclient_status ${zone} ipv4; then
index f56a555..9f9b3de 100644 (file)
@@ -60,7 +60,7 @@ function hook_create() {
        fi
 
        # XXX maybe we can add some hashing to identify a configuration again
-       config_write $(zone_dir ${zone})/configs/${HOOK}.$(uuid) ${HOOK_SETTINGS}
+       zone_config_settings_write "${zone}" "${HOOK}.$(uuid)" ${HOOK_SETTINGS}
 
        exit ${EXIT_OK}
 }
@@ -75,7 +75,7 @@ function hook_up() {
                exit ${EXIT_ERROR}
        fi
 
-       config_read $(zone_dir ${zone})/configs/${config}
+       zone_config_settings_read "${zone}" "${config}" ${HOOK_SETTINGS}
 
        ip_address_add ${zone} ${ADDRESS}/${PREFIX}
 
@@ -101,7 +101,7 @@ function hook_down() {
                exit ${EXIT_ERROR}
        fi
        
-       config_read $(zone_dir ${zone})/configs/${config}
+       zone_config_settings_read "${zone}" "${config}" ${HOOK_SETTINGS}
 
        ip_address_del ${zone} ${ADDRESS}/${PREFIX}
 
@@ -120,8 +120,8 @@ function hook_status() {
                error "Zone '${zone}' doesn't exist."
                exit ${EXIT_ERROR}
        fi
-       
-       config_read $(zone_dir ${zone})/configs/${config}
+
+       zone_config_settings_read "${zone}" "${config}" ${HOOK_SETTINGS}
 
        local status
        if zone_has_ip ${zone} ${ADDRESS}/${PREFIX}; then
index fb5513e..c64ec8b 100644 (file)
@@ -59,7 +59,7 @@ function hook_create() {
                GATEWAY=$(ipv6_implode ${GATEWAY})
        fi
 
-       config_write $(zone_dir ${zone})/configs/${HOOK}.$(ipv6_hash ${ADDRESS}).${PREFIX} ${HOOK_SETTINGS}
+       zone_config_settings_write "${zone}" "${HOOK}.$(ipv6_hash ${ADDRESS}).${PREFIX}" ${HOOK_SETTINGS}
 
        exit ${EXIT_OK}
 }
@@ -74,7 +74,7 @@ function hook_up() {
                exit ${EXIT_ERROR}
        fi
        
-       config_read $(zone_dir ${zone})/configs/${config}
+       zone_config_settings_read "${zone}" "${config}" ${HOOK_SETTINGS}
 
        ip_address_add ${zone} ${ADDRESS}/${PREFIX}
 
@@ -99,7 +99,7 @@ function hook_down() {
        # Remove routing information from database.
        routing_db_remove ${zone} ipv6
        
-       config_read $(zone_dir ${zone})/configs/${config}
+       zone_config_settings_read "${zone}" "${config}" ${HOOK_SETTINGS}
 
        ip_address_del ${zone} ${ADDRESS}/${PREFIX}
 
@@ -119,7 +119,7 @@ function hook_status() {
                exit ${EXIT_ERROR}
        fi
        
-       config_read $(zone_dir ${zone})/configs/${config}
+       zone_config_settings_read "${zone}" "${config}" ${HOOK_SETTINGS}
 
        # Make sure ADDRESS is as short as possible.
        ADDRESS=$(ipv6_implode ${ADDRESS})
index 9bf279a..f50ffbe 100644 (file)
@@ -65,7 +65,7 @@ function hook_create() {
                shift
        done
 
-       config_write $(zone_dir ${zone})/configs/${HOOK} ${HOOK_SETTINGS}
+       zone_config_settings_write "${zone}" "${HOOK}" ${HOOK_SETTINGS}
 
        exit ${EXIT_OK}
 }
@@ -106,8 +106,8 @@ function hook_status() {
                error "Zone '${zone}' doesn't exist."
                exit ${EXIT_ERROR}
        fi
-       
-       config_read $(zone_dir ${zone})/configs/${config}
+
+       zone_config_settings_read "${zone}" "${config}" ${HOOK_SETTINGS}
 
        local status
        if pppoe_server_status ${zone}; then
index 76e9250..27cfd9f 100644 (file)
@@ -52,7 +52,7 @@ function hook_create() {
        local port=$(port_find_free ${PORT_PATTERN_BATMAN_ADV})
        assert isset port
 
-       config_write $(port_file ${port}) ${HOOK_SETTINGS}
+       port_settings_write "${port}" ${HOOK_SETTINGS}
 
        exit ${EXIT_OK}
 }
@@ -62,7 +62,7 @@ function hook_edit() {
        assert isset port
        shift
 
-       config_read $(port_file ${port})
+       port_settings_read "${port}"
 
        while [ $# -gt 0 ]; do
                case "${1}" in
@@ -89,7 +89,7 @@ function hook_edit() {
                shift
        done
 
-       config_write $(port_file ${port}) ${HOOK_SETTINGS}
+       port_settings_write "${port}" ${HOOK_SETTINGS}
 
        exit ${EXIT_OK}
 }
@@ -98,7 +98,7 @@ function hook_up() {
        local port=${1}
        assert isset port
 
-       config_read $(port_file ${port})
+       port_settings_read "${port}" ${HOOK_SETTINGS}
 
        # This cannot be started manually, but is created automatically
        # when a slave device is brought up and set up by _hotplug.
@@ -124,7 +124,7 @@ function hook_down() {
        local port=${1}
        assert isset port
 
-       config_read $(port_file ${port})
+       port_settings_read "${port}"
 
        local slave
        for slave in ${SLAVES}; do
index b14351e..129acb7 100644 (file)
@@ -75,7 +75,7 @@ function hook_create() {
        local port=$(port_find_free ${PORT_PATTERN_BATMAN_ADV_PORT})
        assert isset port
 
-       config_write $(port_file ${port}) ${HOOK_SETTINGS}
+       port_settings_write "${port}" ${HOOK_SETTINGS}
 
        exit ${EXIT_OK}
 }
@@ -85,7 +85,7 @@ function hook_edit() {
        assert isset port
        shift
 
-       config_read $(port_file ${port})
+       port_settings_read "${port}" ${HOOK_SETTINGS}
 
        while [ $# -gt 0 ]; do
                case "${1}" in
@@ -105,7 +105,7 @@ function hook_edit() {
                shift
        done
 
-       config_write $(port_file ${port}) ${HOOK_SETTINGS}
+       port_settings_write "${port}" ${HOOK_SETTINGS}
 
        exit ${EXIT_OK}
 }
@@ -114,7 +114,7 @@ function hook_up() {
        local port=${1}
        assert isset port
 
-       config_read $(port_file ${port})
+       port_settings_read "${port}" ${HOOK_SETTINGS}
 
        # Check if the PHY is present.
        local phy=$(phy_get ${PHY})
@@ -175,7 +175,7 @@ function hook_hotplug() {
        assert port_exists ${port}
 
        # Read configuration of port.
-       config_read $(port_file ${port})
+       port_settings_read "${port}" ${HOOK_SETTINGS}
 
        # Get the address of the phy.
        local phy_address=$(phy_get_address ${phy})
index 355eece..f21cebf 100644 (file)
@@ -90,7 +90,7 @@ function hook_edit() {
        # Remove any whitespace
        SLAVES=$(echo ${SLAVES})
 
-       port_config_write ${port} ${HOOK_SETTINGS}
+       port_settings_write "${port}" ${HOOK_SETTINGS}
 
        exit ${EXIT_OK}
 }
@@ -99,7 +99,7 @@ function hook_up() {
        local device=${1}
        assert isset device
 
-       port_config_read ${device}
+       port_settings_read "${device}" ${HOOK_SETTINGS}
 
        if device_exists ${device}; then
                log DEBUG "Bonding device '${device}' does already exist."
index 3af50cd..41b830b 100644 (file)
@@ -48,7 +48,7 @@ function hook_create() {
        local port=$(port_find_free ${DUMMY_PORT_PATTERN})
        assert isset port
 
-       if config_write $(port_file ${port}) ${HOOK_SETTINGS}; then
+       if port_settings_write "${port}" ${HOOK_SETTINGS}; then
                log INFO "New dummy port '${port}' has been created"
        fi
 
@@ -60,7 +60,7 @@ function hook_edit() {
        assert isset port
        shift
 
-       config_read $(port_file ${port})
+       port_settings_read "${port}" ${HOOK_SETTINGS}
 
        while [ $# -gt 0 ]; do
                case "${1}" in
@@ -74,7 +74,7 @@ function hook_edit() {
                shift
        done
 
-       config_write $(port_file ${port}) ${HOOK_SETTINGS}
+       port_settings_write "${port}" ${HOOK_SETTINGS}
 
        exit ${EXIT_OK} 
 }
@@ -83,7 +83,7 @@ function hook_up() {
        local port=${1}
        assert isset port
 
-       config_read $(port_file ${port})
+       port_settings_read "${port}" ${HOOK_SETTINGS}
 
        # Create device if not already exists.
        if ! device_exists ${port}; then
@@ -120,7 +120,7 @@ function hook_hotplug_rename() {
        local device=${2}
        assert isset device
 
-       config_read $(port_file ${port})
+       port_settings_read "${port}" ${HOOK_SETTINGS}
 
        if [ "${ADDRESS}" = "$(device_get_address ${device})" ]; then
                log DEBUG "Device '${device}' equals port '${port}'."
index 35a90bf..35cc8eb 100644 (file)
@@ -42,7 +42,7 @@ function hook_create() {
        ADDRESS=""
        DEVICE=$(device_get_address ${port})
 
-       config_write $(port_file ${port}) ${HOOK_SETTINGS}
+       port_settings_write "${port}" ${HOOK_SETTINGS}
 
        exit ${EXIT_OK}
 }
@@ -52,7 +52,7 @@ function hook_up() {
        assert isset port
 
        # Read in the confguration file.
-       port_config_read ${port}
+       port_settings_read "${port}" ${HOOK_SETTINGS}
 
        # Check if the MAC address is the right one.
        if isset ADDRESS; then
@@ -83,7 +83,7 @@ function hook_hotplug_rename() {
        assert isset device
 
        # Read in the conifguration file.
-       port_config_read ${port}
+       port_settings_read "${port}" ${HOOK_SETTINGS}
 
        # Get the current MAC address of the device.
        local address=$(device_get_address ${device})
index 0214465..a4ce685 100644 (file)
@@ -51,7 +51,7 @@ function hook_create() {
        local port=$(port_find_free "${PARENT}${MACVLAN_PORT_INTERFIX}N")
        assert isset port
 
-       if config_write $(port_file ${port}) ${HOOK_SETTINGS}; then
+       if port_settings_write "${port}" ${HOOK_SETTINGS}; then
                log INFO "New macvlan port '${port}' has been created."
        fi
 
@@ -63,7 +63,7 @@ function hook_edit() {
        assert isset port
        shift
 
-       config_read $(port_file ${port})
+       port_settings_read "${port}" ${HOOK_SETTINGS}
 
        while [ $# -gt 0 ]; do
                case "${1}" in
@@ -77,7 +77,7 @@ function hook_edit() {
                shift
        done
 
-       config_write $(port_file ${port}) ${HOOK_SETTINGS}
+       port_settings_write "${port}" ${HOOK_SETTINGS}
 
        exit ${EXIT_OK} 
 }
@@ -86,7 +86,7 @@ function hook_up() {
        local port=${1}
        assert isset port
 
-       config_read $(port_file ${port})
+       port_settings_read "${port}" ${HOOK_SETTINGS}
 
        # Create device if not already exists.
        if ! device_exists ${port}; then
@@ -101,7 +101,7 @@ function hook_down() {
 
        assert isset port
 
-       config_read $(port_file ${port})
+       port_settings_read "${port}" ${HOOK_SETTINGS}
 
        if ! device_exists ${port}; then
                exit ${EXIT_OK}
index 2055007..5457c54 100644 (file)
@@ -68,7 +68,7 @@ function hook_create() {
 
        local port="${PARENT_DEVICE}${VLAN_PORT_INTERFIX}${TAG}"
 
-       config_write $(port_file ${port}) ${HOOK_SETTINGS}
+       port_settings_write "${port}" ${HOOK_SETTINGS}
 
        exit ${EXIT_OK}
 }
@@ -78,7 +78,7 @@ function hook_edit() {
        assert isset port
        shift
 
-       config_read $(port_file ${port})
+       port_settings_read "${port}" ${HOOK_SETTINGS}
 
        while [ $# -gt 0 ]; do
                case "${1}" in
@@ -92,7 +92,7 @@ function hook_edit() {
                shift
        done
 
-       config_write $(port_file ${port}) ${HOOK_SETTINGS}
+       port_settings_write "${port}" ${HOOK_SETTINGS}
 
        exit ${EXIT_OK} 
 }
@@ -103,7 +103,7 @@ function hook_up() {
 
        if ! device_exists ${port}; then
                # Read configuration file.
-               config_read $(port_file ${port}) ${HOOK_SETTINGS}
+               port_settings_read "${port}" ${HOOK_SETTINGS}
 
                vlan_create ${port} ${PARENT_DEVICE} ${TAG} ${ADDRESS}
        fi
index ba8a7fd..90a72d0 100644 (file)
@@ -94,7 +94,7 @@ function hook_create() {
        local port=$(port_find_free ${PORT_PATTERN_ACCESSPOINT})
        assert isset port
 
-       config_write $(port_file ${port}) ${HOOK_SETTINGS}
+       port_settings_write "${port}" ${HOOK_SETTINGS}
 
        exit ${EXIT_OK}
 }
@@ -105,7 +105,7 @@ function hook_edit() {
 
        assert isset port
 
-       config_read $(port_file ${port})
+       port_settings_read "${port}" ${HOOK_SETTINGS}
 
        while [ $# -gt 0 ]; do
                case "${1}" in
@@ -134,7 +134,7 @@ function hook_edit() {
                shift
        done
 
-       config_write $(port_file ${port}) ${HOOK_SETTINGS}
+       port_settings_write "${port}" ${HOOK_SETTINGS}
 
        exit ${EXIT_OK} 
 }
@@ -143,7 +143,7 @@ function hook_up() {
        local port=${1}
        assert isset port
 
-       config_read $(port_file ${port})
+       port_settings_read "${port}" ${HOOK_SETTINGS}
 
        # Check if the PHY is present.
        local phy=$(phy_get ${PHY})
@@ -195,7 +195,7 @@ function hook_hotplug() {
        assert port_exists ${port}
 
        # Read configuration of port.
-       config_read $(port_file ${port})
+       port_settings_read "${port}" ${HOOK_SETTINGS}
 
        # Get the address of the phy.
        local phy_address=$(phy_get_address ${phy})
index 8dc94a8..2777c90 100644 (file)
@@ -46,7 +46,7 @@ function hook_check() {
                LOCAL_ADDRESS="${PUBLIC_ADDRESS}"
        fi
 
-        assert isset LOCAL_ADDRESS
+       assert isset LOCAL_ADDRESS
 
        # Check input.
        if ! ipv6_is_valid "${SIX_RD_PREFIX}"; then
@@ -101,7 +101,7 @@ function hook_up() {
        assert isset zone
 
        # Read configuration options.
-       zone_config_read "${zone}"
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        # Configure the tunnel.
        if ! device_exists "${zone}"; then
@@ -150,7 +150,7 @@ function hook_status() {
 
        cli_device_headline ${zone}
 
-       zone_config_read ${zone}
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        local server_line="${SERVER_ADDRESS}"
        local server_hostname=$(dns_get_hostname ${SERVER_ADDRESS})
index 450b7b9..898d898 100644 (file)
@@ -102,7 +102,7 @@ function hook_up() {
        assert isset zone
 
        # Read configuration options.
-       zone_config_read ${zone}
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        if enabled AUTO_UPDATE_ENDPOINT; then
                log DEBUG "Updating tunnel endpoint"
@@ -156,7 +156,7 @@ function hook_status() {
 
        cli_device_headline ${zone}
 
-       zone_config_read ${zone}
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        local server_line="${SERVER_ADDRESS}"
        local server_hostname=$(dns_get_hostname ${SERVER_ADDRESS})
index e31f897..86030a4 100644 (file)
@@ -109,7 +109,7 @@ function hook_status() {
 
        cli_device_headline ${zone}
 
-       zone_config_read ${zone}
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        cli_headline 2 "Configuration"
        cli_print_fmt1 2 "User" "${USERNAME}"
index e0a56ea..ed3fd42 100644 (file)
@@ -84,7 +84,7 @@ function hook_up() {
        local zone=${1}
        assert isset zone
 
-       zone_config_read ${zone}
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        # Create the bridge if it does not already exist.
        if ! device_exists ${zone}; then
@@ -236,7 +236,7 @@ function hook_port_add() {
        __parse_cmdline_args "$@"
        [ $? -eq ${EXIT_OK} ] || return ${EXIT_ERROR}
 
-       config_write "$(zone_dir "${zone}")/ports/${port}" ${HOOK_PORT_SETTINGS}
+       zone_port_settings_write "${zone}" "${port}" ${HOOK_PORT_SETTINGS}
 
        log INFO "Port '${port}' has been added to zone '${zone}'"
 
@@ -250,12 +250,12 @@ function hook_port_edit() {
        local port="${2}"
        shift 2
 
-       config_read "$(zone_dir "${zone}")/ports/${port}" ${HOOK_PORT_SETTINGS}
+       zone_port_settings_read "${zone}" "${port}" ${HOOK_PORT_SETTINGS}
 
        __parse_cmdline_args "$@"
        [ $? -eq ${EXIT_OK} ] || return ${EXIT_ERROR}
 
-       config_write "$(zone_dir "${zone}")/ports/${port}" ${HOOK_PORT_SETTINGS}
+       zone_port_settings_write "${zone}" "${port}" ${HOOK_PORT_SETTINGS}
 
        log INFO "Port '${port}' (member of zone '${zone}') has been edited"
 
@@ -272,7 +272,7 @@ function hook_port_remove() {
        port_down "${port}"
 
        log INFO "Port '${port}' has been removed from zone '${zone}'"
-       config_remove "$(zone_dir "${zone}")/ports/${port}"
+       zone_port_settings_remove "${zone}" "${port}"
 
        exit ${EXIT_OK}
 }
@@ -283,7 +283,7 @@ function hook_port_up() {
        local zone="${1}"
        local port="${2}"
 
-       config_read "$(zone_dir "${zone}")/ports/${port}" ${HOOK_PORT_SETTINGS}
+       zone_port_settings_read "${zone}" "${port}" ${HOOK_PORT_SETTINGS}
 
        port_up "${port}"
 
index d007068..37f337b 100644 (file)
@@ -123,7 +123,7 @@ function hook_up() {
 
        assert isset zone
 
-       zone_config_read ${zone}
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        assert [ -e "/dev/${DEVICE}" ]
 
@@ -175,7 +175,7 @@ function hook_status() {
 
        cli_device_headline ${zone}
 
-       zone_config_read ${zone}
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        cli_headline 2 "Configuration:"
        cli_print_fmt1 2 "User" "${USER}"
index e9d12cd..9c2adcd 100644 (file)
@@ -118,7 +118,7 @@ function hook_up() {
 
        assert isset zone
 
-       zone_config_read ${zone}
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        assert [ -e "/dev/${DEVICE}" ]
 
@@ -191,7 +191,7 @@ function hook_status() {
 
        cli_device_headline ${zone}
 
-       zone_config_read ${zone}
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        cli_headline "  Configuration:"
        printf "${DEVICE_PRINT_LINE1}" "User:" "${USER}"
index e1ffa2a..7e2e688 100644 (file)
@@ -140,14 +140,14 @@ function hook_up() {
        assert isset zone
 
        # Load configuration file.
-       zone_config_read ${zone}
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        # If we have got a PIN, we try to unlock the device first.
        if isset PIN; then
                if ! modem_sim_auto_unlock "${DEVICE}" "${PIN}"; then
                        # Reset the PIN setting.
                        PIN=""
-                       config_write $(zone_dir ${zone})/settings ${HOOK_SETTINGS}
+                       zone_settings_write "${zone}" ${HOOK_SETTINGS}
                        error "Could not unlock the SIM card. Removing PIN from settings."
                fi
 
@@ -179,7 +179,7 @@ function hook_status() {
 
        cli_device_headline ${zone}
 
-       zone_config_read ${zone}
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        cli_headline 2 "Configuration"
        cli_print_fmt1 2 "Username" "${USERNAME}"
@@ -272,7 +272,7 @@ function hook_ppp_write_config() {
        assert isset file
 
        # Read in the configuration files.
-       zone_config_read ${zone}
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        pppd_write_config ${file} \
                --interface="${zone}" \
index 3882a2b..a72a2a8 100644 (file)
@@ -105,7 +105,7 @@ function hook_up() {
        local zone=${1}
        assert isset zone
 
-       zone_config_read ${zone}
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        # Bring up the port.
        local port=$(__hook_get_port "${zone}")
@@ -121,7 +121,7 @@ function hook_down() {
        local zone=${1}
        assert isset zone
 
-       zone_config_read ${zone}
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        # Stop the ppp daemon.
        pppd_stop ${zone}
@@ -169,7 +169,7 @@ function hook_status() {
 
        cli_device_headline ${zone}
 
-       zone_config_read ${zone}
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        cli_headline 2 "Configuration"
        cli_print_fmt1 2 "Username" "${USERNAME}"
@@ -227,7 +227,7 @@ function hook_ppp_write_config() {
        assert isset file
 
        # Read in the configuration files.
-       zone_config_read ${zone}
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        # A port has to be assigned for this action
        local port=$(__hook_get_port "${zone}")
@@ -295,7 +295,7 @@ function hook_port_add() {
                return ${EXIT_ERROR}
        fi
 
-       config_write "$(zone_dir "${zone}")/ports/${port}"
+       zone_port_settings_write "${zone}" "${port}"
        log INFO "Port '${port}' has been added to zone '${zone}'"
 
        exit ${EXIT_OK}
@@ -311,7 +311,7 @@ function hook_port_remove() {
        port_down "${port}"
 
        log INFO "Port '${port}' has been removed from zone '${zone}'"
-       config_remove "$(zone_dir "${zone}")/ports/${port}"
+       zone_port_settings_remove "${zone}" "${port}"
 
        exit ${EXIT_OK}
 }
index f4121fa..5902a5b 100644 (file)
@@ -86,7 +86,7 @@ function hook_check() {
                        error "PREFIX is greater than 30."
                        exit ${EXIT_ERROR}
                fi
-        fi
+       fi
 
        # Check if the peer-address is valid.
        if ! ipv4_is_valid "${PEER_ADDRESS}"; then
@@ -167,12 +167,10 @@ function hook_up() {
        local zone="${1}"
        assert isset zone
 
-
-       zone_config_read "${zone}"
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        # Check if a port will be used.
        if isset PORT; then
-
                # Bring up the port.
                log DEBUG "Bringing up port '${PORT}'."
                port_up "${PORT}"
@@ -197,15 +195,13 @@ function hook_down() {
        local zone="${1}"
        assert isset zone
 
-       zone_config_read "${zone}"
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        # Stop the ppp daemon.
        pppd_stop "${zone}"
 
-
        # Check if a port has been used.
        if isset PORT; then
-
                # Stop DHCP-Client or remove static IP address.
                if enabled USE_DHCP; then
                        # Stop dhclient for IPv4 on this zone.
@@ -229,7 +225,7 @@ function hook_status() {
 
        cli_device_headline "${zone}"
 
-       zone_config_read "${zone}"
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        # Display port configuration if a port is used.
        if isset PORT; then
@@ -287,7 +283,7 @@ function hook_ppp_write_config() {
        assert isset file
 
        # Read in the configuration files.
-       zone_config_read "${zone}"
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        # Prepare the command line options for the pptp plugin.
        local pptp_commandline="pptp ${PEER_ADDRESS} --nolaunchpppd"
index ece306d..6c5abe0 100644 (file)
@@ -71,7 +71,7 @@ function hook_status() {
        # Print a nice header.
        cli_device_headline ${zone}
 
-       zone_config_read ${zone}
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        cli_headline 2 "Configuration"
        cli_print_fmt1 2 "Server" "${SERVER}"
index f4b853a..e376ab0 100644 (file)
@@ -81,7 +81,7 @@ function hook_up() {
        assert isset zone
 
        # Read zone configuration.
-       zone_config_read ${zone}
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        if ! device_exists ${zone}; then
                #  Create the wireless interface.
index 0425d7a..336e9c3 100644 (file)
@@ -35,20 +35,20 @@ done
 
 . /usr/lib/network/functions
 
-# Read network configuration.
-network_config_read
+# Read network settings
+network_settings_read
 
-function cli_config() {
+function cli_settings() {
        if cli_help_requested $@; then
-               cli_show_man network-config
+               cli_show_man network-settings
                exit ${EXIT_OK}
        fi
 
        if [ -n "${1}" ]; then
-               config_set $@
-               network_config_write
+               settings_set $@
+               network_settings_write
        else
-               network_config_print
+               network_settings_print
        fi
 }
 
@@ -1154,7 +1154,7 @@ case "${action}" in
                init_run
                ;;
 
-       config|hostname|port|device|zone|start|stop|restart|status|reset|route)
+       settings|hostname|port|device|zone|start|stop|restart|status|reset|route)
                cli_${action} $@
                ;;
 
index ccec5a2..640ad74 100644 (file)
@@ -26,6 +26,9 @@ LOG_DISABLE_STDOUT="true"
 
 . /usr/lib/network/functions
 
+# Read network settings
+network_settings_read
+
 log DEBUG "dialer called with arguments: $@"
 
 # The zone is an optional argument.
@@ -35,7 +38,7 @@ assert isset ZONE
 # If we have the zone information, we will
 # load the zone configuration.
 if zone_exists ${ZONE}; then
-       zone_config_read ${ZONE}
+       zone_settings_read "${ZONE}"
 fi
 
 # The default speaker settings is on.
index 33da580..75dac18 100644 (file)
 LOG_FACILITY="pppoe-server"
 . /usr/lib/network/functions
 
+# Read network settings
+network_settings_read
+
 zone=${1}
 assert zone_exists ${zone}
 
 action=${2}
 
 # Read the configuration file of this hook.
-config_read $(zone_dir ${zone})/configs/pppoe-server
+zone_config_settings_read "${zone}" "pppoe-server"
 assert isset SUBNET
 
 pppd_options="${RUN_DIR}/${zone}/pppoe-server-options"
index 1b79bd0..df791d3 100644 (file)
@@ -21,8 +21,8 @@
 
 . /usr/lib/network/functions
 
-# Read network configuration.
-network_config_read
+# Read network settings
+network_settings_read
 
 # Setup logging.
 LOG_FACILITY="network-hotplug"
index 5aa2f64..84c03de 100644 (file)
@@ -25,8 +25,8 @@ LOG_DISABLE_STDOUT="true"
 
 . /usr/lib/network/functions
 
-# Read network configuration.
-network_config_read
+# Read network settings
+network_settings_read
 
 # Setup the locking.
 LOCKFILE="${RUN_DIR}/.rename_lock"
index cb40768..6133702 100644 (file)
@@ -27,8 +27,8 @@ LOG_FACILITY="network-hotplug-serial"
 # Associated hooks.
 ASSOCIATED_HOOKS="modem"
 
-# Read network configuration.
-network_config_read
+# Read network settings
+network_settings_read
 
 log DEBUG "Called with ACTION='${ACTION}', DEVNAME='${DEVNAME}'."
 
@@ -97,7 +97,7 @@ case "${ACTION}" in
                        list_match "${hook}" ${ASSOCIATED_HOOKS} || continue
 
                        # Read IMSI from zone configuration.
-                       zone_imsi="$(zone_config_option "${zone}" IMSI)"
+                       zone_imsi="$(zone_settings_get "${zone}" IMSI)"
 
                        # If IMSIs match, we start that zone.
                        if [ "${zone_imsi}" = "${sim_imsi}" ]; then