Project

General

Profile

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