Project

General

Profile

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