Revision d623f2da
Added by Seth Mos almost 14 years ago
usr/local/www/system.php | ||
---|---|---|
49 | 49 |
$pconfig['domain'] = $config['system']['domain']; |
50 | 50 |
list($pconfig['dns1'],$pconfig['dns2'],$pconfig['dns3'],$pconfig['dns4']) = $config['system']['dnsserver']; |
51 | 51 |
|
52 |
$pconfig['dns1gwint'] = $config['system']['dns1gwint']; |
|
53 |
$pconfig['dns2gwint'] = $config['system']['dns2gwint']; |
|
54 |
$pconfig['dns3gwint'] = $config['system']['dns3gwint']; |
|
55 |
$pconfig['dns4gwint'] = $config['system']['dns4gwint']; |
|
52 |
$arr_gateways = return_gateways_array(); |
|
53 |
|
|
54 |
$pconfig['dns1gw'] = $config['system']['dns1gw']; |
|
55 |
$pconfig['dns2gw'] = $config['system']['dns2gw']; |
|
56 |
$pconfig['dns3gw'] = $config['system']['dns3gw']; |
|
57 |
$pconfig['dns4gw'] = $config['system']['dns4gw']; |
|
56 | 58 |
|
57 | 59 |
$pconfig['dnsallowoverride'] = isset($config['system']['dnsallowoverride']); |
58 | 60 |
$pconfig['timezone'] = $config['system']['timezone']; |
... | ... | |
116 | 118 |
if ($_POST['domain'] && !is_domain($_POST['domain'])) { |
117 | 119 |
$input_errors[] = gettext("The domain may only contain the characters a-z, 0-9, '-' and '.'."); |
118 | 120 |
} |
119 |
if (($_POST['dns1'] && !is_ipaddr($_POST['dns1'])) || ($_POST['dns2'] && !is_ipaddr($_POST['dns2']))) { |
|
120 |
$input_errors[] = gettext("A valid IP address must be specified for the primary/secondary DNS server."); |
|
121 |
|
|
122 |
for ($dnscounter=1; $dnscounter<5; $dnscounter++){ |
|
123 |
$dnsname="dns{$dnscounter}"; |
|
124 |
$dnsgwname="dns{$dnscounter}gw"; |
|
125 |
if (($_POST[$dnsname] && !is_ipaddr($_POST[$dnsname]))) { |
|
126 |
$input_errors[] = gettext("A valid IP address must be specified for the DNS server $dnscounter."); |
|
127 |
} |
|
128 |
if (($_POST[$dnsgwname] && validate_address_family(lookup_gateway_ip_by_name($_POST[$dnsgwname])))) { |
|
129 |
$input_errors[] = gettext("The gateway specified for DNS server $dnscounter is not from the same Address Family."); |
|
130 |
} |
|
121 | 131 |
} |
122 |
if (($_POST['dns3'] && !is_ipaddr($_POST['dns3'])) || ($_POST['dns4'] && !is_ipaddr($_POST['dns4']))) { |
|
123 |
$input_errors[] = gettext("A valid IP address must be specified for the primary/secondary DNS server."); |
|
124 |
} |
|
132 |
|
|
125 | 133 |
if ($_POST['webguiport'] && (!is_numericint($_POST['webguiport']) || |
126 | 134 |
($_POST['webguiport'] < 1) || ($_POST['webguiport'] > 65535))) { |
127 | 135 |
$input_errors[] = gettext("A valid TCP/IP port must be specified for the webConfigurator port."); |
... | ... | |
130 | 138 |
$direct_networks_list = explode(" ", filter_get_direct_networks_list()); |
131 | 139 |
for ($dnscounter=1; $dnscounter<5; $dnscounter++) { |
132 | 140 |
$dnsitem = "dns{$dnscounter}"; |
133 |
$dnsgwitem = "dns{$dnscounter}gwint";
|
|
141 |
$dnsgwitem = "dns{$dnscounter}gw"; |
|
134 | 142 |
if ($_POST[$dnsgwitem]) { |
135 | 143 |
if(interface_has_gateway($_POST[$dnsgwitem])) { |
136 | 144 |
foreach($direct_networks_list as $direct_network) { |
... | ... | |
182 | 190 |
$config['system']['dnsallowoverride'] = $_POST['dnsallowoverride'] ? true : false; |
183 | 191 |
|
184 | 192 |
/* which interface should the dns servers resolve through? */ |
185 |
if($_POST['dns1gwint']) |
|
186 |
$config['system']['dns1gwint'] = $pconfig['dns1gwint']; |
|
187 |
else |
|
188 |
unset($config['system']['dns1gwint']); |
|
189 |
|
|
190 |
if($_POST['dns2gwint']) |
|
191 |
$config['system']['dns2gwint'] = $pconfig['dns2gwint']; |
|
192 |
else |
|
193 |
unset($config['system']['dns2gwint']); |
|
194 |
|
|
195 |
if($_POST['dns3gwint']) |
|
196 |
$config['system']['dns3gwint'] = $pconfig['dns3gwint']; |
|
197 |
else |
|
198 |
unset($config['system']['dns3gwint']); |
|
199 |
|
|
200 |
if($_POST['dns4gwint']) |
|
201 |
$config['system']['dns4gwint'] = $pconfig['dns4gwint']; |
|
202 |
else |
|
203 |
unset($config['system']['dns4gwint']); |
|
193 |
for ($dnscounter=1; $dnscounter<5; $dnscounter++) { |
|
194 |
$dnsname="dns{$dnscounter}"; |
|
195 |
$dnsgwname="dns{$dnscounter}gw"; |
|
196 |
if($_POST[$dnsgwname]) { |
|
197 |
$config['system'][$dnsgwname] = $pconfig[$dnsgwname]; |
|
198 |
} else { |
|
199 |
unset($config['system'][$dnsgwname]); |
|
200 |
} |
|
201 |
} |
|
204 | 202 |
|
205 | 203 |
if ($changecount > 0) |
206 | 204 |
write_config($changedesc); |
... | ... | |
280 | 278 |
</tr> |
281 | 279 |
<?php |
282 | 280 |
for ($dnscounter=1; $dnscounter<5; $dnscounter++): |
283 |
$fldname="dns{$dnscounter}gwint";
|
|
281 |
$fldname="dns{$dnscounter}gw"; |
|
284 | 282 |
?> |
285 | 283 |
<tr> |
286 | 284 |
<td> |
... | ... | |
290 | 288 |
<?php if ($multiwan): ?> |
291 | 289 |
<select name='<?=$fldname;?>'> |
292 | 290 |
<?php |
293 |
$interface = "none";
|
|
294 |
$dnsgw = "dns{$dnscounter}gwint";
|
|
295 |
if($pconfig[$dnsgw] == $interface) {
|
|
291 |
$gwname = "none";
|
|
292 |
$dnsgw = "dns{$dnscounter}gw"; |
|
293 |
if($pconfig[$dnsgw] == $gwname) {
|
|
296 | 294 |
$selected = "selected"; |
297 | 295 |
} else { |
298 | 296 |
$selected = ""; |
299 | 297 |
} |
300 |
echo "<option value='$interface' $selected>". ucwords($interface) ."</option>\n"; |
|
301 |
foreach($interfaces as $interface) { |
|
302 |
if(interface_has_gateway($interface)) { |
|
303 |
if($pconfig[$dnsgw] == $interface) { |
|
304 |
$selected = "selected"; |
|
305 |
} else { |
|
306 |
$selected = ""; |
|
307 |
} |
|
308 |
$friendly_interface = convert_friendly_interface_to_friendly_descr($interface); |
|
309 |
echo "<option value='$interface' $selected>". ucwords($friendly_interface) ."</option>\n"; |
|
298 |
echo "<option value='$gwname' $selected>$gwname</option>\n"; |
|
299 |
foreach($arr_gateways as $gwname => $gwitem) { |
|
300 |
echo $pconfig[$dnsgw]; |
|
301 |
if((is_ipaddrv4(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv6($gwitem['gateway'])))) { |
|
302 |
continue; |
|
303 |
} |
|
304 |
if((is_ipaddrv6(lookup_gateway_ip_by_name($pconfig[$dnsgw])) && (is_ipaddrv4($gwitem['gateway'])))) { |
|
305 |
continue; |
|
306 |
} |
|
307 |
if($pconfig[$dnsgw] == $gwname) { |
|
308 |
$selected = "selected"; |
|
309 |
} else { |
|
310 |
$selected = ""; |
|
310 | 311 |
} |
312 |
echo "<option value='$gwname' $selected>$gwname - {$gwitem['friendlyiface']} - {$gwitem['gateway']} |
|
313 |
</option>\n"; |
|
311 | 314 |
} |
312 | 315 |
?> |
313 | 316 |
</select> |
Also available in: Unified diff
Change the DNS interface code to DNS gateway code. This will need upgrade code for existing configs.