Project

General

Profile

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