]> git.ipfire.org Git - people/stevee/network.git/commitdiff
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 d49d37ba8b1df2910ca81c2e546361068747db58..bd39d6d590a859d70d31cddfdda0321e5185866f 100644 (file)
@@ -142,6 +142,7 @@ dist_network_SCRIPTS = \
        src/functions/functions.routing \
        src/functions/functions.serial \
        src/functions/functions.service \
        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 \
        src/functions/functions.stp \
        src/functions/functions.sysctl \
        src/functions/functions.teredo \
index d8d8d4f2a64937681e520961516330e60bfbefdd..53ec1754809179cf39fee5cc83f54b4aa8fe4d67 100644 (file)
@@ -21,9 +21,9 @@
 
 . /usr/lib/network/functions
 
 
 . /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}
 
 exit ${EXIT_ERROR}
index 5de6bfa963d143c4504978709cfb0a237632a572..55eed2c3e9016424c86fb01954ad238baa2b805c 100644 (file)
@@ -21,8 +21,8 @@
 
 . /usr/lib/network/functions
 
 
 . /usr/lib/network/functions
 
-# Read firewall configuration.
-firewall_config_read
+# Read firewall settings
+firewall_settings_read
 
 firewall_cli "ipv4" "$@"
 
 
 firewall_cli "ipv4" "$@"
 
index 70ae2ffe85ca4f24d5520943bd4439d0936019fa..db7284cd87d757af23ac3836303985193a8d9f99 100644 (file)
@@ -21,8 +21,8 @@
 
 . /usr/lib/network/functions
 
 
 . /usr/lib/network/functions
 
-# Read firewall configuration.
-firewall_config_read
+# Read firewall settings
+firewall_settings_read
 
 firewall_cli "ipv6" "$@"
 
 
 firewall_cli "ipv6" "$@"
 
index 7d3557d22104d42231dae81c5f050fe560354301..9e99f31acd389024cfce463cc512b477cf27bac3 100644 (file)
@@ -103,17 +103,17 @@ function firewall_cli_panic() {
        firewall_panic ${admin_hosts}
 }
 
        firewall_panic ${admin_hosts}
 }
 
-function firewall_cli_config() {
+function firewall_cli_settings() {
        if cli_help_requested $@; then
        if cli_help_requested $@; then
-               cli_show_man firewall-config
+               cli_show_man firewall-settings
                exit ${EXIT_OK}
        fi
 
        if [ -n "${1}" ]; then
                exit ${EXIT_OK}
        fi
 
        if [ -n "${1}" ]; then
-               config_set "$@"
-               firewall_config_write
+               settings_set "$@"
+               firewall_settings_write
        else
        else
-               firewall_config_print
+               firewall_settings_print
        fi
 }
 
        fi
 }
 
index a625c0fdef0ccb75990ac1c72e096b9fb3857be8..ab1dadc4a2ab513c3293d2bf33879b3d59578aa2 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
 function config_header() {
        local what=${1}
        assert isset what
@@ -194,57 +51,3 @@ function config_domainname() {
        # the domain part.
        print "${hostname#*.}"
 }
        # 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 3f570ea51ffcb29e58018bca67aa9ba12ce72e5f..c9ad263a592a6889bd8eca06c352e15044322a2e 100644 (file)
@@ -34,8 +34,8 @@ NETWORK_ZONE_DIR="${NETWORK_CONFIG_DIR}"
 NETWORK_HOOKS_DIR=/usr/lib/network/hooks
 
 # Network file configuration.
 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
 CONFIG_HOSTNAME="/etc/hostname"
 
 RED_DB_DIR=${RUN_DIR}/red
index 75153eaf1e7066b05fc59e9ce8217f686cfb2ad7..51272e907a7564254d2963514740a53a075bd7f8 100644 (file)
@@ -359,7 +359,7 @@ function dhcpd_global_settings_read() {
        assert isset settings
 
        dhcpd_global_settings_defaults ${proto}
        assert isset settings
 
        dhcpd_global_settings_defaults ${proto}
-       config_read ${file} ${settings}
+       settings_read ${file} ${settings}
 }
 
 function dhcpd_global_settings_write() {
 }
 
 function dhcpd_global_settings_write() {
@@ -372,7 +372,7 @@ function dhcpd_global_settings_write() {
        local settings=$(dhcpd_settings ${proto})
        assert isset settings
 
        local settings=$(dhcpd_settings ${proto})
        assert isset settings
 
-       config_write ${file} ${settings}
+       settings_write ${file} ${settings}
 }
 
 function dhcpd_global_options_read() {
 }
 
 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})
 
        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
 
        # 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"
        # 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() {
 }
 
 function dhcpd_subnet_remove() {
@@ -610,7 +610,7 @@ function dhcpd_subnet_read() {
        assert isset id
 
        local file="$(dhcpd_subnet_path ${proto} ${id})/settings"
        assert isset id
 
        local file="$(dhcpd_subnet_path ${proto} ${id})/settings"
-       config_read ${file}
+       settings_read ${file}
 }
 
 function dhcpd_subnet_range_path() {
 }
 
 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
 
        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() {
 }
 
 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})
        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() {
 }
 
 function dhcpd_subnet_settings() {
@@ -931,7 +931,7 @@ function _dhcpd_read_options() {
        local options_list=${2}
        assert isset options_list
 
        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() {
 }
 
 function _dhcpd_write_subnet() {
index 2563f9ca6210ca21eebe15053b1759adc7d05a17..5f2e370fd1884c9dae9b1638cd246249ac7037d6 100644 (file)
 
 # Set this to true if localhost should be added as the first DNS server.
 DNS_USE_LOCAL_RESOLVER=true
 
 # 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
 
 # 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=""
 
 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.
 
 # Set this option to true if the DNS servers should be advertised by
 # radvd.
index 69129e38700f069cdada4c11c323414bfba1abaf..397b2bd0a2324478314647d4f615a83d1d9dc428 100644 (file)
@@ -56,7 +56,7 @@ function firewall_zone_read() {
        local file=$(firewall_zone_config ${zone})
        assert isset file
 
        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
 
        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
 
        local file=$(firewall_zone_config ${zone})
        assert isset file
 
-       config_write ${file} ${FIREWALL_ZONE_SETTINGS}
+       settings_write ${file} ${FIREWALL_ZONE_SETTINGS}
        return ${EXIT_OK}
 }
 
        return ${EXIT_OK}
 }
 
@@ -86,7 +86,7 @@ function firewall_zone_print() {
 
        (
                firewall_zone_read ${zone}
 
        (
                firewall_zone_read ${zone}
-               config_print ${FIREWALL_ZONE_SETTINGS}
+               settings_print ${FIREWALL_ZONE_SETTINGS}
        )
 
        return ${EXIT_OK}
        )
 
        return ${EXIT_OK}
index 198a08ba3694576e1102c41087c8b04971907958..836a377913e9650977eca7647da5252ac16955be 100644 (file)
@@ -37,24 +37,26 @@ function port_config_dir() {
        return ${EXIT_OK}
 }
 
        return ${EXIT_OK}
 }
 
-function port_config_read() {
-       local port=${1}
+function port_settings_read() {
+       local port="${1}"
        assert isset port
        assert isset port
+       shift
 
        # Save the HOOK variable.
        local hook="${HOOK}"
 
 
        # Save the HOOK variable.
        local hook="${HOOK}"
 
-       config_read $(port_file ${port})
+       settings_read "$(port_file "${port}")" "$@"
 
        # Restore hook.
        HOOK="${hook}"
 }
 
 
        # Restore hook.
        HOOK="${hook}"
 }
 
-function port_config_write() {
-       local port=${1}
+function port_settings_write() {
+       local port="${1}"
        assert isset port
        assert isset port
+       shift
 
 
-       config_write $(port_file ${port})
+       settings_write "$(port_file "${port}")" "$@"
 }
 
 function ports_get_all() {
 }
 
 function ports_get_all() {
@@ -68,7 +70,7 @@ function ports_get_all() {
 }
 
 function port_file() {
 }
 
 function port_file() {
-       local port=${1}
+       local port="${1}"
        assert isset port
 
        echo "$(port_dir)/${port}"
        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 9090056d670dde547fe543041dcb5aa9f3022507..50358816aa90c24d77238d936a29c4744edaa07f 100644 (file)
@@ -21,7 +21,7 @@
 
 # Sets the global wireless country code. Default is 00 = world.
 WIRELESS_REGULATORY_DOMAIN="00"
 
 # 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}
 
 function wireless_create() {
        local device=${1}
index 51351172d3b6d742d54da4a5ff4c7ef446f55650..55ca681dea2b88346ae4e6fd0dc9db152d5145b7 100644 (file)
@@ -543,35 +543,15 @@ function zone_config() {
        esac
 }
 
        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() {
 function zone_config_create() {
-       local zone=${1}
-       shift
-
+       local zone="${1}"
        assert isset zone
        assert isset zone
+       shift
 
 
-       local hook=$(zone_get_hook ${zone})
-
+       local hook=$(zone_get_hook "${zone}")
        assert isset hook
 
        assert isset hook
 
-       hook_zone_exec ${hook} config_create ${zone} $@
+       hook_zone_exec "${hook}" "config_create" "${zone}" "$@"
 }
 
 function zone_show() {
 }
 
 function zone_show() {
@@ -792,7 +772,7 @@ function zone_file() {
        echo "$(zone_dir ${zone})/settings"
 }
 
        echo "$(zone_dir ${zone})/settings"
 }
 
-function zone_config_read() {
+function zone_settings_read() {
        local zone=${1}
 
        assert isset zone
        local zone=${1}
 
        assert isset zone
@@ -800,21 +780,21 @@ function zone_config_read() {
        # Save the HOOK variable.
        local hook="${HOOK}"
 
        # Save the HOOK variable.
        local hook="${HOOK}"
 
-       config_read $(zone_file ${zone})
+       settings_read $(zone_file ${zone})
 
        # Restore hook.
        HOOK="${hook}"
 }
 
 
        # Restore hook.
        HOOK="${hook}"
 }
 
-function zone_config_write() {
+function zone_settings_write() {
        local zone=${1}
 
        assert isset zone
 
        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="$@"
        local zone=${1}
        shift
        local args="$@"
@@ -822,17 +802,17 @@ function zone_config_set() {
        assert isset zone
 
        (
        assert isset zone
 
        (
-               zone_config_read ${zone}
+               zone_settings_read ${zone}
 
                for arg in ${args}; do
                        eval "${arg}"
                done
        
 
                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}
 
        local zone=${1}
        local key=${2}
 
@@ -840,8 +820,62 @@ function zone_config_get() {
        assert isset key
 
        (
        assert isset key
 
        (
-               zone_config_read ${zone}
+               zone_settings_read ${zone}
 
                echo "${!key}"
        )
 }
 
                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 2e166a118f60b91cf6cdb48c48063b05a4df0dfe..cf4ef0de6113d2cf5c69f4d86cda82b579e5fa3d 100644 (file)
@@ -47,7 +47,7 @@ function hook_info() {
        assert isset port
        shift
 
        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
 
        local key val
        for key in PORT_PARENTS PORT_CHILDREN; do
index eaebd1b684f512daabaffce5e06c4e107cdf9dcc..b5ab3704b070c98829468341d65d98c63f5a0aa0 100644 (file)
@@ -28,11 +28,11 @@ function hook_create() {
        assert isset zone
        shift
 
        assert isset zone
        shift
 
-       config_read $(zone_dir ${zone})/settings
+       settings_read $(zone_dir ${zone})/settings
 
        hook_parse_cmdline $@
 
 
        hook_parse_cmdline $@
 
-       config_write $(zone_dir ${zone})/settings ${HOOK_SETTINGS}
+       settings_write $(zone_dir ${zone})/settings ${HOOK_SETTINGS}
 
        exit ${EXIT_OK}
 }
 
        exit ${EXIT_OK}
 }
index a01e7cd3d279e8a5b42aad95309754507d60f846..bd6d9746c73cf213b208905151e7ef3967f2f5ea 100644 (file)
@@ -21,6 +21,9 @@
 
 . /usr/lib/network/functions
 
 
 . /usr/lib/network/functions
 
+# Read network settings
+network_settings_read
+
 action="${1}"
 assert isset action
 
 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.
 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}
 
                config_dir="$(dirname ${config_file})"
                mkdir -p ${config_dir}
index c98d6a1beea4ba6c6aa3d162649c3fd070a9e4bd..720324cafdf7df8c9a2a1a7bbf1acfa965429ed7 100644 (file)
@@ -27,8 +27,8 @@ LOG_FACILITY=$(basename ${0})
 
 . /usr/lib/network/functions
 
 
 . /usr/lib/network/functions
 
-# Read network configuration.
-network_config_read
+# Read network settings
+network_settings_read
 
 zone=${1}
 assert isset zone
 
 zone=${1}
 assert isset zone
@@ -42,8 +42,8 @@ if ! zone_exists ${zone}; then
        exit ${EXIT_KERNEL_STP}
 fi
 
        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
 
 # Make sure STP is enabled for this zone.
 assert enabled STP
index 80692b033cdc94e898a39727fa7d238d7f53ac63..d02e148193501ba03aecf3538c4ab14c64cc5c5a 100644 (file)
@@ -21,6 +21,9 @@
 
 . /usr/lib/network/functions
 
 
 . /usr/lib/network/functions
 
+# Read network settings
+network_settings_read
+
 action=${1}
 assert isset action
 
 action=${1}
 assert isset action
 
index dba615d36bde12e0c043a1232b0d5319f07ea7c9..aea82c410ff4271590e4817c0a2fa6aba13495e7 100644 (file)
@@ -21,8 +21,8 @@
 
 . /usr/lib/network/functions
 
 
 . /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
 
 # Initialize kernel parameters for the firewall.
 firewall_kernel_init
index 5ad2d761c9392db94a9bde4af1f5f9ad1a3b5c48..cb12af0a3c122ab70d036d60534060e0db0c3a7f 100644 (file)
@@ -21,6 +21,9 @@
 
 . /usr/lib/network/functions
 
 
 . /usr/lib/network/functions
 
+# Read network settings
+network_settings_read
+
 action="${1}"
 assert isset action
 
 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.
 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}" \
 
                hostapd_config_write ${port} ${config_file} \
                        --broadcast-ssid="${BROADCAST_SSID}" \
index 6f522ca8f81a3ce04b3600eca3a7b58edd31d825..9fb172587ad524e0350526e7ee321ebb5f49bd60 100644 (file)
@@ -21,6 +21,9 @@
 
 . /usr/lib/network/functions
 
 
 . /usr/lib/network/functions
 
+# Read network settings
+network_settings_read
+
 action="${1}"
 assert isset action
 
 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.
 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}"
 
                teredo_write_config ${zone} ${config_file} \
                        --server="${SERVER}"
index 456fa66d6483ee35096fa018272a292d0b283f84..c8b42b53902ff065acb59c007f631db2b2f25c17 100644 (file)
@@ -23,6 +23,9 @@ LOG_FACILITY="miredo-helper"
 
 . /usr/lib/network/functions
 
 
 . /usr/lib/network/functions
 
+# Read network settings
+network_settings_read
+
 action="${STATE}"
 assert isset action
 
 action="${STATE}"
 assert isset action
 
index b2489d1bd7174fbb2fadf8fada593de887f93a33..678bf919b812c7496b54862d82eada85fe8dac49 100644 (file)
@@ -21,6 +21,9 @@
 
 . /usr/lib/network/functions
 
 
 . /usr/lib/network/functions
 
+# Read network settings
+network_settings_read
+
 function main() {
        local zone="${1}"
        assert isset zone
 function main() {
        local zone="${1}"
        assert isset zone
index 3d1aa947c5baf0c05117e841c3c93caf11fc9be1..e0465d0f998b958bddb29365554ccadfd11b30e7 100644 (file)
@@ -21,6 +21,9 @@
 
 . /usr/lib/network/functions
 
 
 . /usr/lib/network/functions
 
+# Read network settings
+network_settings_read
+
 zone="${1}"
 assert isset zone
 assert zone_exists ${zone}
 zone="${1}"
 assert isset zone
 assert zone_exists ${zone}
index 26805a979b78e5511399f98c4e745404f104e3dc..97f15aa70680ca7a308db326ed68cc8bfb6860e6 100644 (file)
@@ -21,6 +21,9 @@
 
 . /usr/lib/network/functions
 
 
 . /usr/lib/network/functions
 
+# Read network settings
+network_settings_read
+
 action="${1}"
 assert isset action
 
 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.
 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}" \
 
                wpa_supplicant_config_write ${zone} ${config_file} \
                        --mode="${ENCRYPTION}" \
index 783c122699ded9d2cefd83e552f8db1f23319be7..b24cb11c0cd62949cae07251b933ca03fa4a1fa5 100644 (file)
@@ -44,7 +44,7 @@ function hook_create() {
                shift
        done
 
                shift
        done
 
-       config_write $(zone_dir ${zone})/configs/${HOOK} ${HOOK_SETTINGS}
+       zone_config_settings_write "${zone}" "${HOOK}" ${HOOK_SETTINGS}
 
        exit ${EXIT_OK}
 }
 
        exit ${EXIT_OK}
 }
@@ -90,8 +90,8 @@ function hook_status() {
                error "Zone '${zone}' doesn't exist."
                exit ${EXIT_ERROR}
        fi
                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
 
        local status
        if dhclient_status ${zone} ipv4; then
index f56a5551352ed2c15073c4a7df643c76f34aff7d..9f9b3de38ca75c5ad0fca306425a2f25c939447a 100644 (file)
@@ -60,7 +60,7 @@ function hook_create() {
        fi
 
        # XXX maybe we can add some hashing to identify a configuration again
        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}
 }
 
        exit ${EXIT_OK}
 }
@@ -75,7 +75,7 @@ function hook_up() {
                exit ${EXIT_ERROR}
        fi
 
                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}
 
 
        ip_address_add ${zone} ${ADDRESS}/${PREFIX}
 
@@ -101,7 +101,7 @@ function hook_down() {
                exit ${EXIT_ERROR}
        fi
        
                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}
 
 
        ip_address_del ${zone} ${ADDRESS}/${PREFIX}
 
@@ -120,8 +120,8 @@ function hook_status() {
                error "Zone '${zone}' doesn't exist."
                exit ${EXIT_ERROR}
        fi
                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
 
        local status
        if zone_has_ip ${zone} ${ADDRESS}/${PREFIX}; then
index fb5513e0fbf967b8c9bebdb74a68711d34fbac41..c64ec8b0d6448235dcfc0dd50dd041f100e53df5 100644 (file)
@@ -59,7 +59,7 @@ function hook_create() {
                GATEWAY=$(ipv6_implode ${GATEWAY})
        fi
 
                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}
 }
 
        exit ${EXIT_OK}
 }
@@ -74,7 +74,7 @@ function hook_up() {
                exit ${EXIT_ERROR}
        fi
        
                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}
 
 
        ip_address_add ${zone} ${ADDRESS}/${PREFIX}
 
@@ -99,7 +99,7 @@ function hook_down() {
        # Remove routing information from database.
        routing_db_remove ${zone} ipv6
        
        # 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}
 
 
        ip_address_del ${zone} ${ADDRESS}/${PREFIX}
 
@@ -119,7 +119,7 @@ function hook_status() {
                exit ${EXIT_ERROR}
        fi
        
                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})
 
        # Make sure ADDRESS is as short as possible.
        ADDRESS=$(ipv6_implode ${ADDRESS})
index 9bf279a90ca349488878b8968cd98dd9ae61d3bb..f50ffbeba41562581b23bff29661e62561544a70 100644 (file)
@@ -65,7 +65,7 @@ function hook_create() {
                shift
        done
 
                shift
        done
 
-       config_write $(zone_dir ${zone})/configs/${HOOK} ${HOOK_SETTINGS}
+       zone_config_settings_write "${zone}" "${HOOK}" ${HOOK_SETTINGS}
 
        exit ${EXIT_OK}
 }
 
        exit ${EXIT_OK}
 }
@@ -106,8 +106,8 @@ function hook_status() {
                error "Zone '${zone}' doesn't exist."
                exit ${EXIT_ERROR}
        fi
                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
 
        local status
        if pppoe_server_status ${zone}; then
index 76e9250e6b635c5529fc70d01928f365c047cdf4..27cfd9f374c74cd327fbe6bae2902bac421a036d 100644 (file)
@@ -52,7 +52,7 @@ function hook_create() {
        local port=$(port_find_free ${PORT_PATTERN_BATMAN_ADV})
        assert isset port
 
        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}
 }
 
        exit ${EXIT_OK}
 }
@@ -62,7 +62,7 @@ function hook_edit() {
        assert isset port
        shift
 
        assert isset port
        shift
 
-       config_read $(port_file ${port})
+       port_settings_read "${port}"
 
        while [ $# -gt 0 ]; do
                case "${1}" in
 
        while [ $# -gt 0 ]; do
                case "${1}" in
@@ -89,7 +89,7 @@ function hook_edit() {
                shift
        done
 
                shift
        done
 
-       config_write $(port_file ${port}) ${HOOK_SETTINGS}
+       port_settings_write "${port}" ${HOOK_SETTINGS}
 
        exit ${EXIT_OK}
 }
 
        exit ${EXIT_OK}
 }
@@ -98,7 +98,7 @@ function hook_up() {
        local port=${1}
        assert isset port
 
        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.
 
        # 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
 
        local port=${1}
        assert isset port
 
-       config_read $(port_file ${port})
+       port_settings_read "${port}"
 
        local slave
        for slave in ${SLAVES}; do
 
        local slave
        for slave in ${SLAVES}; do
index b14351e052c52d18bfb58976004cc97532862b6e..129acb72eab7c95bfd41c1d42e673245d603ae2b 100644 (file)
@@ -75,7 +75,7 @@ function hook_create() {
        local port=$(port_find_free ${PORT_PATTERN_BATMAN_ADV_PORT})
        assert isset port
 
        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}
 }
 
        exit ${EXIT_OK}
 }
@@ -85,7 +85,7 @@ function hook_edit() {
        assert isset port
        shift
 
        assert isset port
        shift
 
-       config_read $(port_file ${port})
+       port_settings_read "${port}" ${HOOK_SETTINGS}
 
        while [ $# -gt 0 ]; do
                case "${1}" in
 
        while [ $# -gt 0 ]; do
                case "${1}" in
@@ -105,7 +105,7 @@ function hook_edit() {
                shift
        done
 
                shift
        done
 
-       config_write $(port_file ${port}) ${HOOK_SETTINGS}
+       port_settings_write "${port}" ${HOOK_SETTINGS}
 
        exit ${EXIT_OK}
 }
 
        exit ${EXIT_OK}
 }
@@ -114,7 +114,7 @@ function hook_up() {
        local port=${1}
        assert isset port
 
        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})
 
        # 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.
        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})
 
        # Get the address of the phy.
        local phy_address=$(phy_get_address ${phy})
index 355eece1d53ca10bd2d8050f0727ee43b2dbe45f..f21cebf95f4bb9b2fd066c275162d9b35b0ddd3b 100644 (file)
@@ -90,7 +90,7 @@ function hook_edit() {
        # Remove any whitespace
        SLAVES=$(echo ${SLAVES})
 
        # Remove any whitespace
        SLAVES=$(echo ${SLAVES})
 
-       port_config_write ${port} ${HOOK_SETTINGS}
+       port_settings_write "${port}" ${HOOK_SETTINGS}
 
        exit ${EXIT_OK}
 }
 
        exit ${EXIT_OK}
 }
@@ -99,7 +99,7 @@ function hook_up() {
        local device=${1}
        assert isset device
 
        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."
 
        if device_exists ${device}; then
                log DEBUG "Bonding device '${device}' does already exist."
index 3af50cd070951c36cd032bcdca2cce5b45a9c571..41b830b57eac14c32ba18a155faa70266bcacbe9 100644 (file)
@@ -48,7 +48,7 @@ function hook_create() {
        local port=$(port_find_free ${DUMMY_PORT_PATTERN})
        assert isset port
 
        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
 
                log INFO "New dummy port '${port}' has been created"
        fi
 
@@ -60,7 +60,7 @@ function hook_edit() {
        assert isset port
        shift
 
        assert isset port
        shift
 
-       config_read $(port_file ${port})
+       port_settings_read "${port}" ${HOOK_SETTINGS}
 
        while [ $# -gt 0 ]; do
                case "${1}" in
 
        while [ $# -gt 0 ]; do
                case "${1}" in
@@ -74,7 +74,7 @@ function hook_edit() {
                shift
        done
 
                shift
        done
 
-       config_write $(port_file ${port}) ${HOOK_SETTINGS}
+       port_settings_write "${port}" ${HOOK_SETTINGS}
 
        exit ${EXIT_OK} 
 }
 
        exit ${EXIT_OK} 
 }
@@ -83,7 +83,7 @@ function hook_up() {
        local port=${1}
        assert isset port
 
        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
 
        # 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
 
        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}'."
 
        if [ "${ADDRESS}" = "$(device_get_address ${device})" ]; then
                log DEBUG "Device '${device}' equals port '${port}'."
index 35a90bf9eef0d22bd5bd629b3fe6aa754bdc5a7e..35cc8eb3b3a358e182b3567dde6ad1cac9ef15ba 100644 (file)
@@ -42,7 +42,7 @@ function hook_create() {
        ADDRESS=""
        DEVICE=$(device_get_address ${port})
 
        ADDRESS=""
        DEVICE=$(device_get_address ${port})
 
-       config_write $(port_file ${port}) ${HOOK_SETTINGS}
+       port_settings_write "${port}" ${HOOK_SETTINGS}
 
        exit ${EXIT_OK}
 }
 
        exit ${EXIT_OK}
 }
@@ -52,7 +52,7 @@ function hook_up() {
        assert isset port
 
        # Read in the confguration file.
        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
 
        # 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.
        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})
 
        # Get the current MAC address of the device.
        local address=$(device_get_address ${device})
index 0214465ad9fa42a27509b6e35f6fcd04b2432a00..a4ce6850c92abc4aac197d02d16e31fa10e5300f 100644 (file)
@@ -51,7 +51,7 @@ function hook_create() {
        local port=$(port_find_free "${PARENT}${MACVLAN_PORT_INTERFIX}N")
        assert isset port
 
        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
 
                log INFO "New macvlan port '${port}' has been created."
        fi
 
@@ -63,7 +63,7 @@ function hook_edit() {
        assert isset port
        shift
 
        assert isset port
        shift
 
-       config_read $(port_file ${port})
+       port_settings_read "${port}" ${HOOK_SETTINGS}
 
        while [ $# -gt 0 ]; do
                case "${1}" in
 
        while [ $# -gt 0 ]; do
                case "${1}" in
@@ -77,7 +77,7 @@ function hook_edit() {
                shift
        done
 
                shift
        done
 
-       config_write $(port_file ${port}) ${HOOK_SETTINGS}
+       port_settings_write "${port}" ${HOOK_SETTINGS}
 
        exit ${EXIT_OK} 
 }
 
        exit ${EXIT_OK} 
 }
@@ -86,7 +86,7 @@ function hook_up() {
        local port=${1}
        assert isset port
 
        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
 
        # Create device if not already exists.
        if ! device_exists ${port}; then
@@ -101,7 +101,7 @@ function hook_down() {
 
        assert isset port
 
 
        assert isset port
 
-       config_read $(port_file ${port})
+       port_settings_read "${port}" ${HOOK_SETTINGS}
 
        if ! device_exists ${port}; then
                exit ${EXIT_OK}
 
        if ! device_exists ${port}; then
                exit ${EXIT_OK}
index 20550077fc3e8ab188709e855c76061da82149ed..5457c54445f86565786297a6a36ef9ffac002906 100644 (file)
@@ -68,7 +68,7 @@ function hook_create() {
 
        local port="${PARENT_DEVICE}${VLAN_PORT_INTERFIX}${TAG}"
 
 
        local port="${PARENT_DEVICE}${VLAN_PORT_INTERFIX}${TAG}"
 
-       config_write $(port_file ${port}) ${HOOK_SETTINGS}
+       port_settings_write "${port}" ${HOOK_SETTINGS}
 
        exit ${EXIT_OK}
 }
 
        exit ${EXIT_OK}
 }
@@ -78,7 +78,7 @@ function hook_edit() {
        assert isset port
        shift
 
        assert isset port
        shift
 
-       config_read $(port_file ${port})
+       port_settings_read "${port}" ${HOOK_SETTINGS}
 
        while [ $# -gt 0 ]; do
                case "${1}" in
 
        while [ $# -gt 0 ]; do
                case "${1}" in
@@ -92,7 +92,7 @@ function hook_edit() {
                shift
        done
 
                shift
        done
 
-       config_write $(port_file ${port}) ${HOOK_SETTINGS}
+       port_settings_write "${port}" ${HOOK_SETTINGS}
 
        exit ${EXIT_OK} 
 }
 
        exit ${EXIT_OK} 
 }
@@ -103,7 +103,7 @@ function hook_up() {
 
        if ! device_exists ${port}; then
                # Read configuration file.
 
        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
 
                vlan_create ${port} ${PARENT_DEVICE} ${TAG} ${ADDRESS}
        fi
index ba8a7fd529e145709ff80260edc18912c4b4ea8e..90a72d096f970f6429467b23c97d2da502a97268 100644 (file)
@@ -94,7 +94,7 @@ function hook_create() {
        local port=$(port_find_free ${PORT_PATTERN_ACCESSPOINT})
        assert isset port
 
        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}
 }
 
        exit ${EXIT_OK}
 }
@@ -105,7 +105,7 @@ function hook_edit() {
 
        assert isset port
 
 
        assert isset port
 
-       config_read $(port_file ${port})
+       port_settings_read "${port}" ${HOOK_SETTINGS}
 
        while [ $# -gt 0 ]; do
                case "${1}" in
 
        while [ $# -gt 0 ]; do
                case "${1}" in
@@ -134,7 +134,7 @@ function hook_edit() {
                shift
        done
 
                shift
        done
 
-       config_write $(port_file ${port}) ${HOOK_SETTINGS}
+       port_settings_write "${port}" ${HOOK_SETTINGS}
 
        exit ${EXIT_OK} 
 }
 
        exit ${EXIT_OK} 
 }
@@ -143,7 +143,7 @@ function hook_up() {
        local port=${1}
        assert isset port
 
        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})
 
        # 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.
        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})
 
        # Get the address of the phy.
        local phy_address=$(phy_get_address ${phy})
index 8dc94a8834bac188c18db92ef26785bd3fbc1e94..2777c9076e1dc73995159ae0e7150d7653a3641b 100644 (file)
@@ -46,7 +46,7 @@ function hook_check() {
                LOCAL_ADDRESS="${PUBLIC_ADDRESS}"
        fi
 
                LOCAL_ADDRESS="${PUBLIC_ADDRESS}"
        fi
 
-        assert isset LOCAL_ADDRESS
+       assert isset LOCAL_ADDRESS
 
        # Check input.
        if ! ipv6_is_valid "${SIX_RD_PREFIX}"; then
 
        # Check input.
        if ! ipv6_is_valid "${SIX_RD_PREFIX}"; then
@@ -101,7 +101,7 @@ function hook_up() {
        assert isset zone
 
        # Read configuration options.
        assert isset zone
 
        # Read configuration options.
-       zone_config_read "${zone}"
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        # Configure the tunnel.
        if ! device_exists "${zone}"; then
 
        # Configure the tunnel.
        if ! device_exists "${zone}"; then
@@ -150,7 +150,7 @@ function hook_status() {
 
        cli_device_headline ${zone}
 
 
        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})
 
        local server_line="${SERVER_ADDRESS}"
        local server_hostname=$(dns_get_hostname ${SERVER_ADDRESS})
index 450b7b9399db6d26514d6d497b530a7fe13032d0..898d89853c452511feb2727d78bca975cba36f67 100644 (file)
@@ -102,7 +102,7 @@ function hook_up() {
        assert isset zone
 
        # Read configuration options.
        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"
 
        if enabled AUTO_UPDATE_ENDPOINT; then
                log DEBUG "Updating tunnel endpoint"
@@ -156,7 +156,7 @@ function hook_status() {
 
        cli_device_headline ${zone}
 
 
        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})
 
        local server_line="${SERVER_ADDRESS}"
        local server_hostname=$(dns_get_hostname ${SERVER_ADDRESS})
index e31f897775180184bc0deedd858bbfc023ff26bb..86030a4be77564c78e1c05d1d0472a3939899a98 100644 (file)
@@ -109,7 +109,7 @@ function hook_status() {
 
        cli_device_headline ${zone}
 
 
        cli_device_headline ${zone}
 
-       zone_config_read ${zone}
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        cli_headline 2 "Configuration"
        cli_print_fmt1 2 "User" "${USERNAME}"
 
        cli_headline 2 "Configuration"
        cli_print_fmt1 2 "User" "${USERNAME}"
index e0a56ea6f7fb74d7973744e217d1d6f76550e315..ed3fd42fd54fd028442eeca3c8c8069caeea7ed2 100644 (file)
@@ -84,7 +84,7 @@ function hook_up() {
        local zone=${1}
        assert isset zone
 
        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
 
        # 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}
 
        __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}'"
 
 
        log INFO "Port '${port}' has been added to zone '${zone}'"
 
@@ -250,12 +250,12 @@ function hook_port_edit() {
        local port="${2}"
        shift 2
 
        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}
 
 
        __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"
 
 
        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}'"
        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}
 }
 
        exit ${EXIT_OK}
 }
@@ -283,7 +283,7 @@ function hook_port_up() {
        local zone="${1}"
        local port="${2}"
 
        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}"
 
 
        port_up "${port}"
 
index d00706811bf10a7f127d6558ba2b5361521b789d..37f337bb9c87bfa827f36ed6719c6da19812da98 100644 (file)
@@ -123,7 +123,7 @@ function hook_up() {
 
        assert isset zone
 
 
        assert isset zone
 
-       zone_config_read ${zone}
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        assert [ -e "/dev/${DEVICE}" ]
 
 
        assert [ -e "/dev/${DEVICE}" ]
 
@@ -175,7 +175,7 @@ function hook_status() {
 
        cli_device_headline ${zone}
 
 
        cli_device_headline ${zone}
 
-       zone_config_read ${zone}
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        cli_headline 2 "Configuration:"
        cli_print_fmt1 2 "User" "${USER}"
 
        cli_headline 2 "Configuration:"
        cli_print_fmt1 2 "User" "${USER}"
index e9d12cde56cde2ba3559d72cfee5e54d6d2bc28e..9c2adcd0f1f0b508c62885194c65953563af6efa 100644 (file)
@@ -118,7 +118,7 @@ function hook_up() {
 
        assert isset zone
 
 
        assert isset zone
 
-       zone_config_read ${zone}
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        assert [ -e "/dev/${DEVICE}" ]
 
 
        assert [ -e "/dev/${DEVICE}" ]
 
@@ -191,7 +191,7 @@ function hook_status() {
 
        cli_device_headline ${zone}
 
 
        cli_device_headline ${zone}
 
-       zone_config_read ${zone}
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        cli_headline "  Configuration:"
        printf "${DEVICE_PRINT_LINE1}" "User:" "${USER}"
 
        cli_headline "  Configuration:"
        printf "${DEVICE_PRINT_LINE1}" "User:" "${USER}"
index e1ffa2a9b639c2199240ee59cfd60c42b80ab271..7e2e688211bc62462240d17c9877878b9538748e 100644 (file)
@@ -140,14 +140,14 @@ function hook_up() {
        assert isset zone
 
        # Load configuration file.
        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=""
 
        # 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
 
                        error "Could not unlock the SIM card. Removing PIN from settings."
                fi
 
@@ -179,7 +179,7 @@ function hook_status() {
 
        cli_device_headline ${zone}
 
 
        cli_device_headline ${zone}
 
-       zone_config_read ${zone}
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        cli_headline 2 "Configuration"
        cli_print_fmt1 2 "Username" "${USERNAME}"
 
        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.
        assert isset file
 
        # Read in the configuration files.
-       zone_config_read ${zone}
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        pppd_write_config ${file} \
                --interface="${zone}" \
 
        pppd_write_config ${file} \
                --interface="${zone}" \
index 3882a2b37ffd528af376d7d03e16b71ea7133c8d..a72a2a85c034b53402d31ba8bb39b5d7ea783f38 100644 (file)
@@ -105,7 +105,7 @@ function hook_up() {
        local zone=${1}
        assert isset zone
 
        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}")
 
        # Bring up the port.
        local port=$(__hook_get_port "${zone}")
@@ -121,7 +121,7 @@ function hook_down() {
        local zone=${1}
        assert isset zone
 
        local zone=${1}
        assert isset zone
 
-       zone_config_read ${zone}
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        # Stop the ppp daemon.
        pppd_stop ${zone}
 
        # Stop the ppp daemon.
        pppd_stop ${zone}
@@ -169,7 +169,7 @@ function hook_status() {
 
        cli_device_headline ${zone}
 
 
        cli_device_headline ${zone}
 
-       zone_config_read ${zone}
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        cli_headline 2 "Configuration"
        cli_print_fmt1 2 "Username" "${USERNAME}"
 
        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.
        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}")
 
        # 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
 
                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}
        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}'"
        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}
 }
 
        exit ${EXIT_OK}
 }
index f4121fa5a28b751088adbdf1940c9c9c732f0d93..5902a5b5a0466a04a0966152f4c5615bf1cedd30 100644 (file)
@@ -86,7 +86,7 @@ function hook_check() {
                        error "PREFIX is greater than 30."
                        exit ${EXIT_ERROR}
                fi
                        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
 
        # 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
 
        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
 
        # Check if a port will be used.
        if isset PORT; then
-
                # Bring up the port.
                log DEBUG "Bringing up port '${PORT}'."
                port_up "${PORT}"
                # 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
 
        local zone="${1}"
        assert isset zone
 
-       zone_config_read "${zone}"
+       zone_settings_read "${zone}" ${HOOK_SETTINGS}
 
        # Stop the ppp daemon.
        pppd_stop "${zone}"
 
 
        # Stop the ppp daemon.
        pppd_stop "${zone}"
 
-
        # Check if a port has been used.
        if isset PORT; then
        # 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.
                # 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}"
 
 
        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
 
        # 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.
        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"
 
        # Prepare the command line options for the pptp plugin.
        local pptp_commandline="pptp ${PEER_ADDRESS} --nolaunchpppd"
index ece306de8945e8c7b418e5360d33811c1886a8ae..6c5abe0016fe587841bc75bc123635283632903d 100644 (file)
@@ -71,7 +71,7 @@ function hook_status() {
        # Print a nice header.
        cli_device_headline ${zone}
 
        # 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}"
 
        cli_headline 2 "Configuration"
        cli_print_fmt1 2 "Server" "${SERVER}"
index f4b853a4b354feb29fa8b95f0bfdd6b787669d63..e376ab0c19e48020c3b2a4e2cb11afb52a7da071 100644 (file)
@@ -81,7 +81,7 @@ function hook_up() {
        assert isset zone
 
        # Read zone configuration.
        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.
 
        if ! device_exists ${zone}; then
                #  Create the wireless interface.
index 0425d7af1e19fb64d1782ee82725954845f1a3c3..336e9c38e5c7bd35dccb011c278b4f9be6cd41d1 100644 (file)
@@ -35,20 +35,20 @@ done
 
 . /usr/lib/network/functions
 
 
 . /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
        if cli_help_requested $@; then
-               cli_show_man network-config
+               cli_show_man network-settings
                exit ${EXIT_OK}
        fi
 
        if [ -n "${1}" ]; then
                exit ${EXIT_OK}
        fi
 
        if [ -n "${1}" ]; then
-               config_set $@
-               network_config_write
+               settings_set $@
+               network_settings_write
        else
        else
-               network_config_print
+               network_settings_print
        fi
 }
 
        fi
 }
 
@@ -1154,7 +1154,7 @@ case "${action}" in
                init_run
                ;;
 
                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} $@
                ;;
 
                cli_${action} $@
                ;;
 
index ccec5a272833ad62611ed0740ae590de04f56f55..640ad74bccb73ce9a86743418c6243885ccf281c 100644 (file)
@@ -26,6 +26,9 @@ LOG_DISABLE_STDOUT="true"
 
 . /usr/lib/network/functions
 
 
 . /usr/lib/network/functions
 
+# Read network settings
+network_settings_read
+
 log DEBUG "dialer called with arguments: $@"
 
 # The zone is an optional argument.
 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
 # 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.
 fi
 
 # The default speaker settings is on.
index 33da580edab1c17f5536d7b56101d743f8ba0c67..75dac188d3561c0163c911e12583c18fd0dbf219 100644 (file)
 LOG_FACILITY="pppoe-server"
 . /usr/lib/network/functions
 
 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.
 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"
 assert isset SUBNET
 
 pppd_options="${RUN_DIR}/${zone}/pppoe-server-options"
index 1b79bd0aa0233062aaed0e39fc1c628e86f80693..df791d387c0e515ce25aba4e776ff0d4ed171cf7 100644 (file)
@@ -21,8 +21,8 @@
 
 . /usr/lib/network/functions
 
 
 . /usr/lib/network/functions
 
-# Read network configuration.
-network_config_read
+# Read network settings
+network_settings_read
 
 # Setup logging.
 LOG_FACILITY="network-hotplug"
 
 # Setup logging.
 LOG_FACILITY="network-hotplug"
index 5aa2f64b1b3d9f1513487ffc2150abc7c8fb3cb5..84c03dedf1eb3e52a3f53806fbd03054a69cb8ad 100644 (file)
@@ -25,8 +25,8 @@ LOG_DISABLE_STDOUT="true"
 
 . /usr/lib/network/functions
 
 
 . /usr/lib/network/functions
 
-# Read network configuration.
-network_config_read
+# Read network settings
+network_settings_read
 
 # Setup the locking.
 LOCKFILE="${RUN_DIR}/.rename_lock"
 
 # Setup the locking.
 LOCKFILE="${RUN_DIR}/.rename_lock"
index cb40768ef189d8cf2421285644e4f5613a606bf9..61337022fd690e3244722d2d8d61898130e913ae 100644 (file)
@@ -27,8 +27,8 @@ LOG_FACILITY="network-hotplug-serial"
 # Associated hooks.
 ASSOCIATED_HOOKS="modem"
 
 # 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}'."
 
 
 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.
                        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
 
                        # If IMSIs match, we start that zone.
                        if [ "${zone_imsi}" = "${sim_imsi}" ]; then