diff options
author | N0YB <Al_Stu@Frontier.com> | 2013-02-23 19:34:37 -0800 |
---|---|---|
committer | N0YB <Al_Stu@Frontier.com> | 2013-02-23 19:34:37 -0800 |
commit | f4dd8b4c6663c172371b7b1317eb911d4e1e5db8 (patch) | |
tree | e691bf33b9405019e6b3e197d59ff4e1bc5379e0 | |
parent | a6b14d7e66cfa8feed7087d11a8810b680dcff59 (diff) | |
download | pfsense-f4dd8b4c6663c172371b7b1317eb911d4e1e5db8.zip pfsense-f4dd8b4c6663c172371b7b1317eb911d4e1e5db8.tar.gz |
Advanced DHCP Client Options & Config File Override
DHCP v4:
Protocol Timing
Send Options
Request Options
Require Options
Option Modifiers
DHCP v6:
Interface Statement
Identity Association Statement
Prefix Interface Statement
Authentication Statement
Keyinfo Statement
DHCP v4 & v6:
Config Override File
-rw-r--r-- | etc/inc/interfaces.inc | 300 | ||||
-rwxr-xr-x | usr/local/www/interfaces.php | 525 |
2 files changed, 815 insertions, 10 deletions
diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index 1ec6acc..b879639 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -3382,6 +3382,13 @@ function interface_dhcpv6_configure($interface = "wan", $wancfg) { $dhcp6cconf .= "};\n"; } } + + // DHCP6 Config File Advanced + if ($wancfg['adv_dhcp6_config_advanced']) { $dhcp6cconf = DHCP6_Config_File_Advanced($interface, $wancfg, $wanif); } + + // DHCP6 Config File Override + if ($wancfg['adv_dhcp6_config_file_override']) { $dhcp6cconf = DHCP6_Config_File_Override($wancfg, $wanif); } + /* wide-dhcp6c works for now. */ if (!@file_put_contents("{$g['varetc_path']}/dhcp6c_{$interface}.conf", $dhcp6cconf)) { printf("Error: cannot open dhcp6c_{$interface}.conf in interface_dhcpv6_configure() for writing.\n"); @@ -3439,6 +3446,163 @@ function interface_dhcpv6_configure($interface = "wan", $wancfg) { return 0; } +function DHCP6_Config_File_Advanced($interface, $wancfg, $wanif) { + global $g; + + $send_options = ""; + if ($wancfg['adv_dhcp6_interface_statement_send_options'] != '') { + $options = split(",", $wancfg['adv_dhcp6_interface_statement_send_options']); + foreach ($options as $option) { + $send_options .= "\tsend " . trim($option) . ";\n"; + } + } + + $request_options = ""; + if ($wancfg['adv_dhcp6_interface_statement_request_options'] != '') { + $options = split(",", $wancfg['adv_dhcp6_interface_statement_request_options']); + foreach ($options as $option) { + $request_options .= "\trequest " . trim($option) . ";\n"; + } + } + + $information_only = ""; + if ($wancfg['adv_dhcp6_interface_statement_information_only_enable'] != '') + $information_only = "\tinformation-only;\n"; + + $script = "\tscript \"{$g['varetc_path']}/dhcp6c_{$interface}_script.sh\";\n"; + if ($wancfg['adv_dhcp6_interface_statement_script'] != '') + $script = "\tscript \"{$wancfg['adv_dhcp6_interface_statement_script']}\";\n"; + + $interface_statement = "interface"; + $interface_statement .= " {$wanif}"; + $interface_statement .= " {\n"; + $interface_statement .= "$send_options"; + $interface_statement .= "$request_options"; + $interface_statement .= "$information_only"; + $interface_statement .= "$script"; + $interface_statement .= "};\n"; + + $id_assoc_statement_address = ""; + if ($wancfg['adv_dhcp6_id_assoc_statement_address_enable'] != '') { + $id_assoc_statement_address .= "id-assoc"; + $id_assoc_statement_address .= " na"; + if (is_numeric($wancfg['adv_dhcp6_id_assoc_statement_address_id'])) + $id_assoc_statement_address .= " {$wancfg['adv_dhcp6_id_assoc_statement_address_id']}"; + $id_assoc_statement_address .= " { "; + + if ( ($wancfg['adv_dhcp6_id_assoc_statement_address'] != '') && + (is_numeric($wancfg['adv_dhcp6_id_assoc_statement_address_pltime']) || + ($wancfg['adv_dhcp6_id_assoc_statement_address_pltime'] == 'infinity')) ) { + $id_assoc_statement_address .= "\n\taddress"; + $id_assoc_statement_address .= " {$wancfg['adv_dhcp6_id_assoc_statement_address']}"; + $id_assoc_statement_address .= " {$wancfg['adv_dhcp6_id_assoc_statement_address_pltime']}"; + if ( (is_numeric($wancfg['adv_dhcp6_id_assoc_statement_address_vltime'])) || + ($wancfg['adv_dhcp6_id_assoc_statement_address_vltime'] == 'infinity') ) + $id_assoc_statement_address .= " {$wancfg['adv_dhcp6_id_assoc_statement_address_vltime']}"; + $id_assoc_statement_address .= ";\n"; + } + + $id_assoc_statement_address .= "};\n"; + } + + $id_assoc_statement_prefix = ""; + if ($wancfg['adv_dhcp6_id_assoc_statement_prefix_enable'] != '') { + $id_assoc_statement_prefix .= "id-assoc"; + $id_assoc_statement_prefix .= " pd"; + if (is_numeric($wancfg['adv_dhcp6_id_assoc_statement_prefix_id'])) + $id_assoc_statement_prefix .= " {$wancfg['adv_dhcp6_id_assoc_statement_prefix_id']}"; + $id_assoc_statement_prefix .= " { "; + + if ( ($wancfg['adv_dhcp6_id_assoc_statement_prefix'] != '') && + (is_numeric($wancfg['adv_dhcp6_id_assoc_statement_prefix_pltime']) || + ($wancfg['adv_dhcp6_id_assoc_statement_prefix_pltime'] == 'infinity')) ) { + $id_assoc_statement_prefix .= "\n\tprefix"; + $id_assoc_statement_prefix .= " {$wancfg['adv_dhcp6_id_assoc_statement_prefix']}"; + $id_assoc_statement_prefix .= " {$wancfg['adv_dhcp6_id_assoc_statement_prefix_pltime']}"; + if ( (is_numeric($wancfg['adv_dhcp6_id_assoc_statement_prefix_vltime'])) || + ($wancfg['adv_dhcp6_id_assoc_statement_prefix_vltime'] == 'infinity') ) + $id_assoc_statement_prefix .= " {$wancfg['adv_dhcp6_id_assoc_statement_prefix_vltime']}"; + $id_assoc_statement_prefix .= ";"; + } + + if (is_numeric($wancfg['adv_dhcp6_prefix_interface_statement_sla_id'])) { + $id_assoc_statement_prefix .= "\n\tprefix-interface"; + $id_assoc_statement_prefix .= " {$wanif}"; + $id_assoc_statement_prefix .= " {\n"; + $id_assoc_statement_prefix .= "\t\tsla-id {$wancfg['adv_dhcp6_prefix_interface_statement_sla_id']};\n"; + if ( ($wancfg['adv_dhcp6_prefix_interface_statement_sla_len'] >= 0) && + ($wancfg['adv_dhcp6_prefix_interface_statement_sla_len'] <= 128) ) + $id_assoc_statement_prefix .= "\t\tsla-len {$wancfg['adv_dhcp6_prefix_interface_statement_sla_len']};\n"; + $id_assoc_statement_prefix .= "\t};"; + } + + if ( ($wancfg['adv_dhcp6_id_assoc_statement_prefix'] != '') || + (is_numeric($wancfg['adv_dhcp6_prefix_interface_statement_sla_id'])) ) { + $id_assoc_statement_prefix .= "\n"; + } + + $id_assoc_statement_prefix .= "};\n"; + } + + $authentication_statement = ""; + if ( ($wancfg['adv_dhcp6_authentication_statement_authname'] != '') && + ($wancfg['adv_dhcp6_authentication_statement_protocol'] == 'delayed') ) { + $authentication_statement .= "authentication"; + $authentication_statement .= " {$wancfg['adv_dhcp6_authentication_statement_authname']}"; + $authentication_statement .= " {\n"; + $authentication_statement .= "\tprotocol {$wancfg['adv_dhcp6_authentication_statement_protocol']};\n"; + if (preg_match("/(hmac(-)?md5)||(HMAC(-)?MD5)/", $wancfg['adv_dhcp6_authentication_statement_algorithm'])) + $authentication_statement .= "\talgorithm {$wancfg['adv_dhcp6_authentication_statement_algorithm']};\n"; + if ($wancfg['adv_dhcp6_authentication_statement_rdm'] == 'monocounter') + $authentication_statement .= "\trdm {$wancfg['adv_dhcp6_authentication_statement_rdm']};\n"; + $authentication_statement .= "};\n"; + } + + $key_info_statement = ""; + if ( ($wancfg['adv_dhcp6_key_info_statement_keyname'] != '') && + ($wancfg['adv_dhcp6_key_info_statement_realm'] != '') && + (is_numeric($wancfg['adv_dhcp6_key_info_statement_keyid'])) && + ($wancfg['adv_dhcp6_key_info_statement_secret'] != '') ) { + $key_info_statement .= "keyinfo"; + $key_info_statement .= " {$wancfg['adv_dhcp6_key_info_statement_keyname']}"; + $key_info_statement .= " {\n"; + $key_info_statement .= "\trealm \"{$wancfg['adv_dhcp6_key_info_statement_realm']}\";\n"; + $key_info_statement .= "\tkeyid {$wancfg['adv_dhcp6_key_info_statement_keyid']};\n"; + $key_info_statement .= "\tsecret \"{$wancfg['adv_dhcp6_key_info_statement_secret']}\";\n"; + if (preg_match("/((([0-9]{4}-)?[0-9]{2}[0-9]{2} )?[0-9]{2}:[0-9]{2})||(foreever)/", $wancfg['adv_dhcp6_key_info_statement_expire'])) + $key_info_statement .= "\texpire \"{$wancfg['adv_dhcp6_key_info_statement_expire']}\";\n"; + $key_info_statement .= "};\n"; + } + + $dhcp6cconf = $interface_statement; + $dhcp6cconf .= $id_assoc_statement_address; + $dhcp6cconf .= $id_assoc_statement_prefix; + $dhcp6cconf .= $authentication_statement; + $dhcp6cconf .= $key_info_statement; + + $dhcp6cconf = DHCP6_Config_File_Substitutions($wancfg, $wanif, $dhcp6cconf); + + return $dhcp6cconf; +} + + +function DHCP6_Config_File_Override($wancfg, $wanif) { + + $dhcp6cconf = file_get_contents($wancfg['adv_dhcp6_config_file_override_path']); + $dhcp6cconf = DHCP6_Config_File_Substitutions($wancfg, $wanif, $dhcp6cconf); + + return $dhcp6cconf; +} + + +function DHCP6_Config_File_Substitutions($wancfg, $wanif, $dhcp6cconf) { + + $dhcp6cconf = DHCP_Config_File_Substitutions($wancfg, $wanif, $dhcp6cconf); + + return $dhcp6cconf; +} + + function interface_dhcp_configure($interface = "wan") { global $config, $g; @@ -3480,6 +3644,9 @@ initial-interval 1; EOD; + // DHCP Config File Advanced + if ($wancfg['adv_dhcp_config_advanced']) { $dhclientconf = DHCP_Config_File_Advanced($interface, $wancfg, $wanif); } + if(is_ipaddr($wancfg['alias-address'])) { $subnetmask = gen_subnet_mask($wancfg['alias-subnet']); $dhclientconf .= <<<EOD @@ -3491,6 +3658,10 @@ alias { EOD; } + + // DHCP Config File Override + if ($wancfg['adv_dhcp_config_file_override']) { $dhclientconf = DHCP_Config_File_Override($wancfg, $wanif); } + fwrite($fd, $dhclientconf); fclose($fd); @@ -3506,6 +3677,135 @@ EOD; return 0; } +function DHCP_Config_File_Advanced($interface, $wancfg, $wanif) { + + $hostname = ""; + if ($wancfg['dhcphostname'] != '') { + $hostname = "send host-name \"{$wancfg['dhcphostname']}\";\n"; + } + + /* DHCP Protocol Timings */ + $protocol_timings = array ('adv_dhcp_pt_timeout' => "timeout", 'adv_dhcp_pt_retry' => "retry", 'adv_dhcp_pt_select_timeout' => "select-timeout", 'adv_dhcp_pt_reboot' => "reboot", 'adv_dhcp_pt_backoff_cutoff' => "backoff-cutoff", 'adv_dhcp_pt_initial_interval' => "initial-interval"); + foreach ($protocol_timings as $Protocol_Timing => $PT_Name) { + $pt_variable = "{$Protocol_Timing}"; + ${$pt_variable} = ""; + if ($wancfg[$Protocol_Timing] != "") { + ${$pt_variable} = "{$PT_Name} {$wancfg[$Protocol_Timing]};\n"; + } + } + + $send_options = ""; + if ($wancfg['adv_dhcp_send_options'] != '') { + $options = split(",", $wancfg['adv_dhcp_send_options']); + foreach ($options as $option) { + $send_options .= "\tsend " . trim($option) . ";\n"; + } + } + + $request_options = ""; + if ($wancfg['adv_dhcp_request_options'] != '') { + $request_options = "\trequest {$wancfg['adv_dhcp_request_options']};\n"; + } + + $required_options = ""; + if ($wancfg['adv_dhcp_required_options'] != '') { + $required_options = "\trequired {$wancfg['adv_dhcp_required_options']};\n"; + } + + $option_modifiers = ""; + if ($wancfg['adv_dhcp_option_modifiers'] != '') { + $modifiers = split(",", $wancfg['adv_dhcp_option_modifiers']); + foreach ($modifiers as $modifier) { + $option_modifiers .= "\t" . trim($modifier) . ";\n"; + } + } + + $dhclientconf = "interface \"{$wanif}\" {\n"; + $dhclientconf .= "\n"; + $dhclientconf .= "# DHCP Protocol Timing Values\n"; + $dhclientconf .= "{$adv_dhcp_pt_timeout}"; + $dhclientconf .= "{$adv_dhcp_pt_retry}"; + $dhclientconf .= "{$adv_dhcp_pt_select_timeout}"; + $dhclientconf .= "{$adv_dhcp_pt_reboot}"; + $dhclientconf .= "{$adv_dhcp_pt_backoff_cutoff}"; + $dhclientconf .= "{$adv_dhcp_pt_initial_interval}"; + $dhclientconf .= "\n"; + $dhclientconf .= "# DHCP Protocol Options"; + $dhclientconf .= "{$hostname}"; + $dhclientconf .= "{$send_options}"; + $dhclientconf .= "{$request_options}"; + $dhclientconf .= "{$required_options}"; + $dhclientconf .= "{$option_modifiers}"; + $dhclientconf .= "\n"; + $dhclientconf .= "\tscript \"/sbin/dhclient-script\";\n"; + $dhclientconf .= "}\n"; + + $dhclientconf = DHCP_Config_File_Substitutions($wancfg, $wanif, $dhclientconf); + + return $dhclientconf; +} + + +function DHCP_Config_File_Override($wancfg, $wanif) { + + $dhclientconf = file_get_contents($wancfg['adv_dhcp_config_file_override_path']); + $dhclientconf = DHCP_Config_File_Substitutions($wancfg, $wanif, $dhclientconf); + + return $dhclientconf; +} + + +function DHCP_Config_File_Substitutions($wancfg, $wanif, $dhclientconf) { + + /* Apply Interface Substitutions */ + $dhclientconf = str_replace("{interface}", "{$wanif}", $dhclientconf); + + /* Apply Hostname Substitutions */ + $dhclientconf = str_replace("{hostname}", $wancfg['dhcphostname'], $dhclientconf); + + /* Arrays of MAC Address Types, Cases, Delimiters */ + /* ASCII or HEX, Upper or Lower Case, Various Delimiters (none, space, colon, hyphen, period) */ + $various_mac_types = array("mac_addr_ascii", "mac_addr_hex"); + $various_mac_cases = array("U", "L"); + $various_mac_delimiters = array("", " ", ":", "-", "."); + + /* Apply MAC Address Substitutions */ + foreach ($various_mac_types as $various_mac_type) { + foreach ($various_mac_cases as $various_mac_case) { + foreach ($various_mac_delimiters as $various_mac_delimiter) { + + $res = stripos($dhclientconf, $various_mac_type . $various_mac_case . $various_mac_delimiter); + if ($res !== false) { + + /* Get MAC Address as ASCII String With Colon (:) Celimiters */ + if ("$various_mac_case" == "U") $dhcpclientconf_mac = strtoupper(get_interface_mac($wanif)); + if ("$various_mac_case" == "L") $dhcpclientconf_mac = strtolower(get_interface_mac($wanif)); + + if ("$various_mac_type" == "mac_addr_hex") { + /* Convert MAC ascii string to HEX with colon (:) delimiters. */ + $dhcpclientconf_mac = str_replace(":", "", $dhcpclientconf_mac); + $dhcpclientconf_mac_hex = ""; + $delimiter = ""; + for($i = 0; $i < strlen($dhcpclientconf_mac); $i++) { + $dhcpclientconf_mac_hex .= $delimiter. bin2hex($dhcpclientconf_mac[$i]); + $delimiter = ":"; + } + $dhcpclientconf_mac = $dhcpclientconf_mac_hex; + } + + /* MAC Address Delimiter Substitutions */ + $dhcpclientconf_mac = str_replace(":", $various_mac_delimiter, $dhcpclientconf_mac); + + /* Apply MAC Address Substitutions */ + $dhclientconf = str_replace("{" . $various_mac_type . $various_mac_case . $various_mac_delimiter . "}", $dhcpclientconf_mac, $dhclientconf); + } + } + } + } + + return $dhclientconf; +} + function interfaces_group_setup() { global $config; diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php index dde7956..6580ae8 100755 --- a/usr/local/www/interfaces.php +++ b/usr/local/www/interfaces.php @@ -174,6 +174,60 @@ if ($wancfg['if'] == $a_ppps[$pppid]['if']) { $pconfig['dhcphostname'] = $wancfg['dhcphostname']; $pconfig['alias-address'] = $wancfg['alias-address']; $pconfig['alias-subnet'] = $wancfg['alias-subnet']; + +$pconfig['adv_dhcp_pt_timeout'] = $wancfg['adv_dhcp_pt_timeout']; +$pconfig['adv_dhcp_pt_retry'] = $wancfg['adv_dhcp_pt_retry']; +$pconfig['adv_dhcp_pt_select_timeout'] = $wancfg['adv_dhcp_pt_select_timeout']; +$pconfig['adv_dhcp_pt_reboot'] = $wancfg['adv_dhcp_pt_reboot']; +$pconfig['adv_dhcp_pt_backoff_cutoff'] = $wancfg['adv_dhcp_pt_backoff_cutoff']; +$pconfig['adv_dhcp_pt_initial_interval'] = $wancfg['adv_dhcp_pt_initial_interval']; + +$pconfig['adv_dhcp_pt_values'] = $wancfg['adv_dhcp_pt_values']; + +$pconfig['adv_dhcp_send_options'] = $wancfg['adv_dhcp_send_options']; +$pconfig['adv_dhcp_request_options'] = $wancfg['adv_dhcp_request_options']; +$pconfig['adv_dhcp_required_options'] = $wancfg['adv_dhcp_required_options']; +$pconfig['adv_dhcp_option_modifiers'] = $wancfg['adv_dhcp_option_modifiers']; + +$pconfig['adv_dhcp_config_advanced'] = $wancfg['adv_dhcp_config_advanced']; +$pconfig['adv_dhcp_config_file_override'] = $wancfg['adv_dhcp_config_file_override']; +$pconfig['adv_dhcp_config_file_override_path'] = $wancfg['adv_dhcp_config_file_override_path']; + +$pconfig['adv_dhcp6_interface_statement_send_options'] = $wancfg['adv_dhcp6_interface_statement_send_options']; +$pconfig['adv_dhcp6_interface_statement_request_options'] = $wancfg['adv_dhcp6_interface_statement_request_options']; +$pconfig['adv_dhcp6_interface_statement_information_only_enable'] = $wancfg['adv_dhcp6_interface_statement_information_only_enable']; +$pconfig['adv_dhcp6_interface_statement_script'] = $wancfg['adv_dhcp6_interface_statement_script']; + +$pconfig['adv_dhcp6_id_assoc_statement_address_enable'] = $wancfg['adv_dhcp6_id_assoc_statement_address_enable']; +$pconfig['adv_dhcp6_id_assoc_statement_address'] = $wancfg['adv_dhcp6_id_assoc_statement_address']; +$pconfig['adv_dhcp6_id_assoc_statement_address_id'] = $wancfg['adv_dhcp6_id_assoc_statement_address_id']; +$pconfig['adv_dhcp6_id_assoc_statement_address_pltime'] = $wancfg['adv_dhcp6_id_assoc_statement_address_pltime']; +$pconfig['adv_dhcp6_id_assoc_statement_address_vltime'] = $wancfg['adv_dhcp6_id_assoc_statement_address_vltime']; + +$pconfig['adv_dhcp6_id_assoc_statement_prefix_enable'] = $wancfg['adv_dhcp6_id_assoc_statement_prefix_enable']; +$pconfig['adv_dhcp6_id_assoc_statement_prefix'] = $wancfg['adv_dhcp6_id_assoc_statement_prefix']; +$pconfig['adv_dhcp6_id_assoc_statement_prefix_id'] = $wancfg['adv_dhcp6_id_assoc_statement_prefix_id']; +$pconfig['adv_dhcp6_id_assoc_statement_prefix_pltime'] = $wancfg['adv_dhcp6_id_assoc_statement_prefix_pltime']; +$pconfig['adv_dhcp6_id_assoc_statement_prefix_vltime'] = $wancfg['adv_dhcp6_id_assoc_statement_prefix_vltime']; + +$pconfig['adv_dhcp6_prefix_interface_statement_sla_id'] = $wancfg['adv_dhcp6_prefix_interface_statement_sla_id']; +$pconfig['adv_dhcp6_prefix_interface_statement_sla_len'] = $wancfg['adv_dhcp6_prefix_interface_statement_sla_len']; + +$pconfig['adv_dhcp6_authentication_statement_authname'] = $wancfg['adv_dhcp6_authentication_statement_authname']; +$pconfig['adv_dhcp6_authentication_statement_protocol'] = $wancfg['adv_dhcp6_authentication_statement_protocol']; +$pconfig['adv_dhcp6_authentication_statement_algorithm'] = $wancfg['adv_dhcp6_authentication_statement_algorithm']; +$pconfig['adv_dhcp6_authentication_statement_rdm'] = $wancfg['adv_dhcp6_authentication_statement_rdm']; + +$pconfig['adv_dhcp6_key_info_statement_keyname'] = $wancfg['adv_dhcp6_key_info_statement_keyname']; +$pconfig['adv_dhcp6_key_info_statement_realm'] = $wancfg['adv_dhcp6_key_info_statement_realm']; +$pconfig['adv_dhcp6_key_info_statement_keyid'] = $wancfg['adv_dhcp6_key_info_statement_keyid']; +$pconfig['adv_dhcp6_key_info_statement_secret'] = $wancfg['adv_dhcp6_key_info_statement_secret']; +$pconfig['adv_dhcp6_key_info_statement_expire'] = $wancfg['adv_dhcp6_key_info_statement_expire']; + +$pconfig['adv_dhcp6_config_advanced'] = $wancfg['adv_dhcp6_config_advanced']; +$pconfig['adv_dhcp6_config_file_override'] = $wancfg['adv_dhcp6_config_file_override']; +$pconfig['adv_dhcp6_config_file_override_path'] = $wancfg['adv_dhcp6_config_file_override_path']; + $pconfig['dhcp_plus'] = isset($wancfg['dhcp_plus']); $pconfig['descr'] = remove_bad_chars($wancfg['descr']); $pconfig['enable'] = isset($wancfg['enable']); @@ -710,6 +764,60 @@ if ($_POST['apply']) { unset($wancfg['prefix-6rd']); unset($wancfg['prefix-6rd-v4plen']); unset($wancfg['gateway-6rd']); + + unset($wancfg['adv_dhcp_pt_timeout']); + unset($wancfg['adv_dhcp_pt_retry']); + unset($wancfg['adv_dhcp_pt_select_timeout']); + unset($wancfg['adv_dhcp_pt_reboot']); + unset($wancfg['adv_dhcp_pt_backoff_cutoff']); + unset($wancfg['adv_dhcp_pt_initial_interval']); + + unset($wancfg['adv_dhcp_pt_values']); + + unset($wancfg['adv_dhcp_send_options']); + unset($wancfg['adv_dhcp_request_options']); + unset($wancfg['adv_dhcp_required_options']); + unset($wancfg['adv_dhcp_option_modifiers']); + + unset($wancfg['adv_dhcp_config_advanced']); + unset($wancfg['adv_dhcp_config_file_override']); + unset($wancfg['adv_dhcp_config_file_override_path']); + + unset($wancfg['adv_dhcp6_interface_statement_send_options']); + unset($wancfg['adv_dhcp6_interface_statement_request_options']); + unset($wancfg['adv_dhcp6_interface_statement_information_only_enable']); + unset($wancfg['adv_dhcp6_interface_statement_script']); + + unset($wancfg['adv_dhcp6_id_assoc_statement_address_enable']); + unset($wancfg['adv_dhcp6_id_assoc_statement_address']); + unset($wancfg['adv_dhcp6_id_assoc_statement_address_id']); + unset($wancfg['adv_dhcp6_id_assoc_statement_address_pltime']); + unset($wancfg['adv_dhcp6_id_assoc_statement_address_vltime']); + + unset($wancfg['adv_dhcp6_id_assoc_statement_prefix_enable']); + unset($wancfg['adv_dhcp6_id_assoc_statement_prefix']); + unset($wancfg['adv_dhcp6_id_assoc_statement_prefix_id']); + unset($wancfg['adv_dhcp6_id_assoc_statement_prefix_pltime']); + unset($wancfg['adv_dhcp6_id_assoc_statement_prefix_vltime']); + + unset($wancfg['adv_dhcp6_prefix_interface_statement_sla_id']); + unset($wancfg['adv_dhcp6_prefix_interface_statement_sla_len']); + + unset($wancfg['adv_dhcp6_authentication_statement_authname']); + unset($wancfg['adv_dhcp6_authentication_statement_protocol']); + unset($wancfg['adv_dhcp6_authentication_statement_algorithm']); + unset($wancfg['adv_dhcp6_authentication_statement_rdm']); + + unset($wancfg['adv_dhcp6_key_info_statement_keyname']); + unset($wancfg['adv_dhcp6_key_info_statement_realm']); + unset($wancfg['adv_dhcp6_key_info_statement_keyid']); + unset($wancfg['adv_dhcp6_key_info_statement_secret']); + unset($wancfg['adv_dhcp6_key_info_statement_expire']); + + unset($wancfg['adv_dhcp6_config_advanced']); + unset($wancfg['adv_dhcp6_config_file_override']); + unset($wancfg['adv_dhcp6_config_file_override_path']); + unset($wancfg['pppoe_password']); unset($wancfg['pptp_username']); unset($wancfg['pptp_password']); @@ -746,6 +854,25 @@ if ($_POST['apply']) { $wancfg['dhcphostname'] = $_POST['dhcphostname']; $wancfg['alias-address'] = $_POST['alias-address']; $wancfg['alias-subnet'] = $_POST['alias-subnet']; + + $wancfg['adv_dhcp_pt_timeout'] = $_POST['adv_dhcp_pt_timeout']; + $wancfg['adv_dhcp_pt_retry'] = $_POST['adv_dhcp_pt_retry']; + $wancfg['adv_dhcp_pt_select_timeout'] = $_POST['adv_dhcp_pt_select_timeout']; + $wancfg['adv_dhcp_pt_reboot'] = $_POST['adv_dhcp_pt_reboot']; + $wancfg['adv_dhcp_pt_backoff_cutoff'] = $_POST['adv_dhcp_pt_backoff_cutoff']; + $wancfg['adv_dhcp_pt_initial_interval'] = $_POST['adv_dhcp_pt_initial_interval']; + + $wancfg['adv_dhcp_pt_values'] = $_POST['adv_dhcp_pt_values']; + + $wancfg['adv_dhcp_send_options'] = $_POST['adv_dhcp_send_options']; + $wancfg['adv_dhcp_request_options'] = $_POST['adv_dhcp_request_options']; + $wancfg['adv_dhcp_required_options'] = $_POST['adv_dhcp_required_options']; + $wancfg['adv_dhcp_option_modifiers'] = $_POST['adv_dhcp_option_modifiers']; + + $wancfg['adv_dhcp_config_advanced'] = $_POST['adv_dhcp_config_advanced']; + $wancfg['adv_dhcp_config_file_override'] = $_POST['adv_dhcp_config_file_override']; + $wancfg['adv_dhcp_config_file_override_path'] = $_POST['adv_dhcp_config_file_override_path']; + $wancfg['dhcp_plus'] = $_POST['dhcp_plus'] == "yes" ? true : false; if($gateway_item) { $a_gateways[] = $gateway_item; @@ -840,6 +967,42 @@ if ($_POST['apply']) { $wancfg['ipaddrv6'] = "dhcp6"; $wancfg['dhcp6-duid'] = $_POST['dhcp6-duid']; $wancfg['dhcp6-ia-pd-len'] = $_POST['dhcp6-ia-pd-len']; + + $wancfg['adv_dhcp6_interface_statement_send_options'] = $_POST['adv_dhcp6_interface_statement_send_options']; + $wancfg['adv_dhcp6_interface_statement_request_options'] = $_POST['adv_dhcp6_interface_statement_request_options']; + $wancfg['adv_dhcp6_interface_statement_information_only_enable'] = $_POST['adv_dhcp6_interface_statement_information_only_enable']; + $wancfg['adv_dhcp6_interface_statement_script'] = $_POST['adv_dhcp6_interface_statement_script']; + + $wancfg['adv_dhcp6_id_assoc_statement_address_enable'] = $_POST['adv_dhcp6_id_assoc_statement_address_enable']; + $wancfg['adv_dhcp6_id_assoc_statement_address'] = $_POST['adv_dhcp6_id_assoc_statement_address']; + $wancfg['adv_dhcp6_id_assoc_statement_address_id'] = $_POST['adv_dhcp6_id_assoc_statement_address_id']; + $wancfg['adv_dhcp6_id_assoc_statement_address_pltime'] = $_POST['adv_dhcp6_id_assoc_statement_address_pltime']; + $wancfg['adv_dhcp6_id_assoc_statement_address_vltime'] = $_POST['adv_dhcp6_id_assoc_statement_address_vltime']; + + $wancfg['adv_dhcp6_id_assoc_statement_prefix_enable'] = $_POST['adv_dhcp6_id_assoc_statement_prefix_enable']; + $wancfg['adv_dhcp6_id_assoc_statement_prefix'] = $_POST['adv_dhcp6_id_assoc_statement_prefix']; + $wancfg['adv_dhcp6_id_assoc_statement_prefix_id'] = $_POST['adv_dhcp6_id_assoc_statement_prefix_id']; + $wancfg['adv_dhcp6_id_assoc_statement_prefix_pltime'] = $_POST['adv_dhcp6_id_assoc_statement_prefix_pltime']; + $wancfg['adv_dhcp6_id_assoc_statement_prefix_vltime'] = $_POST['adv_dhcp6_id_assoc_statement_prefix_vltime']; + + $wancfg['adv_dhcp6_prefix_interface_statement_sla_id'] = $_POST['adv_dhcp6_prefix_interface_statement_sla_id']; + $wancfg['adv_dhcp6_prefix_interface_statement_sla_len'] = $_POST['adv_dhcp6_prefix_interface_statement_sla_len']; + + $wancfg['adv_dhcp6_authentication_statement_authname'] = $_POST['adv_dhcp6_authentication_statement_authname']; + $wancfg['adv_dhcp6_authentication_statement_protocol'] = $_POST['adv_dhcp6_authentication_statement_protocol']; + $wancfg['adv_dhcp6_authentication_statement_algorithm'] = $_POST['adv_dhcp6_authentication_statement_algorithm']; + $wancfg['adv_dhcp6_authentication_statement_rdm'] = $_POST['adv_dhcp6_authentication_statement_rdm']; + + $wancfg['adv_dhcp6_key_info_statement_keyname'] = $_POST['adv_dhcp6_key_info_statement_keyname']; + $wancfg['adv_dhcp6_key_info_statement_realm'] = $_POST['adv_dhcp6_key_info_statement_realm']; + $wancfg['adv_dhcp6_key_info_statement_keyid'] = $_POST['adv_dhcp6_key_info_statement_keyid']; + $wancfg['adv_dhcp6_key_info_statement_secret'] = $_POST['adv_dhcp6_key_info_statement_secret']; + $wancfg['adv_dhcp6_key_info_statement_expire'] = $_POST['adv_dhcp6_key_info_statement_expire']; + + $wancfg['adv_dhcp6_config_advanced'] = $_POST['adv_dhcp6_config_advanced']; + $wancfg['adv_dhcp6_config_file_override'] = $_POST['adv_dhcp6_config_file_override']; + $wancfg['adv_dhcp6_config_file_override_path'] = $_POST['adv_dhcp6_config_file_override_path']; + if($gateway_item) { $a_gateways[] = $gateway_item; } @@ -1673,7 +1836,12 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"), <td colspan="2" style="padding: 0px;"> <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> - <td colspan="2" valign="top" class="listtopic"><?=gettext("DHCP client configuration"); ?></td> + <td colspan="2" valign="top" class="listtopic"><?=gettext("DHCP client configuration     " . + ' <input name="adv_dhcp_config_advanced" type="checkbox" id="adv_dhcp_config_advanced" value="" onClick="show_adv_dhcp_config(this)";> ' . + " Advanced     " . + ' <input name="adv_dhcp_config_file_override" type="checkbox" id="adv_dhcp_config_file_override" value="" onClick="show_adv_dhcp_config(this)";> ' . + " Config File Override     "); ?> + </td> </tr> <!-- Uncomment to expose DHCP+ in GUI <tr> @@ -1686,7 +1854,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"), </td> </tr> --> - <tr> + <tr style='display:none' name="show_basic_dhcphostname" id="show_basic_dhcphostname"> <td width="22%" valign="top" class="vncell"><?=gettext("Hostname"); ?></td> <td width="78%" class="vtable"> <input name="dhcphostname" type="text" class="formfld unknown" id="dhcphostname" size="40" value="<?=htmlspecialchars($pconfig['dhcphostname']);?>"> @@ -1696,7 +1864,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"), "this (for client identification)."); ?> </td> </tr> - <tr> + <tr style='display:none' name="show_basic_dhcpalias-address" id="show_basic_dhcpalias-address"> <td width="22%" valign="top" class="vncell"><?=gettext("Alias IPv4 address"); ?></td> <td width="78%" class="vtable"> <input name="alias-address" type="text" class="formfld unknown" id="alias-address" size="20" value="<?=htmlspecialchars($pconfig['alias-address']);?>"> @@ -1715,9 +1883,158 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"), "DHCP client."); ?> </td> </tr> - <tr> - <td colspan="2" valign="top" height="16"></td> + + <tr style='display:none' name="show_adv_dhcp_pt_timeout" id="show_adv_dhcp_pt_timeout"> + <td width="22%" valign="top" class="vncell"><?=gettext("<a target=FreeBSD DHCP href=http://www.freebsd.org/cgi/man.cgi?query=dhclient.conf&sektion=5#PROTOCOL_TIMING>Protocol Timing</a>"); ?></td> + <td width="48%" class="vtable"> + Timeout: <input name="adv_dhcp_pt_timeout" type="text" class="formfld unknown" id="adv_dhcp_pt_timeout" size="2" value="<?=htmlspecialchars($pconfig['adv_dhcp_pt_timeout']);?>" onChange="customdhcpptcheckradiobuton(document.iform.adv_dhcp_pt_values, '');"> + Retry: <input name="adv_dhcp_pt_retry" type="text" class="formfld unknown" id="adv_dhcp_pt_retry" size="2" value="<?=htmlspecialchars($pconfig['adv_dhcp_pt_retry']);?>" onChange="customdhcpptcheckradiobuton(document.iform.adv_dhcp_pt_values, '');"> + Select Timeout: <input name="adv_dhcp_pt_select_timeout" type="text" class="formfld unknown" id="adv_dhcp_pt_select_timeout" size="2" value="<?=htmlspecialchars($pconfig['adv_dhcp_pt_select_timeout']);?>" onChange="customdhcpptcheckradiobuton(document.iform.adv_dhcp_pt_values, '');"> + +         + Presets:   + <input name="adv_dhcp_pt_values" type="radio" value="DHCP" unchecked enabled id="customdhcpptdhcpdefaults" onClick="customdhcpptsetvalues(this, iform);">FreeBSD Default   + <input name="adv_dhcp_pt_values" type="radio" value="Clear" unchecked enabled id="customdhcpptclear" onClick="customdhcpptsetvalues(this, iform);">Clear + + <br> + Reboot: <input name="adv_dhcp_pt_reboot" type="text" class="formfld unknown" id="adv_dhcp_pt_reboot" size="2" value="<?=htmlspecialchars($pconfig['adv_dhcp_pt_reboot']);?>" onChange="customdhcpptcheckradiobuton(document.iform.adv_dhcp_pt_values, '');"> + Backoff Cutoff: <input name="adv_dhcp_pt_backoff_cutoff" type="text" class="formfld unknown" id="adv_dhcp_pt_backoff_cutoff" size="2" value="<?=htmlspecialchars($pconfig['adv_dhcp_pt_backoff_cutoff']);?>" onChange="customdhcpptcheckradiobuton(document.iform.adv_dhcp_pt_values, '');"> + Initial Interval: <input name="adv_dhcp_pt_initial_interval" type="text" class="formfld unknown" id="adv_dhcp_pt_initial_interval" size="2" value="<?=htmlspecialchars($pconfig['adv_dhcp_pt_initial_interval']);?>" onChange="customdhcpptcheckradiobuton(document.iform.adv_dhcp_pt_values, '');"> + +           + <input name="adv_dhcp_pt_values" type="radio" value="pfSense" unchecked enabled id="customdhcpptpfsensedefaults" onClick="customdhcpptsetvalues(this, iform);">pfSense Default   + <input name="adv_dhcp_pt_values" type="radio" value="SavedCfg" checked enabled id="customdhcpptsavedcfg" onClick="customdhcpptsetvalues(this, iform);">Saved Cfg + + <br> + <?=gettext("The values in these fields are DHCP protocol timings used when requesting a lease. <br> " ); ?> + + <script type="text/javascript"> + function customdhcpptcheckradiobuton(T, BUTTON) { + for (var i = 0; i < T.length; i++) { + T[i].checked = false; + if (T[i].value == BUTTON) T[i].checked = true; + } + T.value = BUTTON; + } + + function customdhcpptsetvalues(T, FORM) { + // timeout, retry, select-timeout, reboot, backoff-cutoff, initial-interval + if (T.value == "DHCP") customdhcpptsetvaluesnow(T, FORM, "60", "300", "0", "10", "120", "10"); + if (T.value == "pfSense") customdhcpptsetvaluesnow(T, FORM, "60", "15", "0", "", "", "1"); + if (T.value == "SavedCfg") customdhcpptsetvaluesnow(T, FORM, "<?=htmlspecialchars($pconfig['adv_dhcp_pt_timeout']);?>", "<?=htmlspecialchars($pconfig['adv_dhcp_pt_retry']);?>", "<?=htmlspecialchars($pconfig['adv_dhcp_pt_select_timeout']);?>", "<?=htmlspecialchars($pconfig['adv_dhcp_pt_reboot']);?>", "<?=htmlspecialchars($pconfig['adv_dhcp_pt_backoff_cutoff']);?>", "<?=htmlspecialchars($pconfig['adv_dhcp_pt_initial_interval']);?>"); + if (T.value == "Clear") customdhcpptsetvaluesnow(T, FORM, "", "", "", "", "", ""); + } + + function customdhcpptsetvaluesnow(T, FORM, timeout, retry, selecttimeout, reboot, backoffcutoff, initialinterval) { + FORM.adv_dhcp_pt_timeout.value = timeout; + FORM.adv_dhcp_pt_retry.value = retry; + FORM.adv_dhcp_pt_select_timeout.value = selecttimeout; + FORM.adv_dhcp_pt_reboot.value = reboot; + FORM.adv_dhcp_pt_backoff_cutoff.value = backoffcutoff; + FORM.adv_dhcp_pt_initial_interval.value = initialinterval; + + FORM.adv_dhcp_pt_values.value = T.value; + } + + <!-- Set the adv_dhcp_pt_values radio button from saved config --> + var RADIOBUTTON_VALUE = "<?=htmlspecialchars($pconfig['adv_dhcp_pt_values']);?>"; + if (RADIOBUTTON_VALUE == "") RADIOBUTTON_VALUE = "SavedCfg"; + customdhcpptcheckradiobuton(document.iform.adv_dhcp_pt_values, RADIOBUTTON_VALUE); + </script> + </td> </tr> + + <tr style='display:none' name="show_adv_dhcp_send_options" id="show_adv_dhcp_send_options"> + <td width="22%" valign="top" class="vncell"><?=gettext("<a target=FreeBSD DHCP href=http://www.freebsd.org/cgi/man.cgi?query=dhclient.conf&sektion=5#LEASE_REQUIREMENTS_AND_REQUESTS>Send</a> <a target=FreeBSD DHCP href=http://www.freebsd.org/cgi/man.cgi?query=dhcp-options&sektion=5>Options</a>"); ?></td> + <td width="78%" class="vtable"> + <input name="adv_dhcp_send_options" type="text" class="formfld unknown" id="adv_dhcp_send_options" size="86" value="<?=htmlspecialchars($pconfig['adv_dhcp_send_options']);?>"> + <br> + <?=gettext("The values in this field are DHCP options to be sent when requesting a DHCP lease. [option declaration [, ...]] <br>" . + "Value Substitutions: {interface}, {hostname}, {mac_addr_asciiCD}, {mac_addr_hexCD} <br>" . + "Where C is U(pper) or L(ower) Case, and D is \" :-.\" Delimiter (space, colon, hyphen, or period) (omitted for none). <br>" . + "Some ISPs may require certain options be or not be sent. "); ?> + </td> + </tr> + + <tr style='display:none' name="show_adv_dhcp_request_options" id="show_adv_dhcp_request_options"> + <td width="22%" valign="top" class="vncell"><?=gettext("<a target=FreeBSD DHCP href=http://www.freebsd.org/cgi/man.cgi?query=dhclient.conf&sektion=5#LEASE_REQUIREMENTS_AND_REQUESTS>Request</a> <a target=FreeBSD DHCP href=http://www.freebsd.org/cgi/man.cgi?query=dhcp-options&sektion=5>Options</a>"); ?></td> + <td width="78%" class="vtable"> + <input name="adv_dhcp_request_options" type="text" class="formfld unknown" id="adv_dhcp_request_options" size="86" value="<?=htmlspecialchars($pconfig['adv_dhcp_request_options']);?>"> + <br> + <?=gettext("The values in this field are DHCP option 55 to be sent when requesting a DHCP lease. [option [, ...]] <br>" . + "Some ISPs may require certain options be or not be requested. "); ?> + </td> + </tr> + + <tr style='display:none' name="show_adv_dhcp_required_options" id="show_adv_dhcp_required_options"> + <td width="22%" valign="top" class="vncell"><?=gettext("<a target=FreeBSD DHCP href=http://www.freebsd.org/cgi/man.cgi?query=dhclient.conf&sektion=5#LEASE_REQUIREMENTS_AND_REQUESTS>Require</a> <a target=FreeBSD DHCP href=http://www.freebsd.org/cgi/man.cgi?query=dhcp-options&sektion=5>Options</a>"); ?></td> + <td width="78%" class="vtable"> + <input name="adv_dhcp_required_options" type="text" class="formfld unknown" id="adv_dhcp_required_options" size="86" value="<?=htmlspecialchars($pconfig['adv_dhcp_required_options']);?>"> + <br> + <?=gettext("The values in this field are DHCP optiions required by the client when requesting a DHCP lease. [option [, ...]] "); ?> + </td> + </tr> + + <tr style='display:none' name="show_adv_dhcp_option_modifiers" id="show_adv_dhcp_option_modifiers"> + <td width="22%" valign="top" class="vncell"><?=gettext("<a target=FreeBSD DHCP href=http://www.freebsd.org/cgi/man.cgi?query=dhcp-options&sektion=5>Option</a> <a target=FreeBSD DHCP href=http://www.freebsd.org/cgi/man.cgi?query=dhclient.conf&sektion=5#OPTION_MODIFIERS>Modifiers</a>"); ?></td> + <td width="78%" class="vtable"> + <input name="adv_dhcp_option_modifiers" type="text" class="formfld unknown" id="adv_dhcp_option_modifiers" size="86" value="<?=htmlspecialchars($pconfig['adv_dhcp_option_modifiers']);?>"> + <br> + <?=gettext("The values in this field are DHCP optiion modifires applied to obtained DHCP lease. [modifier option declaration [, ...]] <br> " . + "modifiers: (default, supersede, prepend, append)"); ?> + </td> + </tr> + + <tr style='display:none' name="show_adv_dhcp_config_file_override" id="show_adv_dhcp_config_file_override"> + <td width="22%" valign="top" class="vncell"><?=gettext("<a target=FreeBSD DHCP href=http://www.freebsd.org/cgi/man.cgi?query=dhclient.conf&sektion=5>Configuration File</a> Override"); ?></td> + <td width="78%" class="vtable"> + <input name="adv_dhcp_config_file_override_path" type="text" class="formfld unknown" id="adv_dhcp_config_file_override_path" size="86" value="<?=htmlspecialchars($pconfig['adv_dhcp_config_file_override_path']);?>"> + <br> + <?=gettext("The value in this field is the full absolute path to a DHCP client configuration file. [/[dirname/[.../]]filename[.ext]] <br> " . + "Value Substitutions in Config File: {interface}, {hostname}, {mac_addr_asciiCD}, {mac_addr_hexCD} <br>" . + "Where C is U(pper) or L(ower) Case, and D is \" :-.\" Delimiter (space, colon, hyphen, or period) (omitted for none). <br>" . + "Some ISPs may require certain options be or not be sent. "); ?> + </td> + </tr> + + <tr> + <td colspan="2" valign="top" height="16"></td> + </tr> + + <script type="text/javascript"> + function show_adv_dhcp_config(T) { + + if (T.checked) T.value = "Selected"; + else T.value = ""; + + if (document.iform.adv_dhcp_config_file_override.checked) show_hide_adv_dhcp('none', 'none', ''); + else if (document.iform.adv_dhcp_config_advanced.checked) show_hide_adv_dhcp('', '', 'none'); + else show_hide_adv_dhcp('', 'none', 'none'); + } + + function show_hide_adv_dhcp(basic, advanced, override) { + + document.getElementById("show_basic_dhcphostname").style.display = basic; + document.getElementById("show_basic_dhcpalias-address").style.display = basic; + + document.getElementById("show_adv_dhcp_pt_timeout").style.display = advanced; + document.getElementById("show_adv_dhcp_send_options").style.display = advanced; + document.getElementById("show_adv_dhcp_request_options").style.display = advanced; + document.getElementById("show_adv_dhcp_required_options").style.display = advanced; + document.getElementById("show_adv_dhcp_option_modifiers").style.display = advanced; + + document.getElementById("show_adv_dhcp_config_file_override").style.display = override; + } + + <!-- Set the adv_dhcp_config_advanced checkbox from saved config --> + if ("<?=htmlspecialchars($pconfig['adv_dhcp_config_advanced']);?>" == "Selected") document.iform.adv_dhcp_config_advanced.checked = true; + show_adv_dhcp_config(document.iform.adv_dhcp_config_advanced); + + <!-- Set the adv_dhcp_config_file_override checkbox from saved config --> + if ("<?=htmlspecialchars($pconfig['adv_dhcp_config_file_override']);?>" == "Selected") document.iform.adv_dhcp_config_file_override.checked = true; + show_adv_dhcp_config(document.iform.adv_dhcp_config_file_override); + </script> + </table> </td> </tr> @@ -1725,10 +2042,15 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"), <td colspan="2" style="padding: 0px;"> <table width="100%" border="0" cellpadding="6" cellspacing="0"> <tr> - <td colspan="2" valign="top" class="listtopic"><?=gettext("DHCP6 client configuration"); ?></td> + <td colspan="2" valign="top" class="listtopic"><?=gettext("DHCP6 client configuration     " . + ' <input name="adv_dhcp6_config_advanced" type="checkbox" id="adv_dhcp6_config_advanced" value="" onClick="show_adv_dhcp6_config(this)";> ' . + " Advanced     " . + ' <input name="adv_dhcp6_config_file_override" type="checkbox" id="adv_dhcp6_config_file_override" value="" onClick="show_adv_dhcp6_config(this)";> ' . + " Config File Override     "); ?> + </td> </tr> <!--- Leave commented out for now - <tr> + <tr style='display:none' name="basicdhcp6_show_dhcp6_duid" id="basicdhcp6_show_dhcp6_duid"> <td width="22%" valign="top" class="vncell"><?=gettext("DHCPv6 Unique Identifier (DUID)"); ?></td> <td width="78%" class="vtable"> <input name="dhcp6-duid" type="text" class="formfld unknown" id="dhcp6-duid" size="40" value="<?=htmlspecialchars($pconfig['dhcp6-duid']);?>"> @@ -1744,7 +2066,7 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"), </td> </tr> --> - <tr> + <tr style='display:none' name="basicdhcp6_show_dhcp6_prefix_delegation_size" id="basicdhcp6_show_dhcp6_prefix_delegation_size"> <td width="22%" valign="top" class="vncell"><?=gettext("DHCPv6 Prefix Delegation size"); ?></td> <td width="78%" class="vtable"> <select name="dhcp6-ia-pd-len" class="formselect" id="dhcp6-ia-pd-len"> @@ -1761,9 +2083,192 @@ $types6 = array("none" => gettext("None"), "staticv6" => gettext("Static IPv6"), <?=gettext("The value in this field is the delegated prefix length provided by the DHCPv6 server. Normally specified by the ISP."); ?> </td> </tr> - <tr> - <td colspan="2" valign="top" height="16"></td> + + <tr style='display:none' name="show_adv_dhcp6_interface_statement" id="show_adv_dhcp6_interface_statement"> + <td width="22%" valign="top" class="vncell"> + <?=gettext("<a target=FreeBSD DHCP href=http://www.freebsd.org/cgi/man.cgi?query=dhcp6c.conf&sektion=5&apropos=0&manpath=FreeBSD+Ports>Interface</a> <a target=FreeBSD DHCP href=http://www.freebsd.org/cgi/man.cgi?query=dhcp6c.conf&sektion=5&apropos=0&manpath=FreeBSD+Ports>Statement</a>"); ?> + <br><br> + <input name="adv_dhcp6_interface_statement_information_only_enable" type="checkbox" id="adv_dhcp6_interface_statement_information_only_enable" value="" onClick="show_adv_dhcp6_config(this)";> + <?=gettext("Information Only"); ?> + </td> + <td width="78%" class="vtable"> + <?=gettext("Send Options"); ?> + <input name="adv_dhcp6_interface_statement_send_options" type="text" class="formfld unknown" id="adv_dhcp6_interface_statement_send_options" size="86" value="<?=htmlspecialchars($pconfig['adv_dhcp6_interface_statement_send_options']);?>"> + <?=gettext("The values in this field are DHCP send options to be sent when requesting a DHCP lease. [option declaration [, ...]] <br>" . + "Value Substitutions: {interface}, {hostname}, {mac_addr_asciiCD}, {mac_addr_hexCD} <br>" . + "Where C is U(pper) or L(ower) Case, and D is \" :-.\" Delimiter (space, colon, hyphen, or period) (omitted for none). <br>" . + "Some DHCP services may require certain options be or not be sent. "); ?> + <br> + <br> + <?=gettext("Request Options"); ?> + <input name="adv_dhcp6_interface_statement_request_options" type="text" class="formfld unknown" id="adv_dhcp6_interface_statement_request_options" size="86" value="<?=htmlspecialchars($pconfig['adv_dhcp6_interface_statement_request_options']);?>"> + <br> + <?=gettext("The values in this field are DHCP request options to be sent when requesting a DHCP lease. [option [, ...]] <br>" . + "Some DHCP services may require certain options be or not be requested. "); ?> + <br> + <br> + <?=gettext("Script"); ?> + <input name="adv_dhcp6_interface_statement_script" type="text" class="formfld unknown" id="adv_dhcp6_interface_statement_script" size="86" value="<?=htmlspecialchars($pconfig['adv_dhcp6_interface_statement_script']);?>"> + <br> + <?=gettext("The value in this field is the absolute path to a script invoked on certain conditions including when a reply message is received. <br>" . + "[/[dirname/[.../]]filename[.ext]] "); ?> + </td> + </tr> + + <tr style='display:none' name="show_adv_dhcp6_id_assoc_statement" id="show_adv_dhcp6_id_assoc_statement"> + <td width="22%" valign="top" class="vncell"><?=gettext("<a target=FreeBSD DHCP href=http://www.freebsd.org/cgi/man.cgi?query=dhcp6c.conf&sektion=5&apropos=0&manpath=FreeBSD+Ports>Identity Association</a> <a target=FreeBSD DHCP href=http://www.freebsd.org/cgi/man.cgi?query=dhcp6c.conf&sektion=5&apropos=0&manpath=FreeBSD+Ports>Statement</a>"); ?></td> + <td width="78%" class="vtable"> + + <input name="adv_dhcp6_id_assoc_statement_address_enable" type="checkbox" id="adv_dhcp6_id_assoc_statement_address_enable" value="" onClick="show_adv_dhcp6_config(this)";> + <?=gettext("Non-Temporary Address Allocation"); ?> + <div style='display:none' name="show_adv_dhcp6_id_assoc_statement_address" id="show_adv_dhcp6_id_assoc_statement_address"> + <?=gettext("id-assoc na"); ?> + <?=gettext("<i>ID</i>"); ?> + <input name="adv_dhcp6_id_assoc_statement_address_id" type="text" class="formfld unknown" id="adv_dhcp6_id_assoc_statement_address_id" size="3" value="<?=htmlspecialchars($pconfig['adv_dhcp6_id_assoc_statement_address_id']);?>"> + <br> + <?=gettext("Address"); ?> + <?=gettext("<i>ipv6-address</i>"); ?> + <input name="adv_dhcp6_id_assoc_statement_address" type="text" class="formfld unknown" id="adv_dhcp6_id_assoc_statement_address" size="34" value="<?=htmlspecialchars($pconfig['adv_dhcp6_id_assoc_statement_address']);?>"> + <?=gettext("<i>pltime</i>"); ?> + <input name="adv_dhcp6_id_assoc_statement_address_pltime" type="text" class="formfld unknown" id="adv_dhcp6_id_assoc_statement_address_pltime" size="3" value="<?=htmlspecialchars($pconfig['adv_dhcp6_id_assoc_statement_address_pltime']);?>"> + <?=gettext("<i>vltime</i>"); ?> + <input name="adv_dhcp6_id_assoc_statement_address_vltime" type="text" class="formfld unknown" id="adv_dhcp6_id_assoc_statement_address_vltime" size="3" value="<?=htmlspecialchars($pconfig['adv_dhcp6_id_assoc_statement_address_vltime']);?>"> + </div> + <hr> + + <input name="adv_dhcp6_id_assoc_statement_prefix_enable" type="checkbox" id="adv_dhcp6_id_assoc_statement_prefix_enable" value="" onClick="show_adv_dhcp6_config(this)";> + <?=gettext("Prefix Delegation"); ?> + <div style='display:none' name="show_adv_dhcp6_id_assoc_statement_prefix" id="show_adv_dhcp6_id_assoc_statement_prefix"> + <?=gettext("id-assoc pd"); ?> + <?=gettext("<i>ID</i>"); ?> + <input name="adv_dhcp6_id_assoc_statement_prefix_id" type="text" class="formfld unknown" id="adv_dhcp6_id_assoc_statement_prefix_id" size="3" value="<?=htmlspecialchars($pconfig['adv_dhcp6_id_assoc_statement_prefix_id']);?>"> + <br> + <?=gettext("Prefix"); ?> + <?=gettext("<i>ipv6-prefix</i>"); ?> + <input name="adv_dhcp6_id_assoc_statement_prefix" type="text" class="formfld unknown" id="adv_dhcp6_id_assoc_statement_prefix" size="37" value="<?=htmlspecialchars($pconfig['adv_dhcp6_id_assoc_statement_prefix']);?>"> + <?=gettext("<i>pltime</i>"); ?> + <input name="adv_dhcp6_id_assoc_statement_prefix_pltime" type="text" class="formfld unknown" id="adv_dhcp6_id_assoc_statement_prefix_pltime" size="3" value="<?=htmlspecialchars($pconfig['adv_dhcp6_id_assoc_statement_prefix_pltime']);?>"> + <?=gettext("<i>vltime</i>"); ?> + <input name="adv_dhcp6_id_assoc_statement_prefix_vltime" type="text" class="formfld unknown" id="adv_dhcp6_id_assoc_statement_prefix_vltime" size="3" value="<?=htmlspecialchars($pconfig['adv_dhcp6_id_assoc_statement_prefix_vltime']);?>"> + </div> + </td> + </tr> + + <tr style='display:none' name="show_adv_dhcp6_prefix_interface_statement" id="show_adv_dhcp6_prefix_interface_statement"> + <td width="22%" valign="top" class="vncell"><?=gettext("<a target=FreeBSD DHCP href=http://www.freebsd.org/cgi/man.cgi?query=dhcp6c.conf&sektion=5&apropos=0&manpath=FreeBSD+Ports>Prefix Interface</a> <a target=FreeBSD DHCP href=http://www.freebsd.org/cgi/man.cgi?query=dhcp6c.conf&sektion=5&apropos=0&manpath=FreeBSD+Ports>Statement</a>"); ?></td> + <td width="78%" class="vtable"> + <?=gettext("Prefix Interface "); ?> + <?=gettext("<i>sla-id</i>"); ?> + <input name="adv_dhcp6_prefix_interface_statement_sla_id" type="text" class="formfld unknown" id="adv_dhcp6_prefix_interface_statement_sla_id" size="3" value="<?=htmlspecialchars($pconfig['adv_dhcp6_prefix_interface_statement_sla_id']);?>"> + <?=gettext("<i>sla-len</i>"); ?> + <input name="adv_dhcp6_prefix_interface_statement_sla_len" type="text" class="formfld unknown" id="adv_dhcp6_prefix_interface_statement_sla_len" size="3" value="<?=htmlspecialchars($pconfig['adv_dhcp6_prefix_interface_statement_sla_len']);?>"> + </td> + </tr> + + <tr style='display:none' name="show_adv_dhcp6_authentication_statement" id="show_adv_dhcp6_authentication_statement"> + <td width="22%" valign="top" class="vncell"><?=gettext("<a target=FreeBSD DHCP href=http://www.freebsd.org/cgi/man.cgi?query=dhcp6c.conf&sektion=5&apropos=0&manpath=FreeBSD+Ports>Authentication</a> <a target=FreeBSD DHCP href=http://www.freebsd.org/cgi/man.cgi?query=dhcp6c.conf&sektion=5&apropos=0&manpath=FreeBSD+Ports>Statement</a>"); ?></td> + <td width="78%" class="vtable"> + <?=gettext("<i>authname</i>"); ?> + <input name="adv_dhcp6_authentication_statement_authname" type="text" class="formfld unknown" id="adv_dhcp6_authentication_statement_authname" size="10" value="<?=htmlspecialchars($pconfig['adv_dhcp6_authentication_statement_authname']);?>"> + <?=gettext("<i>protocol</i>"); ?> + <input name="adv_dhcp6_authentication_statement_protocol" type="text" class="formfld unknown" id="adv_dhcp6_authentication_statement_protocol" size="6" value="<?=htmlspecialchars($pconfig['adv_dhcp6_authentication_statement_protocol']);?>"> + <?=gettext("<i>algorithm</i>"); ?> + <input name="adv_dhcp6_authentication_statement_algorithm" type="text" class="formfld unknown" id="adv_dhcp6_authentication_statement_algorithm" size="8" value="<?=htmlspecialchars($pconfig['adv_dhcp6_authentication_statement_algorithm']);?>"> + <?=gettext("<i>rdm</i>"); ?> + <input name="adv_dhcp6_authentication_statement_rdm" type="text" class="formfld unknown" id="adv_dhcp6_authentication_statement_rdm" size="9" value="<?=htmlspecialchars($pconfig['adv_dhcp6_authentication_statement_rdm']);?>"> + </td> </tr> + + <tr style='display:none' name="show_adv_dhcp6_key_info_statement" id="show_adv_dhcp6_key_info_statement"> + <td width="22%" valign="top" class="vncell"><?=gettext("<a target=FreeBSD DHCP href=http://www.freebsd.org/cgi/man.cgi?query=dhcp6c.conf&sektion=5&apropos=0&manpath=FreeBSD+Ports>Keyinfo</a> <a target=FreeBSD DHCP href=http://www.freebsd.org/cgi/man.cgi?query=dhcp6c.conf&sektion=5&apropos=0&manpath=FreeBSD+Ports>Statement</a>"); ?></td> + <td width="78%" class="vtable"> + <?=gettext("<i>keyname</i>"); ?> + <input name="adv_dhcp6_key_info_statement_keyname" type="text" class="formfld unknown" id="adv_dhcp6_key_info_statement_keyname" size="27" value="<?=htmlspecialchars($pconfig['adv_dhcp6_key_info_statement_keyname']);?>"> + <?=gettext("<i>realm</i>"); ?> + <input name="adv_dhcp6_key_info_statement_realm" type="text" class="formfld unknown" id="adv_dhcp6_key_info_statement_realm" size="37" value="<?=htmlspecialchars($pconfig['adv_dhcp6_key_info_statement_realm']);?>"> + <br> + <?=gettext("<i>keyid</i>"); ?> + <input name="adv_dhcp6_key_info_statement_keyid" type="text" class="formfld unknown" id="adv_dhcp6_key_info_statement_keyid" size="2" value="<?=htmlspecialchars($pconfig['adv_dhcp6_key_info_statement_keyid']);?>"> + <?=gettext("<i>secret</i>"); ?> + <input name="adv_dhcp6_key_info_statement_secret" type="text" class="formfld unknown" id="adv_dhcp6_key_info_statement_secret" size="36" value="<?=htmlspecialchars($pconfig['adv_dhcp6_key_info_statement_secret']);?>"> + <?=gettext("<i>expire</i>"); ?> + <input name="adv_dhcp6_key_info_statement_expire" type="text" class="formfld unknown" id="adv_dhcp6_key_info_statement_expire" size="15" value="<?=htmlspecialchars($pconfig['adv_dhcp6_key_info_statement_expire']);?>"> + </td> + </tr> + + <tr style='display:none' name="show_adv_dhcp6_config_file_override" id="show_adv_dhcp6_config_file_override"> + <td width="22%" valign="top" class="vncell"><?=gettext("<a target=FreeBSD DHCP href=http://www.freebsd.org/cgi/man.cgi?query=dhcp6c.conf&sektion=5&apropos=0&manpath=FreeBSD+Ports>Configuration File</a> Override"); ?></td> + <td width="78%" class="vtable"> + <input name="adv_dhcp6_config_file_override_path" type="text" class="formfld unknown" id="adv_dhcp6_config_file_override_path" size="86" value="<?=htmlspecialchars($pconfig['adv_dhcp6_config_file_override_path']);?>"> + <br> + <?=gettext("The value in this field is the full absolute path to a DHCP client configuration file. [/[dirname/[.../]]filename[.ext]] <br> " . + "Value Substitutions in Config File: {interface}, {hostname}, {mac_addr_asciiCD}, {mac_addr_hexCD} <br>" . + "Where C is U(pper) or L(ower) Case, and D is \" :-.\" Delimiter (space, colon, hyphen, or period) (omitted for none). <br>" . + "Some ISPs may require certain options be or not be sent. "); ?> + </td> + </tr> + + <tr> + <td colspan="2" valign="top" height="16"></td> + </tr> + + <script type="text/javascript"> + function show_adv_dhcp6_config(T) { + + if (T.checked) T.value = "Selected"; + else T.value = ""; + + if (document.iform.adv_dhcp6_config_file_override.checked) show_hide_adv_dhcp6('none', 'none', '' ); + else if (document.iform.adv_dhcp6_config_advanced.checked) show_hide_adv_dhcp6('none', '', 'none'); + else show_hide_adv_dhcp6('', 'none', 'none'); + } + + function show_hide_adv_dhcp6(basic, advanced, override) { + + document.getElementById("basicdhcp6_show_dhcp6_prefix_delegation_size").style.display = basic; + + document.getElementById("show_adv_dhcp6_interface_statement").style.display = advanced; + document.getElementById("show_adv_dhcp6_id_assoc_statement").style.display = advanced; + + document.getElementById("show_adv_dhcp6_id_assoc_statement_address").style.display = 'none'; + if (document.iform.adv_dhcp6_id_assoc_statement_address_enable.checked) { + document.getElementById("show_adv_dhcp6_id_assoc_statement_address").style.display = advanced; + } + + document.getElementById("show_adv_dhcp6_id_assoc_statement_prefix").style.display = 'none'; + document.getElementById("show_adv_dhcp6_prefix_interface_statement").style.display = 'none'; + if (document.iform.adv_dhcp6_id_assoc_statement_prefix_enable.checked) { + document.getElementById("show_adv_dhcp6_id_assoc_statement_prefix").style.display = advanced; + document.getElementById("show_adv_dhcp6_prefix_interface_statement").style.display = advanced; + } + + document.getElementById("show_adv_dhcp6_authentication_statement").style.display = advanced; + document.getElementById("show_adv_dhcp6_key_info_statement").style.display = advanced; + + document.getElementById("show_adv_dhcp6_config_file_override").style.display = override; + } + + <!-- Set the adv_dhcp6_config_advanced checkbox from saved config --> + if ("<?=htmlspecialchars($pconfig['adv_dhcp6_config_advanced']);?>" == "Selected") document.iform.adv_dhcp6_config_advanced.checked = true; + show_adv_dhcp6_config(document.iform.adv_dhcp6_config_advanced); + + <!-- Set the adv_dhcp6_config_file_override checkbox from saved config --> + if ("<?=htmlspecialchars($pconfig['adv_dhcp6_config_file_override']);?>" == "Selected") document.iform.adv_dhcp6_config_file_override.checked = true; + show_adv_dhcp6_config(document.iform.adv_dhcp6_config_file_override); + + <!-- Set the adv_dhcp6_interface_statement_information_only_enable checkbox from saved config --> + if ("<?=htmlspecialchars($pconfig['adv_dhcp6_interface_statement_information_only_enable']);?>" == "Selected") document.iform.adv_dhcp6_interface_statement_information_only_enable.checked = true; + show_adv_dhcp6_config(document.iform.adv_dhcp6_interface_statement_information_only_enable); + + <!-- Set the adv_dhcp6_id_assoc_statement_address_enable checkbox from saved config --> + if ("<?=htmlspecialchars($pconfig['adv_dhcp6_id_assoc_statement_address_enable']);?>" == "Selected") document.iform.adv_dhcp6_id_assoc_statement_address_enable.checked = true; + show_adv_dhcp6_config(document.iform.adv_dhcp6_id_assoc_statement_address_enable); + + <!-- Set the adv_dhcp6_id_assoc_statement_prefix_enable checkbox from saved config --> + if ("<?=htmlspecialchars($pconfig['adv_dhcp6_id_assoc_statement_prefix_enable']);?>" == "Selected") document.iform.adv_dhcp6_id_assoc_statement_prefix_enable.checked = true; + show_adv_dhcp6_config(document.iform.adv_dhcp6_id_assoc_statement_prefix_enable); + </script> + </table> </td> </tr> |