1 |
5b237745
|
Scott Ullrich
|
<?php
|
2 |
b46bfcf5
|
Bill Marquette
|
/* $Id$ */
|
3 |
5b237745
|
Scott Ullrich
|
/*
|
4 |
|
|
services_dnsmasq.php
|
5 |
|
|
part of m0n0wall (http://m0n0.ch/wall)
|
6 |
f0fe3d30
|
Scott Ullrich
|
|
7 |
5b237745
|
Scott Ullrich
|
Copyright (C) 2003-2004 Bob Zoller <bob@kludgebox.com> and Manuel Kasper <mk@neon1.net>.
|
8 |
ce77a9c4
|
Phil Davis
|
Copyright (C) 2013-2015 Electric Sheep Fencing, LP
|
9 |
5b237745
|
Scott Ullrich
|
All rights reserved.
|
10 |
f0fe3d30
|
Scott Ullrich
|
|
11 |
5b237745
|
Scott Ullrich
|
Redistribution and use in source and binary forms, with or without
|
12 |
|
|
modification, are permitted provided that the following conditions are met:
|
13 |
f0fe3d30
|
Scott Ullrich
|
|
14 |
5b237745
|
Scott Ullrich
|
1. Redistributions of source code must retain the above copyright notice,
|
15 |
|
|
this list of conditions and the following disclaimer.
|
16 |
f0fe3d30
|
Scott Ullrich
|
|
17 |
5b237745
|
Scott Ullrich
|
2. Redistributions in binary form must reproduce the above copyright
|
18 |
|
|
notice, this list of conditions and the following disclaimer in the
|
19 |
|
|
documentation and/or other materials provided with the distribution.
|
20 |
f0fe3d30
|
Scott Ullrich
|
|
21 |
5b237745
|
Scott Ullrich
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
22 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
23 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
24 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
25 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
26 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
27 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
28 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
29 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
30 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
31 |
|
|
*/
|
32 |
70edf50d
|
jim-p
|
/*
|
33 |
1d333258
|
Scott Ullrich
|
pfSense_MODULE: dnsforwarder
|
34 |
|
|
*/
|
35 |
5b237745
|
Scott Ullrich
|
|
36 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
37 |
|
|
##|*IDENT=page-services-dnsforwarder
|
38 |
|
|
##|*NAME=Services: DNS Forwarder page
|
39 |
|
|
##|*DESCR=Allow access to the 'Services: DNS Forwarder' page.
|
40 |
|
|
##|*MATCH=services_dnsmasq.php*
|
41 |
|
|
##|-PRIV
|
42 |
|
|
|
43 |
5b237745
|
Scott Ullrich
|
require("guiconfig.inc");
|
44 |
7a927e67
|
Scott Ullrich
|
require_once("functions.inc");
|
45 |
|
|
require_once("filter.inc");
|
46 |
|
|
require_once("shaper.inc");
|
47 |
4dbcf2fb
|
Renato Botelho
|
require_once("system.inc");
|
48 |
5b237745
|
Scott Ullrich
|
|
49 |
70edf50d
|
jim-p
|
$pconfig['enable'] = isset($config['dnsmasq']['enable']);
|
50 |
5b237745
|
Scott Ullrich
|
$pconfig['regdhcp'] = isset($config['dnsmasq']['regdhcp']);
|
51 |
6a01ea44
|
Bill Marquette
|
$pconfig['regdhcpstatic'] = isset($config['dnsmasq']['regdhcpstatic']);
|
52 |
aa994814
|
Andrew Thompson
|
$pconfig['dhcpfirst'] = isset($config['dnsmasq']['dhcpfirst']);
|
53 |
96ea7162
|
N0YB
|
$pconfig['strict_order'] = isset($config['dnsmasq']['strict_order']);
|
54 |
|
|
$pconfig['domain_needed'] = isset($config['dnsmasq']['domain_needed']);
|
55 |
7bdd28fb
|
Phil Davis
|
$pconfig['no_private_reverse'] = isset($config['dnsmasq']['no_private_reverse']);
|
56 |
e6c49e3d
|
jim-p
|
$pconfig['port'] = $config['dnsmasq']['port'];
|
57 |
8f9bffbc
|
Andrew Thompson
|
$pconfig['custom_options'] = $config['dnsmasq']['custom_options'];
|
58 |
5b237745
|
Scott Ullrich
|
|
59 |
b4323f39
|
jim-p
|
$pconfig['strictbind'] = isset($config['dnsmasq']['strictbind']);
|
60 |
79d03c40
|
jim-p
|
if (!empty($config['dnsmasq']['interface']))
|
61 |
|
|
$pconfig['interface'] = explode(",", $config['dnsmasq']['interface']);
|
62 |
|
|
else
|
63 |
|
|
$pconfig['interface'] = array();
|
64 |
b4323f39
|
jim-p
|
|
65 |
70edf50d
|
jim-p
|
if (!is_array($config['dnsmasq']['hosts']))
|
66 |
5b237745
|
Scott Ullrich
|
$config['dnsmasq']['hosts'] = array();
|
67 |
0c2b5df7
|
Scott Ullrich
|
|
68 |
70edf50d
|
jim-p
|
if (!is_array($config['dnsmasq']['domainoverrides']))
|
69 |
|
|
$config['dnsmasq']['domainoverrides'] = array();
|
70 |
0c2b5df7
|
Scott Ullrich
|
|
71 |
4d6ba181
|
Scott Ullrich
|
|
72 |
70edf50d
|
jim-p
|
$a_hosts = &$config['dnsmasq']['hosts'];
|
73 |
0c2b5df7
|
Scott Ullrich
|
$a_domainOverrides = &$config['dnsmasq']['domainoverrides'];
|
74 |
5b237745
|
Scott Ullrich
|
|
75 |
|
|
if ($_POST) {
|
76 |
|
|
|
77 |
|
|
$pconfig = $_POST;
|
78 |
8f9bffbc
|
Andrew Thompson
|
unset($input_errors);
|
79 |
5b237745
|
Scott Ullrich
|
|
80 |
|
|
$config['dnsmasq']['enable'] = ($_POST['enable']) ? true : false;
|
81 |
|
|
$config['dnsmasq']['regdhcp'] = ($_POST['regdhcp']) ? true : false;
|
82 |
6a01ea44
|
Bill Marquette
|
$config['dnsmasq']['regdhcpstatic'] = ($_POST['regdhcpstatic']) ? true : false;
|
83 |
aa994814
|
Andrew Thompson
|
$config['dnsmasq']['dhcpfirst'] = ($_POST['dhcpfirst']) ? true : false;
|
84 |
96ea7162
|
N0YB
|
$config['dnsmasq']['strict_order'] = ($_POST['strict_order']) ? true : false;
|
85 |
|
|
$config['dnsmasq']['domain_needed'] = ($_POST['domain_needed']) ? true : false;
|
86 |
7bdd28fb
|
Phil Davis
|
$config['dnsmasq']['no_private_reverse'] = ($_POST['no_private_reverse']) ? true : false;
|
87 |
8f9bffbc
|
Andrew Thompson
|
$config['dnsmasq']['custom_options'] = str_replace("\r\n", "\n", $_POST['custom_options']);
|
88 |
b4323f39
|
jim-p
|
$config['dnsmasq']['strictbind'] = ($_POST['strictbind']) ? true : false;
|
89 |
8f9bffbc
|
Andrew Thompson
|
|
90 |
06e847a7
|
Chris Buechler
|
if (isset($_POST['enable']) && isset($config['unbound']['enable'])) {
|
91 |
|
|
if ($_POST['port'] == $config['unbound']['port'])
|
92 |
|
|
$input_errors[] = "The DNS Resolver is enabled using this port. Choose a non-conflicting port, or disable DNS Resolver.";
|
93 |
|
|
}
|
94 |
|
|
|
95 |
e6c49e3d
|
jim-p
|
if ($_POST['port'])
|
96 |
|
|
if(is_port($_POST['port']))
|
97 |
|
|
$config['dnsmasq']['port'] = $_POST['port'];
|
98 |
|
|
else
|
99 |
|
|
$input_errors[] = gettext("You must specify a valid port number");
|
100 |
|
|
else if (isset($config['dnsmasq']['port']))
|
101 |
|
|
unset($config['dnsmasq']['port']);
|
102 |
|
|
|
103 |
b4323f39
|
jim-p
|
if (is_array($_POST['interface']))
|
104 |
|
|
$config['dnsmasq']['interface'] = implode(",", $_POST['interface']);
|
105 |
|
|
elseif (isset($config['dnsmasq']['interface']))
|
106 |
|
|
unset($config['dnsmasq']['interface']);
|
107 |
e6c49e3d
|
jim-p
|
|
108 |
8f9bffbc
|
Andrew Thompson
|
if ($config['dnsmasq']['custom_options']) {
|
109 |
|
|
$args = '';
|
110 |
|
|
foreach (preg_split('/\s+/', $config['dnsmasq']['custom_options']) as $c)
|
111 |
071f6059
|
jim-p
|
$args .= escapeshellarg("--{$c}") . " ";
|
112 |
8f9bffbc
|
Andrew Thompson
|
exec("/usr/local/sbin/dnsmasq --test $args", $output, $rc);
|
113 |
|
|
if ($rc != 0)
|
114 |
|
|
$input_errors[] = gettext("Invalid custom options");
|
115 |
|
|
}
|
116 |
5b237745
|
Scott Ullrich
|
|
117 |
8f9bffbc
|
Andrew Thompson
|
if (!$input_errors) {
|
118 |
|
|
write_config();
|
119 |
f0fe3d30
|
Scott Ullrich
|
|
120 |
8f9bffbc
|
Andrew Thompson
|
$retval = 0;
|
121 |
|
|
$retval = services_dnsmasq_configure();
|
122 |
|
|
$savemsg = get_std_save_message($retval);
|
123 |
5b237745
|
Scott Ullrich
|
|
124 |
8f9bffbc
|
Andrew Thompson
|
// Relaod filter (we might need to sync to CARP hosts)
|
125 |
|
|
filter_configure();
|
126 |
bd5737dc
|
jim-p
|
/* Update resolv.conf in case the interface bindings exclude localhost. */
|
127 |
|
|
system_resolvconf_generate();
|
128 |
4dbcf2fb
|
Renato Botelho
|
/* Start or restart dhcpleases when it's necessary */
|
129 |
|
|
system_dhcpleases_configure();
|
130 |
020d757a
|
Scott Ullrich
|
|
131 |
8f9bffbc
|
Andrew Thompson
|
if ($retval == 0)
|
132 |
|
|
clear_subsystem_dirty('hosts');
|
133 |
|
|
}
|
134 |
5b237745
|
Scott Ullrich
|
}
|
135 |
|
|
|
136 |
|
|
if ($_GET['act'] == "del") {
|
137 |
70edf50d
|
jim-p
|
if ($_GET['type'] == 'host') {
|
138 |
|
|
if ($a_hosts[$_GET['id']]) {
|
139 |
|
|
unset($a_hosts[$_GET['id']]);
|
140 |
|
|
write_config();
|
141 |
a368a026
|
Ermal Lu?i
|
mark_subsystem_dirty('hosts');
|
142 |
70edf50d
|
jim-p
|
header("Location: services_dnsmasq.php");
|
143 |
|
|
exit;
|
144 |
|
|
}
|
145 |
|
|
}
|
146 |
|
|
elseif ($_GET['type'] == 'doverride') {
|
147 |
|
|
if ($a_domainOverrides[$_GET['id']]) {
|
148 |
|
|
unset($a_domainOverrides[$_GET['id']]);
|
149 |
|
|
write_config();
|
150 |
a368a026
|
Ermal Lu?i
|
mark_subsystem_dirty('hosts');
|
151 |
70edf50d
|
jim-p
|
header("Location: services_dnsmasq.php");
|
152 |
|
|
exit;
|
153 |
|
|
}
|
154 |
|
|
}
|
155 |
5b237745
|
Scott Ullrich
|
}
|
156 |
0c2b5df7
|
Scott Ullrich
|
|
157 |
7bd5b320
|
Colin Fleming
|
$closehead = false;
|
158 |
beb2bc00
|
Rafael Lucas
|
$pgtitle = array(gettext("Services"),gettext("DNS forwarder"));
|
159 |
db88a3a2
|
Phil Davis
|
$shortcut_section = "forwarder";
|
160 |
b63695db
|
Scott Ullrich
|
include("head.inc");
|
161 |
0c2b5df7
|
Scott Ullrich
|
|
162 |
5b237745
|
Scott Ullrich
|
?>
|
163 |
|
|
|
164 |
91f026b0
|
ayvis
|
<script type="text/javascript">
|
165 |
7bd5b320
|
Colin Fleming
|
//<![CDATA[
|
166 |
6a01ea44
|
Bill Marquette
|
function enable_change(enable_over) {
|
167 |
|
|
var endis;
|
168 |
|
|
endis = !(document.iform.enable.checked || enable_over);
|
169 |
|
|
document.iform.regdhcp.disabled = endis;
|
170 |
|
|
document.iform.regdhcpstatic.disabled = endis;
|
171 |
aa994814
|
Andrew Thompson
|
document.iform.dhcpfirst.disabled = endis;
|
172 |
6a01ea44
|
Bill Marquette
|
}
|
173 |
8f9bffbc
|
Andrew Thompson
|
function show_advanced_dns() {
|
174 |
|
|
document.getElementById("showadvbox").innerHTML='';
|
175 |
|
|
aodiv = document.getElementById('showadv');
|
176 |
|
|
aodiv.style.display = "block";
|
177 |
|
|
}
|
178 |
7bd5b320
|
Colin Fleming
|
//]]>
|
179 |
6a01ea44
|
Bill Marquette
|
</script>
|
180 |
7bd5b320
|
Colin Fleming
|
</head>
|
181 |
5b237745
|
Scott Ullrich
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
182 |
|
|
<?php include("fbegin.inc"); ?>
|
183 |
6a01ea44
|
Bill Marquette
|
<form action="services_dnsmasq.php" method="post" name="iform" id="iform">
|
184 |
8f9bffbc
|
Andrew Thompson
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
185 |
5b237745
|
Scott Ullrich
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
186 |
7bd5b320
|
Colin Fleming
|
<?php if (is_subsystem_dirty('hosts')): ?><br/>
|
187 |
8cd558b6
|
ayvis
|
<?php print_info_box_np(gettext("The DNS forwarder configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));?><br />
|
188 |
5b237745
|
Scott Ullrich
|
<?php endif; ?>
|
189 |
7bd5b320
|
Colin Fleming
|
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="dns forwarder">
|
190 |
70edf50d
|
jim-p
|
<tr>
|
191 |
6661dbcf
|
jim-p
|
<td colspan="2" valign="top" class="listtopic"><?=gettext("General DNS Forwarder Options");?></td>
|
192 |
|
|
</tr>
|
193 |
|
|
<tr>
|
194 |
|
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Enable");?></td>
|
195 |
|
|
<td width="78%" class="vtable"><p>
|
196 |
7bd5b320
|
Colin Fleming
|
<input name="enable" type="checkbox" id="enable" value="yes" <?php if ($pconfig['enable'] == "yes") echo "checked=\"checked\"";?> onclick="enable_change(false)" />
|
197 |
8cd558b6
|
ayvis
|
<strong><?=gettext("Enable DNS forwarder");?><br />
|
198 |
70edf50d
|
jim-p
|
</strong></p></td>
|
199 |
98776e04
|
jim-p
|
</tr>
|
200 |
70edf50d
|
jim-p
|
<tr>
|
201 |
6661dbcf
|
jim-p
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("DHCP Registration");?></td>
|
202 |
|
|
<td width="78%" class="vtable"><p>
|
203 |
7bd5b320
|
Colin Fleming
|
<input name="regdhcp" type="checkbox" id="regdhcp" value="yes" <?php if ($pconfig['regdhcp'] == "yes") echo "checked=\"checked\"";?> />
|
204 |
8cd558b6
|
ayvis
|
<strong><?=gettext("Register DHCP leases in DNS forwarder");?><br />
|
205 |
70edf50d
|
jim-p
|
</strong><?php printf(gettext("If this option is set, then machines that specify".
|
206 |
|
|
" their hostname when requesting a DHCP lease will be registered".
|
207 |
|
|
" in the DNS forwarder, so that their name can be resolved.".
|
208 |
|
|
" You should also set the domain in %sSystem:".
|
209 |
|
|
" General setup%s to the proper value."),'<a href="system.php">','</a>')?></p>
|
210 |
|
|
</td>
|
211 |
|
|
</tr>
|
212 |
|
|
<tr>
|
213 |
6661dbcf
|
jim-p
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Static DHCP");?></td>
|
214 |
|
|
<td width="78%" class="vtable"><p>
|
215 |
7bd5b320
|
Colin Fleming
|
<input name="regdhcpstatic" type="checkbox" id="regdhcpstatic" value="yes" <?php if ($pconfig['regdhcpstatic'] == "yes") echo "checked=\"checked\"";?> />
|
216 |
8cd558b6
|
ayvis
|
<strong><?=gettext("Register DHCP static mappings in DNS forwarder");?><br />
|
217 |
70edf50d
|
jim-p
|
</strong><?php printf(gettext("If this option is set, then DHCP static mappings will ".
|
218 |
|
|
"be registered in the DNS forwarder, so that their name can be ".
|
219 |
|
|
"resolved. You should also set the domain in %s".
|
220 |
|
|
"System: General setup%s to the proper value."),'<a href="system.php">','</a>');?></p>
|
221 |
|
|
</td>
|
222 |
|
|
</tr>
|
223 |
aa994814
|
Andrew Thompson
|
<tr>
|
224 |
6661dbcf
|
jim-p
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Prefer DHCP");?></td>
|
225 |
|
|
<td width="78%" class="vtable"><p>
|
226 |
7bd5b320
|
Colin Fleming
|
<input name="dhcpfirst" type="checkbox" id="dhcpfirst" value="yes" <?php if ($pconfig['dhcpfirst'] == "yes") echo "checked=\"checked\"";?> />
|
227 |
8cd558b6
|
ayvis
|
<strong><?=gettext("Resolve DHCP mappings first");?><br />
|
228 |
aa994814
|
Andrew Thompson
|
</strong><?php printf(gettext("If this option is set, then DHCP mappings will ".
|
229 |
|
|
"be resolved before the manual list of names below. This only ".
|
230 |
649ea752
|
Andrew Thompson
|
"affects the name given for a reverse lookup (PTR)."));?></p>
|
231 |
aa994814
|
Andrew Thompson
|
</td>
|
232 |
|
|
</tr>
|
233 |
96ea7162
|
N0YB
|
<tr>
|
234 |
7bdd28fb
|
Phil Davis
|
<td rowspan="3" width="22%" valign="top" class="vncellreq"><?=gettext("DNS Query Forwarding");?></td>
|
235 |
96ea7162
|
N0YB
|
<td width="78%" class="vtable"><p>
|
236 |
7bd5b320
|
Colin Fleming
|
<input name="strict_order" type="checkbox" id="strict_order" value="yes" <?php if ($pconfig['strict_order'] == "yes") echo "checked=\"checked\"";?> />
|
237 |
8cd558b6
|
ayvis
|
<strong><?=gettext("Query DNS servers sequentially");?><br />
|
238 |
96ea7162
|
N0YB
|
</strong><?php printf(gettext("If this option is set, %s DNS Forwarder (dnsmasq) will ".
|
239 |
|
|
"query the DNS servers sequentially in the order specified (<i>System - General Setup - DNS Servers</i>), ".
|
240 |
|
|
"rather than all at once in parallel. ".
|
241 |
|
|
""), $g['product_name']); ?></p>
|
242 |
|
|
</td>
|
243 |
|
|
</tr>
|
244 |
|
|
<tr>
|
245 |
|
|
<td width="78%" class="vtable"><p>
|
246 |
7bd5b320
|
Colin Fleming
|
<input name="domain_needed" type="checkbox" id="domain_needed" value="yes" <?php if ($pconfig['domain_needed'] == "yes") echo "checked=\"checked\"";?> />
|
247 |
8cd558b6
|
ayvis
|
<strong><?=gettext("Require domain");?><br />
|
248 |
96ea7162
|
N0YB
|
</strong><?php printf(gettext("If this option is set, %s DNS Forwarder (dnsmasq) will ".
|
249 |
|
|
"not forward A or AAAA queries for plain names, without dots or domain parts, to upstream name servers. ".
|
250 |
|
|
"If the name is not known from /etc/hosts or DHCP then a \"not found\" answer is returned. ".
|
251 |
|
|
""), $g['product_name']); ?></p>
|
252 |
|
|
</td>
|
253 |
|
|
</tr>
|
254 |
7bdd28fb
|
Phil Davis
|
<tr>
|
255 |
|
|
<td width="78%" class="vtable"><p>
|
256 |
7bd5b320
|
Colin Fleming
|
<input name="no_private_reverse" type="checkbox" id="no_private_reverse" value="yes" <?php if ($pconfig['no_private_reverse'] == "yes") echo "checked=\"checked\"";?> />
|
257 |
8cd558b6
|
ayvis
|
<strong><?=gettext("Do not forward private reverse lookups");?><br />
|
258 |
7bdd28fb
|
Phil Davis
|
</strong><?php printf(gettext("If this option is set, %s DNS Forwarder (dnsmasq) will ".
|
259 |
|
|
"not forward reverse DNS lookups (PTR) for private addresses (RFC 1918) to upstream name servers. ".
|
260 |
|
|
"Any entries in the Domain Overrides section forwarding private \"n.n.n.in-addr.arpa\" names to a specific server are still forwarded. ".
|
261 |
|
|
"If the IP to name is not known from /etc/hosts, DHCP or a specific domain override then a \"not found\" answer is immediately returned. ".
|
262 |
|
|
""), $g['product_name']); ?></p>
|
263 |
|
|
</td>
|
264 |
|
|
</tr>
|
265 |
e6c49e3d
|
jim-p
|
<tr>
|
266 |
|
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Listen Port");?></td>
|
267 |
|
|
<td width="78%" class="vtable"><p>
|
268 |
7bd5b320
|
Colin Fleming
|
<input name="port" type="text" id="port" size="6" <?php if ($pconfig['port']) echo "value=\"{$pconfig['port']}\"";?> />
|
269 |
e6c49e3d
|
jim-p
|
<br /><br />
|
270 |
|
|
<?=gettext("The port used for responding to DNS queries. It should normally be left blank unless another service needs to bind to TCP/UDP port 53.");?></p>
|
271 |
|
|
</td>
|
272 |
|
|
</tr>
|
273 |
b4323f39
|
jim-p
|
<tr>
|
274 |
|
|
<td width="22%" valign="top" rowspan="2" class="vncellreq"><?=gettext("Interfaces"); ?></td>
|
275 |
|
|
<td width="78%" class="vtable">
|
276 |
|
|
<?php
|
277 |
|
|
$interface_addresses = get_possible_listen_ips(true);
|
278 |
|
|
?>
|
279 |
79d03c40
|
jim-p
|
<?=gettext("Interface IPs used by the DNS Forwarder for responding to queries from clients. If an interface has both IPv4 and IPv6 IPs, both are used. Queries to other interface IPs not selected below are discarded. The default behavior is to respond to queries on every available IPv4 and IPv6 address.");?>
|
280 |
b4323f39
|
jim-p
|
<br /><br />
|
281 |
89f171b0
|
Ermal LUÇI
|
<select id="interface" name="interface[]" multiple="multiple" class="formselect" size="5">
|
282 |
5c048099
|
Warren Baker
|
<option value="" <?php if (empty($pconfig['interface']) || empty($pconfig['interface'][0])) echo 'selected="selected"'; ?>>All</option>
|
283 |
89f171b0
|
Ermal LUÇI
|
<?php foreach ($interface_addresses as $laddr => $ldescr):
|
284 |
b4323f39
|
jim-p
|
$selected = "";
|
285 |
89f171b0
|
Ermal LUÇI
|
if (in_array($laddr, $pconfig['interface']))
|
286 |
b4323f39
|
jim-p
|
$selected = 'selected="selected"';
|
287 |
|
|
?>
|
288 |
89f171b0
|
Ermal LUÇI
|
<option value="<?=$laddr;?>" <?=$selected;?>>
|
289 |
|
|
<?=htmlspecialchars($ldescr);?>
|
290 |
b4323f39
|
jim-p
|
</option>
|
291 |
89f171b0
|
Ermal LUÇI
|
<?php endforeach;
|
292 |
|
|
unset($interface_addresses);
|
293 |
|
|
?>
|
294 |
b4323f39
|
jim-p
|
</select>
|
295 |
79d03c40
|
jim-p
|
<br /><br />
|
296 |
b4323f39
|
jim-p
|
</td>
|
297 |
|
|
</tr>
|
298 |
|
|
<tr>
|
299 |
|
|
<td width="78%" class="vtable"><p>
|
300 |
7bd5b320
|
Colin Fleming
|
<input name="strictbind" type="checkbox" id="strictbind" value="yes" <?php if ($pconfig['strictbind'] == "yes") echo "checked=\"checked\"";?> />
|
301 |
b4323f39
|
jim-p
|
<strong><?=gettext("Strict Interface Binding");?></strong>
|
302 |
|
|
<br />
|
303 |
79d03c40
|
jim-p
|
<?= gettext("If this option is set, the DNS forwarder will only bind to the interfaces containing the IP addresses selected above, rather than binding to all interfaces and discarding queries to other addresses."); ?>
|
304 |
b4323f39
|
jim-p
|
<br /><br />
|
305 |
|
|
<?= gettext("NOTE: This option does NOT work with IPv6. If set, dnsmasq will not bind to IPv6 addresses."); ?>
|
306 |
|
|
</p>
|
307 |
|
|
</td>
|
308 |
|
|
</tr>
|
309 |
8f9bffbc
|
Andrew Thompson
|
<tr>
|
310 |
6661dbcf
|
jim-p
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Advanced");?></td>
|
311 |
7bd5b320
|
Colin Fleming
|
<td width="78%" class="vtable">
|
312 |
8f9bffbc
|
Andrew Thompson
|
<div id="showadvbox" <?php if ($pconfig['custom_options']) echo "style='display:none'"; ?>>
|
313 |
93fb6094
|
Colin Fleming
|
<input type="button" onclick="show_advanced_dns()" value="<?=gettext("Advanced"); ?>" /> - <?=gettext("Show advanced option");?>
|
314 |
8f9bffbc
|
Andrew Thompson
|
</div>
|
315 |
|
|
<div id="showadv" <?php if (empty($pconfig['custom_options'])) echo "style='display:none'"; ?>>
|
316 |
8cd558b6
|
ayvis
|
<strong><?=gettext("Advanced");?><br /></strong>
|
317 |
|
|
<textarea rows="6" cols="78" name="custom_options" id="custom_options"><?=htmlspecialchars($pconfig['custom_options']);?></textarea><br />
|
318 |
|
|
<?=gettext("Enter any additional options you would like to add to the dnsmasq configuration here, separated by a space or newline"); ?><br />
|
319 |
8f9bffbc
|
Andrew Thompson
|
</div>
|
320 |
|
|
</td>
|
321 |
|
|
</tr>
|
322 |
70edf50d
|
jim-p
|
<tr>
|
323 |
6661dbcf
|
jim-p
|
<td colspan="2">
|
324 |
7bd5b320
|
Colin Fleming
|
<input name="submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" onclick="enable_change(true)" />
|
325 |
70edf50d
|
jim-p
|
</td>
|
326 |
|
|
</tr>
|
327 |
|
|
</table>
|
328 |
6661dbcf
|
jim-p
|
|
329 |
8cd558b6
|
ayvis
|
<p><span class="vexpl"><span class="red"><strong><?=gettext("Note:");?><br />
|
330 |
6661dbcf
|
jim-p
|
</strong></span><?php printf(gettext("If the DNS forwarder is enabled, the DHCP".
|
331 |
|
|
" service (if enabled) will automatically serve the LAN IP".
|
332 |
|
|
" address as a DNS server to DHCP clients so they will use".
|
333 |
|
|
" the forwarder. The DNS forwarder will use the DNS servers".
|
334 |
|
|
" entered in %sSystem: General setup%s".
|
335 |
|
|
" or those obtained via DHCP or PPP on WAN if the "Allow".
|
336 |
|
|
" DNS server list to be overridden by DHCP/PPP on WAN"".
|
337 |
|
|
" is checked. If you don't use that option (or if you use".
|
338 |
|
|
" a static IP address on WAN), you must manually specify at".
|
339 |
|
|
" least one DNS server on the %sSystem:".
|
340 |
8cd558b6
|
ayvis
|
"General setup%s page."),'<a href="system.php">','</a>','<a href="system.php">','</a>');?><br />
|
341 |
6661dbcf
|
jim-p
|
</span></p>
|
342 |
|
|
|
343 |
8cd558b6
|
ayvis
|
<br />
|
344 |
7bd5b320
|
Colin Fleming
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tabcont" summary="host overrides">
|
345 |
6661dbcf
|
jim-p
|
<tr>
|
346 |
|
|
<td colspan="5" valign="top" class="listtopic"><?=gettext("Host Overrides");?></td>
|
347 |
|
|
</tr>
|
348 |
|
|
<tr>
|
349 |
8cd558b6
|
ayvis
|
<td><br />
|
350 |
6661dbcf
|
jim-p
|
<?=gettext("Entries in this section override individual results from the forwarders.");?>
|
351 |
|
|
<?=gettext("Use these for changing DNS results or for adding custom DNS records.");?>
|
352 |
|
|
</td>
|
353 |
|
|
</tr>
|
354 |
|
|
</table>
|
355 |
7bd5b320
|
Colin Fleming
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tabcont sortable" summary="results">
|
356 |
70edf50d
|
jim-p
|
<thead>
|
357 |
|
|
<tr>
|
358 |
|
|
<td width="20%" class="listhdrr"><?=gettext("Host");?></td>
|
359 |
|
|
<td width="25%" class="listhdrr"><?=gettext("Domain");?></td>
|
360 |
|
|
<td width="20%" class="listhdrr"><?=gettext("IP");?></td>
|
361 |
|
|
<td width="25%" class="listhdr"><?=gettext("Description");?></td>
|
362 |
|
|
<td width="10%" class="list">
|
363 |
7bd5b320
|
Colin Fleming
|
<table border="0" cellspacing="0" cellpadding="1" summary="icons">
|
364 |
70edf50d
|
jim-p
|
<tr>
|
365 |
|
|
<td width="17"></td>
|
366 |
7bd5b320
|
Colin Fleming
|
<td valign="middle"><a href="services_dnsmasq_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="add" /></a></td>
|
367 |
70edf50d
|
jim-p
|
</tr>
|
368 |
d415d821
|
Seth Mos
|
</table>
|
369 |
70edf50d
|
jim-p
|
</td>
|
370 |
|
|
</tr>
|
371 |
|
|
</thead>
|
372 |
7bd5b320
|
Colin Fleming
|
<tfoot>
|
373 |
|
|
<tr>
|
374 |
|
|
<td class="list" colspan="4"></td>
|
375 |
|
|
<td class="list">
|
376 |
|
|
<table border="0" cellspacing="0" cellpadding="1" summary="add">
|
377 |
|
|
<tr>
|
378 |
|
|
<td width="17"></td>
|
379 |
|
|
<td valign="middle"><a href="services_dnsmasq_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="add" /></a></td>
|
380 |
|
|
</tr>
|
381 |
|
|
</table>
|
382 |
|
|
</td>
|
383 |
|
|
</tr>
|
384 |
|
|
</tfoot>
|
385 |
70edf50d
|
jim-p
|
<tbody>
|
386 |
|
|
<?php $i = 0; foreach ($a_hosts as $hostent): ?>
|
387 |
|
|
<tr>
|
388 |
|
|
<td class="listlr" ondblclick="document.location='services_dnsmasq_edit.php?id=<?=$i;?>';">
|
389 |
|
|
<?=strtolower($hostent['host']);?>
|
390 |
|
|
</td>
|
391 |
|
|
<td class="listr" ondblclick="document.location='services_dnsmasq_edit.php?id=<?=$i;?>';">
|
392 |
|
|
<?=strtolower($hostent['domain']);?>
|
393 |
|
|
</td>
|
394 |
|
|
<td class="listr" ondblclick="document.location='services_dnsmasq_edit.php?id=<?=$i;?>';">
|
395 |
|
|
<?=$hostent['ip'];?>
|
396 |
|
|
</td>
|
397 |
|
|
<td class="listbg" ondblclick="document.location='services_dnsmasq_edit.php?id=<?=$i;?>';">
|
398 |
|
|
<?=htmlspecialchars($hostent['descr']);?>
|
399 |
|
|
</td>
|
400 |
7bd5b320
|
Colin Fleming
|
<td valign="middle" class="list nowrap">
|
401 |
|
|
<table border="0" cellspacing="0" cellpadding="1" summary="icons">
|
402 |
70edf50d
|
jim-p
|
<tr>
|
403 |
7bd5b320
|
Colin Fleming
|
<td valign="middle"><a href="services_dnsmasq_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" alt="edit" /></a></td>
|
404 |
b3733e10
|
Colin Fleming
|
<td><a href="services_dnsmasq.php?type=host&act=del&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this host?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="delete" /></a></td>
|
405 |
70edf50d
|
jim-p
|
</tr>
|
406 |
d415d821
|
Seth Mos
|
</table>
|
407 |
70edf50d
|
jim-p
|
</tr>
|
408 |
e37eeb49
|
jim-p
|
<?php if ($hostent['aliases']['item'] && is_array($hostent['aliases']['item'])): ?>
|
409 |
5a2a8349
|
Lorenz Schori
|
<?php foreach ($hostent['aliases']['item'] as $alias): ?>
|
410 |
|
|
<tr>
|
411 |
|
|
<td class="listlr" ondblclick="document.location='services_dnsmasq_edit.php?id=<?=$i;?>';">
|
412 |
|
|
<?=strtolower($alias['host']);?>
|
413 |
|
|
</td>
|
414 |
|
|
<td class="listr" ondblclick="document.location='services_dnsmasq_edit.php?id=<?=$i;?>';">
|
415 |
|
|
<?=strtolower($alias['domain']);?>
|
416 |
|
|
</td>
|
417 |
|
|
<td class="listr" ondblclick="document.location='services_dnsmasq_edit.php?id=<?=$i;?>';">
|
418 |
|
|
Alias for <?=$hostent['host'] ? $hostent['host'] . '.' . $hostent['domain'] : $hostent['domain'];?>
|
419 |
|
|
</td>
|
420 |
|
|
<td class="listbg" ondblclick="document.location='services_dnsmasq_edit.php?id=<?=$i;?>';">
|
421 |
|
|
<?=htmlspecialchars($alias['description']);?>
|
422 |
|
|
</td>
|
423 |
7bd5b320
|
Colin Fleming
|
<td valign="middle" class="list nowrap">
|
424 |
|
|
<a href="services_dnsmasq_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" alt="edit" /></a>
|
425 |
5a2a8349
|
Lorenz Schori
|
</td>
|
426 |
|
|
</tr>
|
427 |
|
|
<?php endforeach; ?>
|
428 |
e37eeb49
|
jim-p
|
<?php endif; ?>
|
429 |
70edf50d
|
jim-p
|
<?php $i++; endforeach; ?>
|
430 |
7bd5b320
|
Colin Fleming
|
<tr style="display:none"><td></td></tr>
|
431 |
70edf50d
|
jim-p
|
</tbody>
|
432 |
|
|
</table>
|
433 |
8cd558b6
|
ayvis
|
<br />
|
434 |
7bd5b320
|
Colin Fleming
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tabcont" summary="domain overrides">
|
435 |
6661dbcf
|
jim-p
|
<tr>
|
436 |
|
|
<td colspan="5" valign="top" class="listtopic"><?=gettext("Domain Overrides");?></td>
|
437 |
|
|
</tr>
|
438 |
|
|
<tr>
|
439 |
74127ce3
|
Finn Espen Gundersen
|
<td><p><?=gettext("Entries in this area override an entire domain, and subdomains, by specifying an".
|
440 |
7bd5b320
|
Colin Fleming
|
" authoritative DNS server to be queried for that domain.");?></p></td>
|
441 |
6661dbcf
|
jim-p
|
</tr>
|
442 |
70edf50d
|
jim-p
|
</table>
|
443 |
7bd5b320
|
Colin Fleming
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tabcont sortable" summary="results">
|
444 |
70edf50d
|
jim-p
|
<thead>
|
445 |
|
|
<tr>
|
446 |
|
|
<td width="35%" class="listhdrr"><?=gettext("Domain");?></td>
|
447 |
|
|
<td width="20%" class="listhdrr"><?=gettext("IP");?></td>
|
448 |
|
|
<td width="35%" class="listhdr"><?=gettext("Description");?></td>
|
449 |
|
|
<td width="10%" class="list">
|
450 |
7bd5b320
|
Colin Fleming
|
<table border="0" cellspacing="0" cellpadding="1" summary="add">
|
451 |
70edf50d
|
jim-p
|
<tr>
|
452 |
7bd5b320
|
Colin Fleming
|
<td width="17" height="17"></td>
|
453 |
|
|
<td><a href="services_dnsmasq_domainoverride_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="add" /></a></td>
|
454 |
70edf50d
|
jim-p
|
</tr>
|
455 |
|
|
</table>
|
456 |
|
|
</td>
|
457 |
|
|
</tr>
|
458 |
|
|
</thead>
|
459 |
7bd5b320
|
Colin Fleming
|
<tfoot>
|
460 |
|
|
<tr>
|
461 |
|
|
<td class="list" colspan="3"></td>
|
462 |
|
|
<td class="list">
|
463 |
|
|
<table border="0" cellspacing="0" cellpadding="1" summary="add">
|
464 |
|
|
<tr>
|
465 |
|
|
<td width="17" height="17"></td>
|
466 |
|
|
<td><a href="services_dnsmasq_domainoverride_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0" alt="add" /></a></td>
|
467 |
|
|
</tr>
|
468 |
|
|
</table>
|
469 |
|
|
</td>
|
470 |
|
|
</tr>
|
471 |
|
|
</tfoot>
|
472 |
70edf50d
|
jim-p
|
<tbody>
|
473 |
|
|
<?php $i = 0; foreach ($a_domainOverrides as $doment): ?>
|
474 |
|
|
<tr>
|
475 |
|
|
<td class="listlr">
|
476 |
|
|
<?=strtolower($doment['domain']);?>
|
477 |
|
|
</td>
|
478 |
|
|
<td class="listr">
|
479 |
|
|
<?=$doment['ip'];?>
|
480 |
|
|
</td>
|
481 |
|
|
<td class="listbg">
|
482 |
|
|
<?=htmlspecialchars($doment['descr']);?>
|
483 |
|
|
</td>
|
484 |
7bd5b320
|
Colin Fleming
|
<td valign="middle" class="list nowrap"> <a href="services_dnsmasq_domainoverride_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0" alt="edit" /></a>
|
485 |
b3733e10
|
Colin Fleming
|
<a href="services_dnsmasq.php?act=del&type=doverride&id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this domain override?");?>')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="delete" /></a></td>
|
486 |
70edf50d
|
jim-p
|
</tr>
|
487 |
|
|
<?php $i++; endforeach; ?>
|
488 |
7bd5b320
|
Colin Fleming
|
<tr style="display:none"><td></td></tr>
|
489 |
70edf50d
|
jim-p
|
</tbody>
|
490 |
|
|
</table>
|
491 |
|
|
</form>
|
492 |
91f026b0
|
ayvis
|
<script type="text/javascript">
|
493 |
7bd5b320
|
Colin Fleming
|
//<![CDATA[
|
494 |
6a01ea44
|
Bill Marquette
|
enable_change(false);
|
495 |
7bd5b320
|
Colin Fleming
|
//]]>
|
496 |
6a01ea44
|
Bill Marquette
|
</script>
|
497 |
5b237745
|
Scott Ullrich
|
<?php include("fend.inc"); ?>
|
498 |
|
|
</body>
|
499 |
|
|
</html>
|