Project

General

Profile

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