1 |
5b237745
|
Scott Ullrich
|
<?php
|
2 |
|
|
/*
|
3 |
|
|
services_dnsmasq.php
|
4 |
|
|
*/
|
5 |
191cb31d
|
Stephen Beaver
|
/* ====================================================================
|
6 |
|
|
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
|
7 |
cb41dd63
|
Renato Botelho
|
* Copyright (c) 2003-2004 Bob Zoller <bob@kludgebox.com> and Manuel Kasper <mk@neon1.net
|
8 |
191cb31d
|
Stephen Beaver
|
*
|
9 |
cb41dd63
|
Renato Botelho
|
* Some or all of this file is based on the m0n0wall project which is
|
10 |
|
|
* Copyright (c) 2004 Manuel Kasper (BSD 2 clause)
|
11 |
191cb31d
|
Stephen Beaver
|
*
|
12 |
|
|
* Redistribution and use in source and binary forms, with or without modification,
|
13 |
|
|
* are permitted provided that the following conditions are met:
|
14 |
|
|
*
|
15 |
|
|
* 1. Redistributions of source code must retain the above copyright notice,
|
16 |
|
|
* this list of conditions and the following disclaimer.
|
17 |
|
|
*
|
18 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
19 |
|
|
* notice, this list of conditions and the following disclaimer in
|
20 |
|
|
* the documentation and/or other materials provided with the
|
21 |
|
|
* distribution.
|
22 |
|
|
*
|
23 |
|
|
* 3. All advertising materials mentioning features or use of this software
|
24 |
|
|
* must display the following acknowledgment:
|
25 |
|
|
* "This product includes software developed by the pfSense Project
|
26 |
|
|
* for use in the pfSense software distribution. (http://www.pfsense.org/).
|
27 |
|
|
*
|
28 |
|
|
* 4. The names "pfSense" and "pfSense Project" must not be used to
|
29 |
|
|
* endorse or promote products derived from this software without
|
30 |
|
|
* prior written permission. For written permission, please contact
|
31 |
|
|
* coreteam@pfsense.org.
|
32 |
|
|
*
|
33 |
|
|
* 5. Products derived from this software may not be called "pfSense"
|
34 |
|
|
* nor may "pfSense" appear in their names without prior written
|
35 |
|
|
* permission of the Electric Sheep Fencing, LLC.
|
36 |
|
|
*
|
37 |
|
|
* 6. Redistributions of any form whatsoever must retain the following
|
38 |
|
|
* acknowledgment:
|
39 |
|
|
*
|
40 |
|
|
* "This product includes software developed by the pfSense Project
|
41 |
|
|
* for use in the pfSense software distribution (http://www.pfsense.org/).
|
42 |
|
|
*
|
43 |
|
|
* THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
|
44 |
|
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
45 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
46 |
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
|
47 |
|
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
48 |
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
49 |
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
50 |
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
51 |
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
52 |
|
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
53 |
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
54 |
|
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
55 |
|
|
*
|
56 |
|
|
* ====================================================================
|
57 |
|
|
*
|
58 |
|
|
*/
|
59 |
5b237745
|
Scott Ullrich
|
|
60 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
61 |
|
|
##|*IDENT=page-services-dnsforwarder
|
62 |
5230f468
|
jim-p
|
##|*NAME=Services: DNS Forwarder
|
63 |
6b07c15a
|
Matthew Grooms
|
##|*DESCR=Allow access to the 'Services: DNS Forwarder' page.
|
64 |
|
|
##|*MATCH=services_dnsmasq.php*
|
65 |
|
|
##|-PRIV
|
66 |
|
|
|
67 |
5b237745
|
Scott Ullrich
|
require("guiconfig.inc");
|
68 |
7a927e67
|
Scott Ullrich
|
require_once("functions.inc");
|
69 |
|
|
require_once("filter.inc");
|
70 |
|
|
require_once("shaper.inc");
|
71 |
4dbcf2fb
|
Renato Botelho
|
require_once("system.inc");
|
72 |
5b237745
|
Scott Ullrich
|
|
73 |
70edf50d
|
jim-p
|
$pconfig['enable'] = isset($config['dnsmasq']['enable']);
|
74 |
5b237745
|
Scott Ullrich
|
$pconfig['regdhcp'] = isset($config['dnsmasq']['regdhcp']);
|
75 |
6a01ea44
|
Bill Marquette
|
$pconfig['regdhcpstatic'] = isset($config['dnsmasq']['regdhcpstatic']);
|
76 |
aa994814
|
Andrew Thompson
|
$pconfig['dhcpfirst'] = isset($config['dnsmasq']['dhcpfirst']);
|
77 |
96ea7162
|
N0YB
|
$pconfig['strict_order'] = isset($config['dnsmasq']['strict_order']);
|
78 |
|
|
$pconfig['domain_needed'] = isset($config['dnsmasq']['domain_needed']);
|
79 |
7bdd28fb
|
Phil Davis
|
$pconfig['no_private_reverse'] = isset($config['dnsmasq']['no_private_reverse']);
|
80 |
e6c49e3d
|
jim-p
|
$pconfig['port'] = $config['dnsmasq']['port'];
|
81 |
8f9bffbc
|
Andrew Thompson
|
$pconfig['custom_options'] = $config['dnsmasq']['custom_options'];
|
82 |
5b237745
|
Scott Ullrich
|
|
83 |
b4323f39
|
jim-p
|
$pconfig['strictbind'] = isset($config['dnsmasq']['strictbind']);
|
84 |
966ed611
|
Phil Davis
|
if (!empty($config['dnsmasq']['interface'])) {
|
85 |
79d03c40
|
jim-p
|
$pconfig['interface'] = explode(",", $config['dnsmasq']['interface']);
|
86 |
966ed611
|
Phil Davis
|
} else {
|
87 |
79d03c40
|
jim-p
|
$pconfig['interface'] = array();
|
88 |
966ed611
|
Phil Davis
|
}
|
89 |
b4323f39
|
jim-p
|
|
90 |
966ed611
|
Phil Davis
|
if (!is_array($config['dnsmasq']['hosts'])) {
|
91 |
5b237745
|
Scott Ullrich
|
$config['dnsmasq']['hosts'] = array();
|
92 |
966ed611
|
Phil Davis
|
}
|
93 |
0c2b5df7
|
Scott Ullrich
|
|
94 |
966ed611
|
Phil Davis
|
if (!is_array($config['dnsmasq']['domainoverrides'])) {
|
95 |
70edf50d
|
jim-p
|
$config['dnsmasq']['domainoverrides'] = array();
|
96 |
966ed611
|
Phil Davis
|
}
|
97 |
0c2b5df7
|
Scott Ullrich
|
|
98 |
70edf50d
|
jim-p
|
$a_hosts = &$config['dnsmasq']['hosts'];
|
99 |
0c2b5df7
|
Scott Ullrich
|
$a_domainOverrides = &$config['dnsmasq']['domainoverrides'];
|
100 |
5b237745
|
Scott Ullrich
|
|
101 |
|
|
if ($_POST) {
|
102 |
98d39683
|
jim-p
|
if ($_POST['apply']) {
|
103 |
|
|
$retval = 0;
|
104 |
|
|
$retval = services_dnsmasq_configure();
|
105 |
|
|
$savemsg = get_std_save_message($retval);
|
106 |
|
|
|
107 |
|
|
// Reload filter (we might need to sync to CARP hosts)
|
108 |
|
|
filter_configure();
|
109 |
|
|
/* Update resolv.conf in case the interface bindings exclude localhost. */
|
110 |
|
|
system_resolvconf_generate();
|
111 |
|
|
/* Start or restart dhcpleases when it's necessary */
|
112 |
|
|
system_dhcpleases_configure();
|
113 |
|
|
|
114 |
|
|
if ($retval == 0) {
|
115 |
|
|
clear_subsystem_dirty('hosts');
|
116 |
|
|
}
|
117 |
33ed4d60
|
Stephen Beaver
|
} else {
|
118 |
|
|
$pconfig = $_POST;
|
119 |
|
|
unset($input_errors);
|
120 |
6e3488e9
|
Phil Davis
|
|
121 |
33ed4d60
|
Stephen Beaver
|
$config['dnsmasq']['enable'] = ($_POST['enable']) ? true : false;
|
122 |
|
|
$config['dnsmasq']['regdhcp'] = ($_POST['regdhcp']) ? true : false;
|
123 |
|
|
$config['dnsmasq']['regdhcpstatic'] = ($_POST['regdhcpstatic']) ? true : false;
|
124 |
|
|
$config['dnsmasq']['dhcpfirst'] = ($_POST['dhcpfirst']) ? true : false;
|
125 |
|
|
$config['dnsmasq']['strict_order'] = ($_POST['strict_order']) ? true : false;
|
126 |
|
|
$config['dnsmasq']['domain_needed'] = ($_POST['domain_needed']) ? true : false;
|
127 |
|
|
$config['dnsmasq']['no_private_reverse'] = ($_POST['no_private_reverse']) ? true : false;
|
128 |
|
|
$config['dnsmasq']['custom_options'] = str_replace("\r\n", "\n", $_POST['custom_options']);
|
129 |
|
|
$config['dnsmasq']['strictbind'] = ($_POST['strictbind']) ? true : false;
|
130 |
6e3488e9
|
Phil Davis
|
|
131 |
33ed4d60
|
Stephen Beaver
|
if (isset($_POST['enable']) && isset($config['unbound']['enable'])) {
|
132 |
|
|
if ($_POST['port'] == $config['unbound']['port']) {
|
133 |
4bb7c0d1
|
bruno
|
$input_errors[] = gettext("The DNS Resolver is enabled using this port. Choose a non-conflicting port, or disable DNS Resolver.");
|
134 |
33ed4d60
|
Stephen Beaver
|
}
|
135 |
966ed611
|
Phil Davis
|
}
|
136 |
6e3488e9
|
Phil Davis
|
|
137 |
33ed4d60
|
Stephen Beaver
|
if ($_POST['port']) {
|
138 |
|
|
if (is_port($_POST['port'])) {
|
139 |
|
|
$config['dnsmasq']['port'] = $_POST['port'];
|
140 |
|
|
} else {
|
141 |
|
|
$input_errors[] = gettext("You must specify a valid port number");
|
142 |
|
|
}
|
143 |
|
|
} else if (isset($config['dnsmasq']['port'])) {
|
144 |
|
|
unset($config['dnsmasq']['port']);
|
145 |
966ed611
|
Phil Davis
|
}
|
146 |
6e3488e9
|
Phil Davis
|
|
147 |
33ed4d60
|
Stephen Beaver
|
if (is_array($_POST['interface'])) {
|
148 |
|
|
$config['dnsmasq']['interface'] = implode(",", $_POST['interface']);
|
149 |
|
|
} elseif (isset($config['dnsmasq']['interface'])) {
|
150 |
|
|
unset($config['dnsmasq']['interface']);
|
151 |
966ed611
|
Phil Davis
|
}
|
152 |
6e3488e9
|
Phil Davis
|
|
153 |
33ed4d60
|
Stephen Beaver
|
if ($config['dnsmasq']['custom_options']) {
|
154 |
|
|
$args = '';
|
155 |
|
|
foreach (preg_split('/\s+/', $config['dnsmasq']['custom_options']) as $c) {
|
156 |
|
|
$args .= escapeshellarg("--{$c}") . " ";
|
157 |
|
|
}
|
158 |
|
|
exec("/usr/local/sbin/dnsmasq --test $args", $output, $rc);
|
159 |
|
|
if ($rc != 0) {
|
160 |
|
|
$input_errors[] = gettext("Invalid custom options");
|
161 |
|
|
}
|
162 |
c85b1242
|
Stephen Beaver
|
}
|
163 |
6e3488e9
|
Phil Davis
|
|
164 |
33ed4d60
|
Stephen Beaver
|
if (!$input_errors) {
|
165 |
|
|
write_config();
|
166 |
98d39683
|
jim-p
|
mark_subsystem_dirty('hosts');
|
167 |
966ed611
|
Phil Davis
|
}
|
168 |
8f9bffbc
|
Andrew Thompson
|
}
|
169 |
5b237745
|
Scott Ullrich
|
}
|
170 |
|
|
|
171 |
|
|
if ($_GET['act'] == "del") {
|
172 |
70edf50d
|
jim-p
|
if ($_GET['type'] == 'host') {
|
173 |
|
|
if ($a_hosts[$_GET['id']]) {
|
174 |
|
|
unset($a_hosts[$_GET['id']]);
|
175 |
|
|
write_config();
|
176 |
a368a026
|
Ermal Lu?i
|
mark_subsystem_dirty('hosts');
|
177 |
70edf50d
|
jim-p
|
header("Location: services_dnsmasq.php");
|
178 |
|
|
exit;
|
179 |
|
|
}
|
180 |
6e3488e9
|
Phil Davis
|
} elseif ($_GET['type'] == 'doverride') {
|
181 |
70edf50d
|
jim-p
|
if ($a_domainOverrides[$_GET['id']]) {
|
182 |
|
|
unset($a_domainOverrides[$_GET['id']]);
|
183 |
|
|
write_config();
|
184 |
a368a026
|
Ermal Lu?i
|
mark_subsystem_dirty('hosts');
|
185 |
70edf50d
|
jim-p
|
header("Location: services_dnsmasq.php");
|
186 |
|
|
exit;
|
187 |
|
|
}
|
188 |
|
|
}
|
189 |
5b237745
|
Scott Ullrich
|
}
|
190 |
0c2b5df7
|
Scott Ullrich
|
|
191 |
e6363160
|
sbeaver
|
function build_if_list() {
|
192 |
b1895639
|
Stephen Beaver
|
global $pconfig;
|
193 |
|
|
|
194 |
e6363160
|
sbeaver
|
$interface_addresses = get_possible_listen_ips(true);
|
195 |
|
|
$iflist = array('options' => array(), 'selected' => array());
|
196 |
|
|
|
197 |
|
|
$iflist['options'][""] = "All";
|
198 |
6e3488e9
|
Phil Davis
|
if (empty($pconfig['interface']) || empty($pconfig['interface'][0])) {
|
199 |
e6363160
|
sbeaver
|
array_push($iflist['selected'], "");
|
200 |
6e3488e9
|
Phil Davis
|
}
|
201 |
e6363160
|
sbeaver
|
|
202 |
|
|
foreach ($interface_addresses as $laddr => $ldescr) {
|
203 |
|
|
$iflist['options'][$laddr] = htmlspecialchars($ldescr);
|
204 |
|
|
|
205 |
6e3488e9
|
Phil Davis
|
if ($pconfig['interface'] && in_array($laddr, $pconfig['interface'])) {
|
206 |
e6363160
|
sbeaver
|
array_push($iflist['selected'], $laddr);
|
207 |
6e3488e9
|
Phil Davis
|
}
|
208 |
e6363160
|
sbeaver
|
}
|
209 |
|
|
|
210 |
|
|
unset($interface_addresses);
|
211 |
|
|
|
212 |
|
|
return($iflist);
|
213 |
|
|
}
|
214 |
|
|
|
215 |
9f5aa90f
|
Phil Davis
|
$pgtitle = array(gettext("Services"), gettext("DNS Forwarder"));
|
216 |
db88a3a2
|
Phil Davis
|
$shortcut_section = "forwarder";
|
217 |
b63695db
|
Scott Ullrich
|
include("head.inc");
|
218 |
0c2b5df7
|
Scott Ullrich
|
|
219 |
6e3488e9
|
Phil Davis
|
if ($input_errors) {
|
220 |
e6363160
|
sbeaver
|
print_input_errors($input_errors);
|
221 |
6e3488e9
|
Phil Davis
|
}
|
222 |
5b237745
|
Scott Ullrich
|
|
223 |
6e3488e9
|
Phil Davis
|
if ($savemsg) {
|
224 |
e6363160
|
sbeaver
|
print_info_box($savemsg, 'success');
|
225 |
6e3488e9
|
Phil Davis
|
}
|
226 |
e6363160
|
sbeaver
|
|
227 |
6e3488e9
|
Phil Davis
|
if (is_subsystem_dirty('hosts')) {
|
228 |
464358b4
|
Phil Davis
|
print_apply_box(gettext("The DNS forwarder configuration has been changed.") . "<br />" . gettext("You must apply the changes in order for them to take effect."));
|
229 |
6e3488e9
|
Phil Davis
|
}
|
230 |
e6363160
|
sbeaver
|
|
231 |
fae9a73c
|
sbeaver
|
$form = new Form();
|
232 |
e6363160
|
sbeaver
|
|
233 |
|
|
$section = new Form_Section('General DNS Forwarder Options');
|
234 |
|
|
|
235 |
|
|
$section->addInput(new Form_Checkbox(
|
236 |
|
|
'enable',
|
237 |
|
|
'Enable',
|
238 |
|
|
'Enable DNS forwarder',
|
239 |
|
|
$pconfig['enable']
|
240 |
08d1762e
|
Sjon Hortensius
|
))->toggles('.toggle-dhcp', 'disable');
|
241 |
e6363160
|
sbeaver
|
|
242 |
|
|
$section->addInput(new Form_Checkbox(
|
243 |
|
|
'regdhcp',
|
244 |
|
|
'DHCP Registration',
|
245 |
|
|
'Register DHCP leases in DNS forwarder',
|
246 |
|
|
$pconfig['regdhcp']
|
247 |
fae9a73c
|
sbeaver
|
))->setHelp(sprintf("If this option is set, then machines that specify".
|
248 |
70edf50d
|
jim-p
|
" their hostname when requesting a DHCP lease will be registered".
|
249 |
|
|
" in the DNS forwarder, so that their name can be resolved.".
|
250 |
|
|
" You should also set the domain in %sSystem:".
|
251 |
08d1762e
|
Sjon Hortensius
|
" General setup%s to the proper value.",'<a href="system.php">','</a>'))
|
252 |
|
|
->addClass('toggle-dhcp');
|
253 |
e6363160
|
sbeaver
|
|
254 |
|
|
$section->addInput(new Form_Checkbox(
|
255 |
|
|
'regdhcpstatic',
|
256 |
|
|
'Static DHCP',
|
257 |
|
|
'Register DHCP static mappings in DNS forwarder',
|
258 |
|
|
$pconfig['regdhcpstatic']
|
259 |
fae9a73c
|
sbeaver
|
))->setHelp(sprintf("If this option is set, then DHCP static mappings will ".
|
260 |
70edf50d
|
jim-p
|
"be registered in the DNS forwarder, so that their name can be ".
|
261 |
|
|
"resolved. You should also set the domain in %s".
|
262 |
08d1762e
|
Sjon Hortensius
|
"System: General setup%s to the proper value.",'<a href="system.php">','</a>'))
|
263 |
|
|
->addClass('toggle-dhcp');
|
264 |
e6363160
|
sbeaver
|
|
265 |
|
|
$section->addInput(new Form_Checkbox(
|
266 |
|
|
'dhcpfirst',
|
267 |
|
|
'Prefer DHCP',
|
268 |
|
|
'Resolve DHCP mappings first',
|
269 |
|
|
$pconfig['dhcpfirst']
|
270 |
fae9a73c
|
sbeaver
|
))->setHelp(sprintf("If this option is set, then DHCP mappings will ".
|
271 |
aa994814
|
Andrew Thompson
|
"be resolved before the manual list of names below. This only ".
|
272 |
08d1762e
|
Sjon Hortensius
|
"affects the name given for a reverse lookup (PTR)."))
|
273 |
|
|
->addClass('toggle-dhcp');
|
274 |
e6363160
|
sbeaver
|
|
275 |
08d1762e
|
Sjon Hortensius
|
$group = new Form_Group('DNS Query Forwarding');
|
276 |
|
|
|
277 |
|
|
$group->add(new Form_Checkbox(
|
278 |
e6363160
|
sbeaver
|
'strict_order',
|
279 |
|
|
'DNS Query Forwarding',
|
280 |
|
|
'Query DNS servers sequentially',
|
281 |
|
|
$pconfig['strict_order']
|
282 |
fae9a73c
|
sbeaver
|
))->setHelp(sprintf("If this option is set, %s DNS Forwarder (dnsmasq) will ".
|
283 |
96ea7162
|
N0YB
|
"query the DNS servers sequentially in the order specified (<i>System - General Setup - DNS Servers</i>), ".
|
284 |
fae9a73c
|
sbeaver
|
"rather than all at once in parallel. ", $g['product_name']));
|
285 |
e6363160
|
sbeaver
|
|
286 |
08d1762e
|
Sjon Hortensius
|
$group->add(new Form_Checkbox(
|
287 |
e6363160
|
sbeaver
|
'domain_needed',
|
288 |
|
|
null,
|
289 |
|
|
'Require domain',
|
290 |
|
|
$pconfig['domain_needed']
|
291 |
fae9a73c
|
sbeaver
|
))->setHelp(sprintf("If this option is set, %s DNS Forwarder (dnsmasq) will ".
|
292 |
e6363160
|
sbeaver
|
"not forward A or AAAA queries for plain names, without dots or domain parts, to upstream name servers. ".
|
293 |
fae9a73c
|
sbeaver
|
"If the name is not known from /etc/hosts or DHCP then a \"not found\" answer is returned. ", $g['product_name']));
|
294 |
e6363160
|
sbeaver
|
|
295 |
08d1762e
|
Sjon Hortensius
|
$group->add(new Form_Checkbox(
|
296 |
e6363160
|
sbeaver
|
'no_private_reverse',
|
297 |
|
|
null,
|
298 |
|
|
'Do not forward private reverse lookups',
|
299 |
|
|
$pconfig['no_private_reverse']
|
300 |
fae9a73c
|
sbeaver
|
))->setHelp(sprintf("If this option is set, %s DNS Forwarder (dnsmasq) will ".
|
301 |
7bdd28fb
|
Phil Davis
|
"not forward reverse DNS lookups (PTR) for private addresses (RFC 1918) to upstream name servers. ".
|
302 |
|
|
"Any entries in the Domain Overrides section forwarding private \"n.n.n.in-addr.arpa\" names to a specific server are still forwarded. ".
|
303 |
fae9a73c
|
sbeaver
|
"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. ", $g['product_name']));
|
304 |
e6363160
|
sbeaver
|
|
305 |
08d1762e
|
Sjon Hortensius
|
$section->add($group);
|
306 |
|
|
|
307 |
e6363160
|
sbeaver
|
$section->addInput(new Form_Input(
|
308 |
|
|
'port',
|
309 |
|
|
'Listen Port',
|
310 |
08d1762e
|
Sjon Hortensius
|
'number',
|
311 |
|
|
$pconfig['port'],
|
312 |
|
|
['placeholder' => '53']
|
313 |
e6363160
|
sbeaver
|
))->setHelp('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.');
|
314 |
|
|
|
315 |
|
|
$iflist = build_if_list();
|
316 |
|
|
|
317 |
|
|
$section->addInput(new Form_Select(
|
318 |
|
|
'interface',
|
319 |
|
|
'Interfaces',
|
320 |
|
|
$iflist['selected'],
|
321 |
|
|
$iflist['options'],
|
322 |
|
|
true
|
323 |
|
|
))->setHelp('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. ' .
|
324 |
|
|
'The default behavior is to respond to queries on every available IPv4 and IPv6 address.');
|
325 |
|
|
|
326 |
|
|
$section->addInput(new Form_Checkbox(
|
327 |
|
|
'strictbind',
|
328 |
08d1762e
|
Sjon Hortensius
|
'Strict binding',
|
329 |
e6363160
|
sbeaver
|
'Strict interface binding',
|
330 |
|
|
$pconfig['strictbind']
|
331 |
fae9a73c
|
sbeaver
|
))->setHelp('If this option is set, the DNS forwarder will only bind to the interfaces containing the IP addresses selected above, ' .
|
332 |
e6363160
|
sbeaver
|
'rather than binding to all interfaces and discarding queries to other addresses.' . '<br /><br />' .
|
333 |
fae9a73c
|
sbeaver
|
'This option does NOT work with IPv6. If set, dnsmasq will not bind to IPv6 addresses.');
|
334 |
e6363160
|
sbeaver
|
|
335 |
33ed4d60
|
Stephen Beaver
|
$section->addInput(new Form_Textarea(
|
336 |
e6363160
|
sbeaver
|
'custom_options',
|
337 |
|
|
'Custom options',
|
338 |
|
|
$pconfig['custom_options']
|
339 |
08d1762e
|
Sjon Hortensius
|
))->setHelp('Enter any additional options you would like to add to the dnsmasq configuration here, separated by a space or newline')
|
340 |
b6b7ab7d
|
Stephen Beaver
|
->addClass('advanced');
|
341 |
e6363160
|
sbeaver
|
|
342 |
|
|
$form->add($section);
|
343 |
|
|
print($form);
|
344 |
98f28b4e
|
k-paulius
|
|
345 |
b6b7ab7d
|
Stephen Beaver
|
?>
|
346 |
|
|
<div class="infoblock">
|
347 |
|
|
<?php
|
348 |
98f28b4e
|
k-paulius
|
print_callout('<p>' .
|
349 |
|
|
gettext('If the DNS forwarder is enabled, the DHCP service (if enabled) will automatically' .
|
350 |
|
|
' serve the LAN IP address as a DNS server to DHCP clients so they will use the forwarder.') . '</p><p>' .
|
351 |
|
|
sprintf(gettext('The DNS forwarder will use the DNS servers entered in %1$sSystem > General Setup%2$s or' .
|
352 |
|
|
' those obtained via DHCP or PPP on WAN if "Allow DNS server list to be overridden by DHCP/PPP on WAN" is checked.' .
|
353 |
|
|
' If you don\'t use that option (or if you use a static IP address on WAN),' .
|
354 |
|
|
' you must manually specify at least one DNS server on the %1$sSystem > General Setup%2$s page.'),
|
355 |
|
|
'<a href="system.php">',
|
356 |
|
|
'</a>') .
|
357 |
|
|
'</p>'
|
358 |
|
|
);
|
359 |
|
|
|
360 |
b6b7ab7d
|
Stephen Beaver
|
?>
|
361 |
|
|
</div>
|
362 |
|
|
<?php
|
363 |
98f28b4e
|
k-paulius
|
print_callout(gettext("Entries in this section override individual results from the forwarders.") . " " .
|
364 |
|
|
gettext("Use these for changing DNS results or for adding custom DNS records.")
|
365 |
|
|
);
|
366 |
c53fc00e
|
Phil Davis
|
?>
|
367 |
e6363160
|
sbeaver
|
|
368 |
|
|
<div class="panel panel-default">
|
369 |
c9679d8c
|
Stephen Beaver
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext("Host Overrides")?></h2></div>
|
370 |
e6363160
|
sbeaver
|
<div class="panel-body table-responsive">
|
371 |
10fe1eb5
|
Stephen Beaver
|
<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
|
372 |
e6363160
|
sbeaver
|
<thead>
|
373 |
70edf50d
|
jim-p
|
<tr>
|
374 |
e6363160
|
sbeaver
|
<th><?=gettext("Host")?></th>
|
375 |
|
|
<th><?=gettext("Domain")?></th>
|
376 |
|
|
<th><?=gettext("IP")?></th>
|
377 |
|
|
<th><?=gettext("Description")?></th>
|
378 |
|
|
<th></th>
|
379 |
70edf50d
|
jim-p
|
</tr>
|
380 |
e6363160
|
sbeaver
|
</thead>
|
381 |
|
|
<tbody>
|
382 |
|
|
<?php
|
383 |
08d1762e
|
Sjon Hortensius
|
foreach ($a_hosts as $i => $hostent):
|
384 |
e6363160
|
sbeaver
|
?>
|
385 |
|
|
<tr>
|
386 |
|
|
<td>
|
387 |
a15714cc
|
NOYB
|
<?=$hostent['host']?>
|
388 |
e6363160
|
sbeaver
|
</td>
|
389 |
|
|
<td>
|
390 |
a15714cc
|
NOYB
|
<?=$hostent['domain']?>
|
391 |
e6363160
|
sbeaver
|
</td>
|
392 |
|
|
<td>
|
393 |
08d1762e
|
Sjon Hortensius
|
<?=$hostent['ip']?>
|
394 |
e6363160
|
sbeaver
|
</td>
|
395 |
|
|
<td>
|
396 |
|
|
<?=htmlspecialchars($hostent['descr'])?>
|
397 |
|
|
</td>
|
398 |
|
|
<td>
|
399 |
c84a6977
|
heper
|
<a class="fa fa-pencil" title="<?=gettext('Edit host override')?>" href="services_dnsmasq_edit.php?id=<?=$i?>"></a>
|
400 |
33f0b0d5
|
Stephen Beaver
|
<a class="fa fa-trash" title="<?=gettext('Delete host override')?>" href="services_dnsmasq.php?type=host&act=del&id=<?=$i?>"></a>
|
401 |
e6363160
|
sbeaver
|
</td>
|
402 |
|
|
</tr>
|
403 |
|
|
|
404 |
|
|
<?php
|
405 |
|
|
if ($hostent['aliases']['item'] && is_array($hostent['aliases']['item'])):
|
406 |
08d1762e
|
Sjon Hortensius
|
foreach ($hostent['aliases']['item'] as $i => $alias):
|
407 |
e6363160
|
sbeaver
|
?>
|
408 |
7bd5b320
|
Colin Fleming
|
<tr>
|
409 |
e6363160
|
sbeaver
|
<td>
|
410 |
a15714cc
|
NOYB
|
<?=$alias['host']?>
|
411 |
e6363160
|
sbeaver
|
</td>
|
412 |
|
|
<td>
|
413 |
a15714cc
|
NOYB
|
<?=$alias['domain']?>
|
414 |
e6363160
|
sbeaver
|
</td>
|
415 |
|
|
<td>
|
416 |
4bb7c0d1
|
bruno
|
<?=gettext("Alias for ");?><?=$hostent['host'] ? $hostent['host'] . '.' . $hostent['domain'] : $hostent['domain']?>
|
417 |
e6363160
|
sbeaver
|
</td>
|
418 |
|
|
<td>
|
419 |
39609bf9
|
Stephen Beaver
|
<i class="fa fa-angle-double-right text-info"></i>
|
420 |
e6363160
|
sbeaver
|
<?=htmlspecialchars($alias['description'])?>
|
421 |
|
|
</td>
|
422 |
|
|
<td>
|
423 |
c84a6977
|
heper
|
<a class="fa fa-pencil" title="<?=gettext('Edit host override')?>" href="services_dnsmasq_edit.php?id=<?=$i?>"></a>
|
424 |
e6363160
|
sbeaver
|
</td>
|
425 |
7bd5b320
|
Colin Fleming
|
</tr>
|
426 |
e6363160
|
sbeaver
|
<?php
|
427 |
|
|
endforeach;
|
428 |
|
|
endif;
|
429 |
|
|
endforeach;
|
430 |
|
|
?>
|
431 |
|
|
</tbody>
|
432 |
|
|
</table>
|
433 |
|
|
</div>
|
434 |
|
|
</div>
|
435 |
|
|
|
436 |
c10cb196
|
Stephen Beaver
|
<nav class="action-buttons">
|
437 |
c9679d8c
|
Stephen Beaver
|
<a href="services_dnsmasq_edit.php" class="btn btn-sm btn-success btn-sm">
|
438 |
9d5a20cf
|
heper
|
<i class="fa fa-plus icon-embed-btn"></i>
|
439 |
c9679d8c
|
Stephen Beaver
|
<?=gettext('Add')?>
|
440 |
|
|
</a>
|
441 |
e6363160
|
sbeaver
|
</nav>
|
442 |
|
|
|
443 |
|
|
<?php
|
444 |
98f28b4e
|
k-paulius
|
print_callout(gettext("Entries in this area override an entire domain, and subdomains, by specifying an".
|
445 |
|
|
" authoritative DNS server to be queried for that domain.")
|
446 |
|
|
);
|
447 |
e6363160
|
sbeaver
|
?>
|
448 |
|
|
|
449 |
|
|
<div class="panel panel-default">
|
450 |
c9679d8c
|
Stephen Beaver
|
<div class="panel-heading"><h2 class="panel-title"><?=gettext("Domain Overrides")?></h2></div>
|
451 |
e6363160
|
sbeaver
|
<div class="panel-body table-responsive">
|
452 |
10fe1eb5
|
Stephen Beaver
|
<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
|
453 |
e6363160
|
sbeaver
|
<thead>
|
454 |
70edf50d
|
jim-p
|
<tr>
|
455 |
e6363160
|
sbeaver
|
<th><?=gettext("Domain")?></th>
|
456 |
|
|
<th><?=gettext("IP")?></th>
|
457 |
|
|
<th><?=gettext("Description")?></th>
|
458 |
|
|
<th></th>
|
459 |
70edf50d
|
jim-p
|
</tr>
|
460 |
e6363160
|
sbeaver
|
</thead>
|
461 |
|
|
|
462 |
|
|
<tbody>
|
463 |
|
|
<?php
|
464 |
08d1762e
|
Sjon Hortensius
|
foreach ($a_domainOverrides as $i => $doment):
|
465 |
e6363160
|
sbeaver
|
?>
|
466 |
70edf50d
|
jim-p
|
<tr>
|
467 |
e6363160
|
sbeaver
|
<td>
|
468 |
a15714cc
|
NOYB
|
<?=$doment['domain']?>
|
469 |
e6363160
|
sbeaver
|
</td>
|
470 |
|
|
<td>
|
471 |
08d1762e
|
Sjon Hortensius
|
<?=$doment['ip']?>
|
472 |
e6363160
|
sbeaver
|
</td>
|
473 |
|
|
<td>
|
474 |
08d1762e
|
Sjon Hortensius
|
<?=htmlspecialchars($doment['descr'])?>
|
475 |
e6363160
|
sbeaver
|
</td>
|
476 |
|
|
<td>
|
477 |
33f0b0d5
|
Stephen Beaver
|
<a class="fa fa-pencil" title="<?=gettext('Edit domain override')?>" href="services_dnsmasq_domainoverride_edit.php?id=<?=$i?>"></a>
|
478 |
|
|
<a class="fa fa-trash" title="<?=gettext('Delete domain override')?>" href="services_dnsmasq.php?act=del&type=doverride&id=<?=$i?>"></a>
|
479 |
e6363160
|
sbeaver
|
</td>
|
480 |
70edf50d
|
jim-p
|
</tr>
|
481 |
e6363160
|
sbeaver
|
<?php
|
482 |
|
|
endforeach;
|
483 |
|
|
?>
|
484 |
|
|
</tbody>
|
485 |
7bd5b320
|
Colin Fleming
|
</table>
|
486 |
e6363160
|
sbeaver
|
</div>
|
487 |
|
|
</div>
|
488 |
|
|
|
489 |
c10cb196
|
Stephen Beaver
|
<nav class="action-buttons">
|
490 |
c9679d8c
|
Stephen Beaver
|
<a href="services_dnsmasq_domainoverride_edit.php" class="btn btn-sm btn-success btn-sm">
|
491 |
9d5a20cf
|
heper
|
<i class="fa fa-plus icon-embed-btn"></i>
|
492 |
c9679d8c
|
Stephen Beaver
|
<?=gettext('Add')?>
|
493 |
|
|
</a>
|
494 |
e6363160
|
sbeaver
|
</nav>
|
495 |
|
|
|
496 |
c53fc00e
|
Phil Davis
|
<?php
|
497 |
c84a6977
|
heper
|
include("foot.inc");
|