2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2010 Michael Tremer & Christian Schmidt #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
22 .
/usr
/lib
/network
/header-config
24 HOOK_CONFIG_SETTINGS
="HOOK PRIVACY_EXTENSIONS"
26 # Privacy Extensions are disabled by default
27 PRIVACY_EXTENSIONS
="off"
29 hook_check_config_settings
() {
30 assert isbool PRIVACY_EXTENSIONS
33 hook_parse_cmdline
() {
38 --privacy-extensions=*)
39 local val
="$(cli_get_val "${arg}")"
42 PRIVACY_EXTENSIONS
="on"
44 PRIVACY_EXTENSIONS
="off"
48 done <<< "$(args "$@
")"
55 if zone_config_hook_is_configured
${zone} "ipv6-auto"; then
56 log ERROR
"You can configure the ipv6-auto hook only once for a zone"
60 if ! hook_parse_cmdline
"$@"; then
61 # Return an error if the parsing of the cmd line fails
65 zone_config_settings_write
"${zone}" "${HOOK}"
74 if ! device_exists
${zone}; then
75 error
"Zone '${zone}' doesn't exist."
79 zone_config_settings_read
"${zone}" "${HOOK}"
81 # Enable IPv6 auto-configuration
82 ipv6_device_autoconf_enable
"${zone}"
84 # Set up privacy extensions (RFC3041)
85 if enabled PRIVACY_EXTENSIONS
; then
86 ipv6_device_privacy_extensions_enable
"${zone}"
88 ipv6_device_privacy_extensions_disable
"${zone}"
99 if ! device_exists
${zone}; then
100 error
"Zone '${zone}' doesn't exist."
104 # Disable IPv6 auto-configuration
105 ipv6_device_autoconf_disable
"${zone}"
115 if ! device_exists
${zone}; then
116 error
"Zone '${zone}' doesn't exist."
120 zone_config_settings_read
"${zone}" "${config}"
122 local addresses
=$
(ipv6_device_get_addresses
"${zone}" --scope="global")
124 if isset addresses
; then
125 status
="${MSG_HOOK_UP}"
127 status
="${MSG_HOOK_DOWN}"
129 cli_statusline
3 "${HOOK}" "${status}"
131 if enabled PRIVACY_EXTENSIONS
; then
132 cli_print_fmt1
3 "Privacy Extensions enabled"
137 for addr
in ${addresses}; do
138 cli_print_fmt1
3 "IPv6 address" "${addr}"