]> git.ipfire.org Git - people/ms/network.git/commitdiff
Replace routing_db_* by db_*
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 2 May 2015 20:06:03 +0000 (20:06 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 2 May 2015 20:06:03 +0000 (20:06 +0000)
db_* is an extremely simple and volatile key-value
database that can be used to store things at runtime.

18 files changed:
src/dhclient-script
src/functions/functions.constants
src/functions/functions.db
src/functions/functions.dhcpd
src/functions/functions.dns
src/functions/functions.ppp
src/functions/functions.radvd
src/functions/functions.routing
src/functions/functions.util
src/hooks/configs/ipv4-dhcp
src/hooks/configs/ipv4-static
src/hooks/configs/ipv6-dhcp
src/hooks/configs/ipv6-static
src/hooks/zones/6rd
src/hooks/zones/6to4-tunnel
src/hooks/zones/modem
src/hooks/zones/pppoe
src/network

index 5a6e8a3954c9bcc77ec77376ec4b1d176e4f05e2..5c22539f08abe75bb15cbebb7615a68cbb0d83ca 100644 (file)
@@ -60,15 +60,15 @@ case "${reason}" in
                                --valid-lifetime="${new_max_life}" --preferred-lifetime="${new_preferred_life}"
 
                        # Save configuration
-                       routing_db_set "${interface}" "ipv6" "local-ip-address" "${new_ip6_address}/${new_ip6_prefixlen}"
-                       routing_db_set "${interface}" "ipv6" "active" 1
-                       #routing_db_set "${interface}" "ipv6" "domain-name" "${new_
+                       db_set "${interface}/ipv6/local-ip-address" "${new_ip6_address}/${new_ip6_prefixlen}"
+                       db_set "${interface}/ipv6/active" 1
+                       #db_set "${interface}/ipv6/domain-name" "${new_
 
                        exit 0
 
                # Handle Prefix Delegation
                elif isset new_ip6_prefix; then
-                       routing_db_set "${interface}" "ipv6" "delegated-prefix" "${new_ip6_prefix}"
+                       db_set "${interface}/ipv6/delegated-prefix" "${new_ip6_prefix}"
 
                        exit 0
                fi
@@ -80,7 +80,7 @@ case "${reason}" in
                if isset new_ip6_address && isset new_ip6_prefixlen; then
                        # Update nameservers if those have changed
                        if [[ "${old_dhcp6_name_servers}" != "${new_dhcp6_name_servers}" ]]; then
-                               routing_db_set "${interface}" "ipv6" "domain-name-servers" "${new_dhcp6_name_servers}"
+                               db_set "${interface}/ipv6/domain-name-servers" "${new_dhcp6_name_servers}"
                                dns_generate_resolvconf
                        fi
 
@@ -97,6 +97,10 @@ case "${reason}" in
                                ipv6_address_del "${old_ip6_address}/${old_ip6_prefixlen}" "${interface}"
                        fi
 
+                       # Update the database
+                       db_set "${interface}/ipv6/local-ip-address" \
+                               "${new_ip6_address}/${new_ip6_prefixlen}"
+
                        # Add the new one
                        ipv6_address_add "${new_ip6_address}/${new_ip6_prefixlen}" "${interface}" \
                                --valid-lifetime="${new_max_life}" --preferred-lifetime="${new_preferred_life}"
@@ -111,7 +115,7 @@ case "${reason}" in
                        fi
 
                        log DEBUG "The delegated prefix has changed from ${old_ip6_prefix} to ${new_ip6_prefix}"
-                       routing_db_set "${interface}" "ipv6" "delegated-prefix" "${new_ip6_prefix}"
+                       db_set "${interface}/ipv6/delegated-prefix" "${new_ip6_prefix}"
 
                        exit ${EXIT_OK}
                fi
@@ -202,13 +206,16 @@ case "${reason}" in
                                        fi
 
                                        # Save configuration
-                                       routing_db_set ${interface} ipv4 type "ipv4-dhcp"
-                                       routing_db_set ${interface} ipv4 local-ip-address "${new_ip_address}/${new_prefix}"
-                                       routing_db_set ${interface} ipv4 remote-ip-address "${new_routers}"
-                                       routing_db_set ${interface} ipv4 active 1
-                                       routing_db_set ${interface} ipv4 domain-name "${new_domain_name}"
-                                       routing_db_set ${interface} ipv4 domain-name-servers "${new_domain_name_servers}"
-                                       routing_db_set ${interface} ipv4 domain-name-servers-priority "${DNS_SERVER_DYNAMIC_PRIORITY}"
+                                       db_set "${interface}/ipv4/type" "ipv4-dhcp"
+                                       db_set "${interface}/ipv4/local-ip-address" \
+                                               "${new_ip_address}/${new_prefix}"
+                                       db_set "${interface}/ipv4/remote-ip-address" "${new_routers}"
+                                       db_set "${interface}/ipv4/active" 1
+                                       db_set "${interface}/ipv4/domain-name" "${new_domain_name}"
+                                       db_set "${interface}/ipv4/domain-name-servers" \
+                                               "${new_domain_name_servers}"
+                                       db_set "${interface}/ipv4/domain-name-servers-priority" \
+                                               "${DNS_SERVER_DYNAMIC_PRIORITY}"
 
                                        # Update the routing tables.
                                        routing_update ${interface} ipv4
@@ -229,7 +236,7 @@ case "${reason}" in
                        ipv4_flush_device ${interface}
                fi
 
-               routing_db_remove ${interface} ipv4
+               db_delete "${interface}/ipv4"
                routing_default_update
 
                exit 0
index 4233f76f95b98be24413ce6e815d12214c760e73..eb7fe7d4bfbe5ffa9a7aca033bf12038ded400ef 100644 (file)
@@ -30,6 +30,7 @@ PPP_SECRETS=/etc/ppp/secrets
 
 # Network directory configuration.
 NETWORK_CONFIG_DIR="/etc/network"
+NETWORK_DB_DIR="${RUN_DIR}/db"
 NETWORK_ZONE_DIR="${NETWORK_CONFIG_DIR}"
 NETWORK_HOOKS_DIR=/usr/lib/network/hooks
 
index 251832cf46c463ea82672381e1ba4b064b3d021a..16f38626cfbf1f044c479950f6af1b63cbf9a4a4 100644 (file)
 #                                                                             #
 ###############################################################################
 
+_db_key2path() {
+       local key="${1}"
+       assert isset key
+
+       print "${NETWORK_DB_DIR}/${key}"
+}
+
+db_exists() {
+       local key="${1}"
+
+       local path="$(_db_key2path "${key}")"
+
+       if [ -e "${path}" ]; then
+               return ${EXIT_TRUE}
+       fi
+
+       return ${EXIT_FALSE}
+}
+
+db_get() {
+       local key="${1}"
+
+       local path="$(_db_key2path "${key}")"
+       fread "${path}"
+}
+
+db_set() {
+       local key="${1}"
+       shift
+
+       local value="$@"
+       local path="$(_db_key2path "${key}")"
+
+       if [ -r "${path}" ]; then
+               log DEBUG "Setting '${key}' = '${value}'"
+       else
+               log DEBUG "Adding '${key}' = '${value}'"
+       fi
+
+       make_parent_dir "${path}"
+       print "${value}" > "${path}"
+}
+
+db_delete() {
+       local key="${1}"
+
+       local path="$(_db_key2path "${key}")"
+
+       log DEBUG "Deleting key = '${key}'"
+
+       if [ -d "${path}" ]; then
+               _db_delete_recursive "${path}"
+       fi
+
+       rm -f - "${path}"
+}
+
+_db_delete_recursive() {
+       local path="${1}"
+
+       local key
+       for key in $(_db_list_path "${path}"); do
+               db_delete "${key}"
+       done
+
+       rmdir "${path}"
+}
+
+db_dump() {
+       _db_dump_recursive "${NETWORK_DB_DIR}"
+}
+
+_db_dump_key() {
+       local key="${1}"
+       local val="$(db_get "${key}")"
+
+       printf "%-38s = %s\n" "${key}" "${val}"
+}
+
+_db_dump_recursive() {
+       local path="${1}"
+
+       local key
+       for key in $(_db_list_path "${path}"); do
+               path="$(_db_key2path "${key}")"
+
+               if [ -d "${path}" ]; then
+                       _db_dump_recursive "${path}"
+               else
+                       _db_dump_key "${key}"
+               fi
+       done
+}
+
+_db_list_path() {
+       local path="${1}"
+
+       local element
+       for element in ${path}/*; do
+               [ -e "${element}" ] || continue
+
+               print "${element#${NETWORK_DB_DIR}/}"
+       done
+}
+
 db_connection_init() {
        if [ -e "${DB_CONNECTION_FILE}" ]; then
                return ${EXIT_OK}
index a3fd90602b88e2051c5f718af09c9ef65295c561..05e795222e4bad7e4df773cc003e37699778e119 100644 (file)
@@ -1032,7 +1032,7 @@ _dhcpd_search_routers() {
 
        local zone addr
        for zone in $(zones_get_all); do
-               addr=$(routing_db_get ${zone} ${proto} local-ip-address)
+               addr="$(db_get "${zone}/${proto}/local-ip-address")"
                isset addr || continue
 
                if ipv4_in_subnet ${addr} ${subnet}; then
index b3f42fd0e04609c8332187bf8cea3358db4b382f..de08c4c7aa592b553036ba5065ff4bb82c54524f 100644 (file)
@@ -269,7 +269,7 @@ dns_get_search_domains() {
 
        for zone in $(zones_get_all); do
                for proto in ${IP_SUPPORTED_PROTOCOLS}; do
-                       domain=$(routing_db_get ${zone} ${proto} domain-name)
+                       domain="$(db_get "${zone}/${proto}/domain-name")"
                        isset domain || continue
 
                        list_append search_domains "${domainname}"
@@ -285,10 +285,10 @@ dns_server_get_zone_name_servers() {
 
        for zone in $(zones_get_all); do
                for proto in ${IP_SUPPORTED_PROTOCOLS}; do
-                       priority=$(routing_db_get ${zone} ${proto} domain-name-servers-priority)
+                       priority="$(db_get "${zone}/${proto}/domain-name-servers-priority")"
                        isset priority || priority="${DNS_SERVER_DYNAMIC_PRIORITY}"
 
-                       servers=$(routing_db_get ${zone} ${proto} domain-name-servers)
+                       servers="$(db_get "${zone}/${proto}/domain-name-servers")"
                        for server in ${servers}; do
                                print "${priority} ${server}"
                        done
index 92ff353685f1fcab29b42513ca41c4a147336f6d..0840467c33d84114257235ebac52a34a8029610f 100644 (file)
@@ -275,7 +275,8 @@ ppp_common_ipv4_up() {
                return ${EXIT_ERROR}
        fi
 
-       routing_db_set ${zone} ipv4 active 1
+       db_set "${zone}/ipv4/active" 1
+
        routing_update ${zone} ipv4
        routing_default_update
 
@@ -293,7 +294,8 @@ ppp_common_ipv4_down() {
 
        # Remove the information about this zone from the routing database
        # and update the routing table.
-       routing_db_remove ${zone} ipv4
+       db_delete "${zone}/ipv4"
+
        routing_update ${zone} ipv4
        routing_default_update
 
@@ -315,7 +317,8 @@ ppp_common_ipv6_up() {
        # Add information about this zone to the routing database.
        routing_db_from_ppp ${zone} ipv6
 
-       routing_db_set ${zone} ipv6 active 1
+       db_set "${zone}/ipv6/active" 1
+
        routing_update ${zone} ipv6
        routing_default_update
 
@@ -333,7 +336,8 @@ ppp_common_ipv6_down() {
 
        # Remove the information about this zone from the routing database
        # and update the routing table.
-       routing_db_remove ${zone} ipv6
+       db_delete "${zone}/ipv6"
+
        routing_update ${zone} ipv6
        routing_default_update
 
index 21fd1e474035a5844d514a635062b54367626827..1a47b758a581a00bf7a32a3711bfad1255b981c1 100644 (file)
@@ -50,16 +50,16 @@ __radvd_config_interface() {
 
        # If the interface does not provide any routing information,
        # we can skip this whole stuff.
-       if ! routing_db_exists ${zone} ipv6; then
+       if ! db_exists "${zone}/ipv6"; then
                return ${EXIT_OK}
        fi
 
        # Skip if zone is not active.
-       local active=$(routing_db_get ${zone} ipv6 active)
+       local active="$(db_get "${zone}/ipv6/active")"
        [ "${active}" = "0" ] && return ${EXIT_OK}
 
        # Skip if there is no prefix or prefix is link-local.
-       local addr=$(routing_db_get ${zone} ipv6 local-ip-address)
+       local addr="$(db_get "${zone}/ipv6/local-ip-address")"
        if [ -z "${addr}" ] || [ "${addr:0:5}" = "fe80:" ]; then
                return ${EXIT_OK}
        fi
index d65506aadf4ca3a8901b89cb060a904307d9d4b3..0674cbd24adfd8faca55505db82c3ccdd0cea23c 100644 (file)
@@ -45,10 +45,10 @@ routing_default_update() {
 
                for zone in ${zones}; do
                        # Skip if zone is not up
-                       routing_db_exists ${zone} ${proto} || continue
+                       db_exists "${zone}/${proto}" || continue
 
-                       if [ "$(routing_db_get ${zone} ${proto} active)" = "1" ]; then
-                               gateway=$(routing_db_get ${zone} ${proto} remote-ip-address)
+                       if [ "$(db_get "${zone}/${proto}/active")" = "1" ]; then
+                               gateway="$(db_get "${zone}/${proto}/remote-ip-address")"
 
                                # Go on if the device is not there anymore.
                                device_exists ${zone} || continue
@@ -68,7 +68,7 @@ routing_default_update() {
                                fi
 
                                # Apply weight.
-                               weight=$(routing_db_get ${zone} ${proto} weight)
+                               weight="$(db_get "${zone}/${proto}/weight")"
                                if isinteger ${weight}; then
                                        routes="${routes} weight ${weight}"
                                fi
@@ -114,55 +114,6 @@ routing_table_create() {
        route_table_create $@
 }
 
-routing_db_path() {
-       local zone=${1}
-       local proto=${2}
-
-       assert isset zone
-       assert isset proto
-       assert isoneof proto ${IP_SUPPORTED_PROTOCOLS}
-
-       echo "${ROUTING_DB_DIR}/${zone}/${proto}"
-}
-
-routing_db_exists() {
-       [ -d "$(routing_db_path $@)" ]
-}
-
-routing_db_create() {
-       routing_db_exists $@ && return ${EXIT_OK}
-
-       mkdir -p $(routing_db_path $@)
-}
-
-routing_db_remove() {
-       rm -rf $(routing_db_path $@)
-}
-
-routing_db_set() {
-       local zone=${1}
-       local proto=${2}
-       local parameter=${3}
-       shift 3
-
-       local value="$@"
-
-       log INFO "Updating database (${zone} - ${proto}): ${parameter} = ${value}"
-
-       routing_db_create ${zone} ${proto}
-
-       echo "${value}" > $(routing_db_path ${zone} ${proto})/${parameter}
-}
-
-routing_db_get() {
-       local zone=${1}
-       local proto=${2}
-       local parameter=${3}
-       shift 3
-
-       cat $(routing_db_path ${zone} ${proto})/${parameter} 2>/dev/null
-}
-
 routing_db_from_ppp() {
        local zone=${1}
        local proto=${2}
@@ -171,19 +122,27 @@ routing_db_from_ppp() {
        assert isset proto
 
        # Save ppp configuration
-       routing_db_set ${zone} ${proto} type "ppp"
+       db_set "${zone}/${proto}/type" "ppp"
 
        if [ "${proto}" = "ipv6" ]; then
-               routing_db_set ${zone} ${proto} local-ip-address ${PPP_LLLOCAL}
-               routing_db_set ${zone} ${proto} remote-ip-address ${PPP_LLREMOTE}
+               db_set "${zone}/${proto}/local-ip-address" "${PPP_LLLOCAL}"
+               db_set "${zone}/${proto}/remote-ip-address" "${PPP_LLREMOTE}"
        elif [ "${proto}" = "ipv4" ]; then
-               routing_db_set ${zone} ${proto} local-ip-address ${PPP_IPLOCAL}
-               routing_db_set ${zone} ${proto} remote-ip-address ${PPP_IPREMOTE}
+               db_set "${zone}/${proto}/local-ip-address" "${PPP_IPLOCAL}"
+               db_set "${zone}/${proto}/remote-ip-address" "${PPP_IPREMOTE}"
        fi
 
-       routing_db_set ${zone} ${proto} dns ${PPP_DNS1} ${PPP_DNS2}
+       # Save the transmitted DNS servers
+       if isset PPP_DNS1 || isset PPP_DNS2; then
+               db_set "${zone}/${proto}/domain-name-servers" "${PPP_DNS1} ${PPP_DNS2}"
+       else
+               db_set "${zone}/${proto}/domain-name-servers"
+       fi
 
-       routing_db_set ${zone} ${proto} remote-address ${PPP_MACREMOTE,,}
+       # Save the MAC address of the remote DSLAM
+       if isset PPP_MACREMOTE; then
+               db_set "${zone}/${proto}/remote-address" "${PPP_MACREMOTE,,}"
+       fi
 }
 
 routing_update() {
@@ -211,12 +170,12 @@ routing_update() {
        cmd ${ip_cmd} route flush table ${table}
 
        # Exit here if there is no routing information.
-       if ! routing_db_exists ${zone} ${proto}; then
+       if ! db_exists "${zone}/${proto}"; then
                return ${EXIT_OK}
        fi
 
-       local local_ip_address=$(routing_db_get ${zone} ${proto} local-ip-address)
-       local remote_ip_address=$(routing_db_get ${zone} ${proto} remote-ip-address)
+       local local_ip_address="$(db_get "${zone}/${proto}/local-ip-address")"
+       local remote_ip_address="$(db_get "${zone}/${proto}/remote-ip-address")"
 
        case "${proto}" in
                ipv4)
index aff803a97ea7fa68962c499b8cc42d7a9f22eb3f..d26f519f4a43e0b1d348c9b395437d8554a8f891 100644 (file)
@@ -143,6 +143,13 @@ fwrite() {
        print "%s" "$@" >> ${file} 2>/dev/null
 }
 
+make_parent_dir() {
+       local path="${1}"
+
+       local dirname="$(dirname "${path}")"
+       mkdir -p "${dirname}"
+}
+
 enabled() {
        local param=${1}
 
index ea78d0969b49a27be0761f26beb289821a53f2ba..c3fa5008b298770d93dc70e95fa0a67e07570efe 100644 (file)
@@ -101,8 +101,8 @@ hook_status() {
        fi
        cli_statusline 3 "${HOOK}" "${status}"
 
-       cli_print_fmt1 3 "IPv4 address" "$(routing_db_get ${zone} ipv4 local-ip-address)"
-       local gateway=$(routing_db_get ${zone} ipv4 remote-ip-address)
+       cli_print_fmt1 3 "IPv4 address" "$(db_get "${zone}/ipv4/local-ip-address")"
+       local gateway="$(db_get "${zone}/ipv4/remote-ip-address")"
        if isset gateway; then
                cli_print_fmt1 3 "Gateway" "${gateway}"
        fi
index f8a21b83dac299c31673907c28c2f31554608945..7c9d94f968c6bdb111a3e889c47ab5e3ea0f43cf 100644 (file)
@@ -127,10 +127,10 @@ hook_up() {
        ip_address_add ${zone} ${ADDRESS}/${PREFIX}
 
        # Save configuration
-       routing_db_set ${zone} ipv4 type "${HOOK}"
-       routing_db_set ${zone} ipv4 local-ip-address "${ADDRESS}/${PREFIX}"
-       routing_db_set ${zone} ipv4 remote-ip-address "${GATEWAY}"
-       routing_db_set ${zone} ipv4 active 1
+       db_set "${zone}/ipv4/type" "${HOOK}"
+       db_set "${zone}/ipv4/local-ip-address" "${ADDRESS}/${PREFIX}"
+       db_set "${zone}/ipv4/remote-ip-address" "${GATEWAY}"
+       db_set "${zone}/ipv4/active" 1
 
        routing_update ${zone} ipv4
        routing_default_update
index 29a5f792bb75e01138a9070878916e5a536df1ec..1ea78b540d5326644001ba2d43666557afbd942a 100644 (file)
@@ -84,8 +84,8 @@ hook_status() {
        fi
        cli_statusline 3 "${HOOK}" "${status}"
 
-       cli_print_fmt1 3 "IPv6 address" "$(routing_db_get "${zone}" "ipv6" "local-ip-address")"
-       local gateway=$(routing_db_get ${zone} ipv6 remote-ip-address)
+       cli_print_fmt1 3 "IPv6 address" "$(db_get "${zone}/ipv6/local-ip-address")"
+       local gateway="$(db_get "${zone}/ipv6/remote-ip-address")"
        if isset gateway; then
                cli_print_fmt1 3 "Gateway" "${gateway}"
        fi
index f4f9ddf4b6d38ab24ad0bcbd6744b6f86a629782..adb4ddf64503d9d6f4c9d97218b683e545314711 100644 (file)
@@ -78,9 +78,10 @@ hook_up() {
 
        ip_address_add ${zone} ${ADDRESS}/${PREFIX}
 
-       routing_db_set ${zone} ipv6 local-ip-address ${ADDRESS}/${PREFIX}
-       routing_db_set ${zone} ipv6 remote-ip-address ${GATEWAY}
-       routing_db_set ${zone} ipv6 active 1
+       db_set "${zone}/ipv6/local-ip-address" "${ADDRESS}/${PREFIX}"
+       db_set "${zone}/ipv6/remote-ip-address" "${GATEWAY}"
+       db_set "${zone}/ipv6/active" 1
+
        routing_default_update
 
        exit ${EXIT_OK}
@@ -97,7 +98,7 @@ hook_down() {
        fi
 
        # Remove routing information from database.
-       routing_db_remove ${zone} ipv6
+       db_delete "${zone}/ipv6"
        
        zone_config_settings_read "${zone}" "${config}" ${HOOK_SETTINGS}
 
index 6ab94ad953de44a0c1512e6f99006cbb26b5d9f5..c8509f3a869eb5002ee57d62c5d9d12260506ef8 100644 (file)
@@ -117,10 +117,10 @@ hook_up() {
        device_set_up "${zone}"
 
        # Update routing information.
-       routing_db_set "${zone}" ipv6 "type" "${HOOK}"
-       routing_db_set "${zone}" ipv6 "local-ip-address" "::${LOCAL_ADDRESS}"
-       routing_db_set "${zone}" ipv6 "remote-ip-address" "::${SERVER_ADDRESS}"
-       routing_db_set "${zone}" ipv6 "active" 1
+       db_set "${zone}/ipv6/type" "${HOOK}"
+       db_set "${zone}/ipv6/local-ip-address" "::${LOCAL_ADDRESS}"
+       db_set "${zone}/ipv6/remote-ip-address" "::${SERVER_ADDRESS}"
+       db_set "${zone}/ipv6/active" 1
 
        # Update the routing database.
        routing_update ${zone} ipv6
@@ -134,7 +134,8 @@ hook_down() {
        assert isset zone
 
        # Remove everything from the routing db.
-       routing_db_remove ${zone} ipv6
+       db_delete "${zone}/ipv6"
+
        routing_update ${zone} ipv6
        routing_default_update
 
index fb8c449b70a220f5b554c6096d86d8a6c5f436a4..2a200e05b6a955eb570dfe271207d6cfde6e3ff7 100644 (file)
@@ -124,9 +124,9 @@ hook_up() {
        ip_address_add ${zone} ${LOCAL_ADDRESS6}
 
        # Update routing information.
-       routing_db_set ${zone} ipv6 type "${HOOK}"
-       routing_db_set ${zone} ipv6 local-ip-address "${LOCAL_ADDRESS6}"
-       routing_db_set ${zone} ipv6 active 1
+       db_set "${zone}/ipv6/type" "${HOOK}"
+       db_set "${zone}/ipv6/local-ip-address" "${LOCAL_ADDRESS6}"
+       db_set "${zone}/ipv6/active" 1
 
        # Update the routing database.
        routing_update ${zone} ipv6
@@ -140,7 +140,8 @@ hook_down() {
        assert isset zone
 
        # Remove everything from the routing db.
-       routing_db_remove ${zone} ipv6
+       db_delete "${zone}/ipv6"
+
        routing_update ${zone} ipv6
        routing_default_update
 
index db5e309d33a95c7d15ac662fa283bca7cb9e7b04..0223767d0681f8bde8312fda2eb1d92906f240ab 100644 (file)
@@ -239,7 +239,7 @@ hook_status() {
        cli_headline 2 "Point-to-Point-over-Ethernet protocol"
        local proto
        for proto in ${IP_SUPPORTED_PROTOCOLS}; do
-               routing_db_exists ${zone} ${proto} || continue
+               db_exists "${zone}/${proto}" || continue
 
                local headline
                case "${proto}" in
@@ -255,9 +255,9 @@ hook_status() {
                esac
                cli_headline 3 "${headline}"
 
-               cli_print_fmt1 3 "IP address"  "$(routing_db_get ${zone} ${proto} local-ip-address)"
-               cli_print_fmt1 3 "Gateway"     "$(routing_db_get ${zone} ${proto} remote-ip-address)"
-               cli_print_fmt1 3 "DNS servers" "$(routing_db_get ${zone} ${proto} dns)"
+               cli_print_fmt1 3 "IP address"  "$(db_get "${zone}/${proto}/local-ip-address")"
+               cli_print_fmt1 3 "Gateway"     "$(db_get "${zone}/${proto}/remote-ip-address")"
+               cli_print_fmt1 3 "DNS servers" "$(db_get "${zone}/${proto}/domain-name-servers")"
                cli_space
        done
 
index b2d0a950a832ef9a3367d495b977f9e0d646a273..717d4b1c7c56256461717ee43cde7e79ca186828 100644 (file)
@@ -228,7 +228,7 @@ hook_status() {
        cli_headline 2 "Point-to-Point-over-Ethernet protocol"
        local proto
        for proto in ${IP_SUPPORTED_PROTOCOLS}; do
-               routing_db_exists ${zone} ${proto} || continue
+               db_exists "${zone}/${proto}" || continue
 
                local headline
                case "${proto}" in
@@ -244,11 +244,11 @@ hook_status() {
                esac
                cli_headline 3 "${headline}"
 
-               cli_print_fmt1 3 "IP address"  "$(routing_db_get ${zone} ${proto} local-ip-address)"
-               cli_print_fmt1 3 "Gateway"     "$(routing_db_get ${zone} ${proto} remote-ip-address)"
-               cli_print_fmt1 3 "DNS servers" "$(routing_db_get ${zone} ${proto} dns)"
+               cli_print_fmt1 3 "IP address"  "$(db_get "${zone}/${proto}/local-ip-address")"
+               cli_print_fmt1 3 "Gateway"     "$(db_get "${zone}/${proto}/remote-ip-address")"
+               cli_print_fmt1 3 "DNS servers" "$(db_get "${zone}/${proto}/dns")"
                cli_space
-               cli_print_fmt1 3 "MAC-Remote"  "$(routing_db_get ${zone} ${proto} remote-address)"
+               cli_print_fmt1 3 "MAC-Remote"  "$(db_get "${zone}/${proto}/remote-address")"
                cli_space
        done
 
index e5a71db9a863c7bee594a1eda7f60600989d97ca..b7c7444a53958a8afb9ec19af282a665794646ff 100644 (file)
@@ -1248,6 +1248,9 @@ cli_raw() {
        shift
 
        case "${cmd}" in
+               db-dump)
+                       db_dump
+                       ;;
                list-devices)
                        device_list
                        ;;