1 |
5ef4a9e1
|
Darren Embry
|
<?php
|
2 |
|
|
/* $Id$ */
|
3 |
|
|
/*
|
4 |
f3475477
|
Darren Embry
|
services_router_advertisements.php
|
5 |
|
|
part of m0n0wall (http://m0n0.ch/wall)
|
6 |
5ef4a9e1
|
Darren Embry
|
|
7 |
|
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
8 |
|
|
All rights reserved.
|
9 |
|
|
|
10 |
c7281770
|
Chris Buechler
|
part of pfSense (https://www.pfsense.org)
|
11 |
5ef4a9e1
|
Darren Embry
|
Copyright (C) 2010 Seth Mos <seth.mos@dds.nl>.
|
12 |
ce77a9c4
|
Phil Davis
|
Copyright (C) 2013-2015 Electric Sheep Fencing, LP
|
13 |
5ef4a9e1
|
Darren Embry
|
All rights reserved.
|
14 |
|
|
|
15 |
|
|
Redistribution and use in source and binary forms, with or without
|
16 |
|
|
modification, are permitted provided that the following conditions are met:
|
17 |
|
|
|
18 |
|
|
1. Redistributions of source code must retain the above copyright notice,
|
19 |
|
|
this list of conditions and the following disclaimer.
|
20 |
|
|
|
21 |
|
|
2. Redistributions in binary form must reproduce the above copyright
|
22 |
|
|
notice, this list of conditions and the following disclaimer in the
|
23 |
|
|
documentation and/or other materials provided with the distribution.
|
24 |
|
|
|
25 |
|
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
26 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
27 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
28 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
29 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
30 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
31 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
32 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
33 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
34 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
35 |
|
|
*/
|
36 |
|
|
/*
|
37 |
|
|
pfSense_BUILDER_BINARIES: /bin/rm
|
38 |
|
|
pfSense_MODULE: interfaces
|
39 |
|
|
*/
|
40 |
|
|
|
41 |
|
|
##|+PRIV
|
42 |
f3475477
|
Darren Embry
|
##|*IDENT=page-services-router-advertisements
|
43 |
|
|
##|*NAME=Services: Router advertisementspage
|
44 |
|
|
##|*DESCR=Allow access to the 'Services: Router Advertisements' page.
|
45 |
|
|
##|*MATCH=services_router_advertisements.php*
|
46 |
5ef4a9e1
|
Darren Embry
|
##|-PRIV
|
47 |
|
|
|
48 |
|
|
require("guiconfig.inc");
|
49 |
|
|
|
50 |
56463a6c
|
Phil Davis
|
if (!$g['services_dhcp_server_enable']) {
|
51 |
6f3d2063
|
Renato Botelho
|
header("Location: /");
|
52 |
5ef4a9e1
|
Darren Embry
|
exit;
|
53 |
|
|
}
|
54 |
|
|
|
55 |
|
|
/* Fix failover DHCP problem
|
56 |
|
|
* http://article.gmane.org/gmane.comp.security.firewalls.pfsense.support/18749
|
57 |
|
|
*/
|
58 |
56463a6c
|
Phil Davis
|
ini_set("memory_limit", "64M");
|
59 |
5ef4a9e1
|
Darren Embry
|
|
60 |
|
|
$if = $_GET['if'];
|
61 |
56463a6c
|
Phil Davis
|
if ($_POST['if']) {
|
62 |
5ef4a9e1
|
Darren Embry
|
$if = $_POST['if'];
|
63 |
56463a6c
|
Phil Davis
|
}
|
64 |
5ef4a9e1
|
Darren Embry
|
|
65 |
|
|
/* if OLSRD is enabled, allow WAN to house DHCP. */
|
66 |
56463a6c
|
Phil Davis
|
if ($config['installedpackages']['olsrd']) {
|
67 |
|
|
foreach ($config['installedpackages']['olsrd']['config'] as $olsrd) {
|
68 |
|
|
if ($olsrd['enable']) {
|
69 |
e1968b0d
|
Renato Botelho
|
$is_olsr_enabled = true;
|
70 |
|
|
break;
|
71 |
|
|
}
|
72 |
5ef4a9e1
|
Darren Embry
|
}
|
73 |
|
|
}
|
74 |
|
|
|
75 |
56463a6c
|
Phil Davis
|
if (!$_GET['if']) {
|
76 |
f3475477
|
Darren Embry
|
$savemsg = "<p><b>" . gettext("The DHCPv6 Server can only be enabled on interfaces configured with static IP addresses") . ".</b></p>" .
|
77 |
56463a6c
|
Phil Davis
|
"<p><b>" . gettext("Only interfaces configured with a static IP will be shown") . ".</b></p>";
|
78 |
|
|
}
|
79 |
5ef4a9e1
|
Darren Embry
|
|
80 |
|
|
$iflist = get_configured_interface_with_descr();
|
81 |
|
|
|
82 |
|
|
/* set the starting interface */
|
83 |
|
|
if (!$if || !isset($iflist[$if])) {
|
84 |
|
|
foreach ($iflist as $ifent => $ifname) {
|
85 |
|
|
$oc = $config['interfaces'][$ifent];
|
86 |
db7a628c
|
Renato Botelho
|
if ((is_array($config['dhcpdv6'][$ifent]) && !isset($config['dhcpdv6'][$ifent]['enable']) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))) ||
|
87 |
56463a6c
|
Phil Davis
|
(!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6']))))) {
|
88 |
5ef4a9e1
|
Darren Embry
|
continue;
|
89 |
56463a6c
|
Phil Davis
|
}
|
90 |
5ef4a9e1
|
Darren Embry
|
$if = $ifent;
|
91 |
|
|
break;
|
92 |
|
|
}
|
93 |
|
|
}
|
94 |
|
|
|
95 |
fba196c3
|
Renato Botelho
|
if (is_array($config['dhcpdv6'][$if])) {
|
96 |
5ef4a9e1
|
Darren Embry
|
/* RA specific */
|
97 |
|
|
$pconfig['ramode'] = $config['dhcpdv6'][$if]['ramode'];
|
98 |
|
|
$pconfig['rapriority'] = $config['dhcpdv6'][$if]['rapriority'];
|
99 |
56463a6c
|
Phil Davis
|
if ($pconfig['rapriority'] == "") {
|
100 |
5ef4a9e1
|
Darren Embry
|
$pconfig['rapriority'] = "medium";
|
101 |
56463a6c
|
Phil Davis
|
}
|
102 |
5ef4a9e1
|
Darren Embry
|
$pconfig['rainterface'] = $config['dhcpdv6'][$if]['rainterface'];
|
103 |
163e4b91
|
Darren Embry
|
$pconfig['radomainsearchlist'] = $config['dhcpdv6'][$if]['radomainsearchlist'];
|
104 |
56463a6c
|
Phil Davis
|
list($pconfig['radns1'], $pconfig['radns2'], $pconfig['radns3'], $pconfig['radns4']) = $config['dhcpdv6'][$if]['radnsserver'];
|
105 |
163e4b91
|
Darren Embry
|
$pconfig['rasamednsasdhcp6'] = isset($config['dhcpdv6'][$if]['rasamednsasdhcp6']);
|
106 |
8c4ee062
|
Darren Embry
|
|
107 |
|
|
$pconfig['subnets'] = $config['dhcpdv6'][$if]['subnets']['item'];
|
108 |
|
|
}
|
109 |
56463a6c
|
Phil Davis
|
if (!is_array($pconfig['subnets'])) {
|
110 |
8c4ee062
|
Darren Embry
|
$pconfig['subnets'] = array();
|
111 |
56463a6c
|
Phil Davis
|
}
|
112 |
5ef4a9e1
|
Darren Embry
|
|
113 |
|
|
$advertise_modes = array("disabled" => "Disabled",
|
114 |
56463a6c
|
Phil Davis
|
"router" => "Router Only",
|
115 |
|
|
"unmanaged" => "Unmanaged",
|
116 |
|
|
"managed" => "Managed",
|
117 |
c6872b3e
|
Renato Botelho
|
"assist" => "Assisted",
|
118 |
|
|
"stateless_dhcp" => "Stateless DHCP");
|
119 |
5ef4a9e1
|
Darren Embry
|
$priority_modes = array("low" => "Low",
|
120 |
56463a6c
|
Phil Davis
|
"medium" => "Normal",
|
121 |
|
|
"high" => "High");
|
122 |
5ef4a9e1
|
Darren Embry
|
$carplist = get_configured_carp_interface_list();
|
123 |
|
|
|
124 |
8c4ee062
|
Darren Embry
|
$subnets_help = gettext("Subnets are specified in CIDR format. " .
|
125 |
56463a6c
|
Phil Davis
|
"Select the CIDR mask that pertains to each entry. " .
|
126 |
|
|
"/128 specifies a single IPv6 host; /64 specifies a normal IPv6 network; etc. " .
|
127 |
|
|
"If no subnets are specified here, the Router Advertisement (RA) Daemon will advertise to the subnet to which the router's interface is assigned.");
|
128 |
8c4ee062
|
Darren Embry
|
|
129 |
5ef4a9e1
|
Darren Embry
|
if ($_POST) {
|
130 |
|
|
unset($input_errors);
|
131 |
|
|
|
132 |
|
|
$pconfig = $_POST;
|
133 |
|
|
|
134 |
163e4b91
|
Darren Embry
|
/* input validation */
|
135 |
8c4ee062
|
Darren Embry
|
|
136 |
|
|
$pconfig['subnets'] = array();
|
137 |
|
|
for ($x = 0; $x < 5000; $x += 1) {
|
138 |
|
|
$address = trim($_POST['subnet_address' . $x]);
|
139 |
56463a6c
|
Phil Davis
|
if ($address === "") {
|
140 |
8c4ee062
|
Darren Embry
|
continue;
|
141 |
56463a6c
|
Phil Davis
|
}
|
142 |
fba196c3
|
Renato Botelho
|
|
143 |
|
|
$bits = trim($_POST['subnet_bits' . $x]);
|
144 |
56463a6c
|
Phil Davis
|
if ($bits === "") {
|
145 |
fba196c3
|
Renato Botelho
|
$bits = "128";
|
146 |
56463a6c
|
Phil Davis
|
}
|
147 |
fba196c3
|
Renato Botelho
|
|
148 |
|
|
if (is_alias($address)) {
|
149 |
8c4ee062
|
Darren Embry
|
$pconfig['subnets'][] = $address;
|
150 |
fba196c3
|
Renato Botelho
|
} else {
|
151 |
|
|
$pconfig['subnets'][] = $address . "/" . $bits;
|
152 |
56463a6c
|
Phil Davis
|
if (!is_ipaddrv6($address)) {
|
153 |
fba196c3
|
Renato Botelho
|
$input_errors[] = sprintf(gettext("An invalid subnet or alias was specified. [%s/%s]"), $address, $bits);
|
154 |
56463a6c
|
Phil Davis
|
}
|
155 |
8c4ee062
|
Darren Embry
|
}
|
156 |
|
|
}
|
157 |
|
|
|
158 |
56463a6c
|
Phil Davis
|
if (($_POST['radns1'] && !is_ipaddrv6($_POST['radns1'])) || ($_POST['radns2'] && !is_ipaddrv6($_POST['radns2'])) || ($_POST['radns3'] && !is_ipaddrv6($_POST['radns3'])) || ($_POST['radns4'] && !is_ipaddrv6($_POST['radns4']))) {
|
159 |
6190312f
|
Phil Davis
|
$input_errors[] = gettext("A valid IPv6 address must be specified for each of the DNS servers.");
|
160 |
56463a6c
|
Phil Davis
|
}
|
161 |
163e4b91
|
Darren Embry
|
if ($_POST['radomainsearchlist']) {
|
162 |
56463a6c
|
Phil Davis
|
$domain_array=preg_split("/[ ;]+/", $_POST['radomainsearchlist']);
|
163 |
163e4b91
|
Darren Embry
|
foreach ($domain_array as $curdomain) {
|
164 |
|
|
if (!is_domain($curdomain)) {
|
165 |
|
|
$input_errors[] = gettext("A valid domain search list must be specified.");
|
166 |
|
|
break;
|
167 |
|
|
}
|
168 |
|
|
}
|
169 |
|
|
}
|
170 |
|
|
|
171 |
5ef4a9e1
|
Darren Embry
|
if (!$input_errors) {
|
172 |
56463a6c
|
Phil Davis
|
if (!is_array($config['dhcpdv6'][$if])) {
|
173 |
5ef4a9e1
|
Darren Embry
|
$config['dhcpdv6'][$if] = array();
|
174 |
56463a6c
|
Phil Davis
|
}
|
175 |
5ef4a9e1
|
Darren Embry
|
|
176 |
|
|
$config['dhcpdv6'][$if]['ramode'] = $_POST['ramode'];
|
177 |
|
|
$config['dhcpdv6'][$if]['rapriority'] = $_POST['rapriority'];
|
178 |
|
|
$config['dhcpdv6'][$if]['rainterface'] = $_POST['rainterface'];
|
179 |
e1968b0d
|
Renato Botelho
|
|
180 |
163e4b91
|
Darren Embry
|
$config['dhcpdv6'][$if]['radomainsearchlist'] = $_POST['radomainsearchlist'];
|
181 |
|
|
unset($config['dhcpdv6'][$if]['radnsserver']);
|
182 |
56463a6c
|
Phil Davis
|
if ($_POST['radns1']) {
|
183 |
163e4b91
|
Darren Embry
|
$config['dhcpdv6'][$if]['radnsserver'][] = $_POST['radns1'];
|
184 |
56463a6c
|
Phil Davis
|
}
|
185 |
|
|
if ($_POST['radns2']) {
|
186 |
163e4b91
|
Darren Embry
|
$config['dhcpdv6'][$if]['radnsserver'][] = $_POST['radns2'];
|
187 |
56463a6c
|
Phil Davis
|
}
|
188 |
|
|
if ($_POST['radns3']) {
|
189 |
6190312f
|
Phil Davis
|
$config['dhcpdv6'][$if]['radnsserver'][] = $_POST['radns3'];
|
190 |
56463a6c
|
Phil Davis
|
}
|
191 |
|
|
if ($_POST['radns4']) {
|
192 |
6190312f
|
Phil Davis
|
$config['dhcpdv6'][$if]['radnsserver'][] = $_POST['radns4'];
|
193 |
56463a6c
|
Phil Davis
|
}
|
194 |
163e4b91
|
Darren Embry
|
|
195 |
|
|
$config['dhcpdv6'][$if]['rasamednsasdhcp6'] = ($_POST['rasamednsasdhcp6']) ? true : false;
|
196 |
|
|
|
197 |
8c4ee062
|
Darren Embry
|
if (count($pconfig['subnets'])) {
|
198 |
|
|
$config['dhcpdv6'][$if]['subnets']['item'] = $pconfig['subnets'];
|
199 |
|
|
} else {
|
200 |
|
|
unset($config['dhcpdv6'][$if]['subnets']);
|
201 |
|
|
}
|
202 |
|
|
|
203 |
5ef4a9e1
|
Darren Embry
|
write_config();
|
204 |
f3475477
|
Darren Embry
|
$retval = services_radvd_configure();
|
205 |
5ef4a9e1
|
Darren Embry
|
$savemsg = get_std_save_message($retval);
|
206 |
|
|
}
|
207 |
|
|
}
|
208 |
|
|
|
209 |
56463a6c
|
Phil Davis
|
$pgtitle = array(gettext("Services"), gettext("Router advertisements"));
|
210 |
5ef4a9e1
|
Darren Embry
|
|
211 |
|
|
include("head.inc");
|
212 |
|
|
|
213 |
|
|
?>
|
214 |
|
|
|
215 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
216 |
|
|
<?php include("fbegin.inc"); ?>
|
217 |
8c4ee062
|
Darren Embry
|
|
218 |
|
|
<script type="text/javascript" src="/javascript/row_helper.js">
|
219 |
|
|
</script>
|
220 |
6672609b
|
Renato Botelho
|
<script type="text/javascript" src="/javascript/autosuggest.js?rev=1">
|
221 |
8c4ee062
|
Darren Embry
|
</script>
|
222 |
|
|
<script type="text/javascript" src="/javascript/suggestions.js">
|
223 |
|
|
</script>
|
224 |
|
|
<script type="text/javascript">
|
225 |
d29303c5
|
Colin Fleming
|
//<![CDATA[
|
226 |
8c4ee062
|
Darren Embry
|
rowname[0] = "subnet_address";
|
227 |
|
|
rowtype[0] = "textbox";
|
228 |
|
|
rowsize[0] = "30";
|
229 |
|
|
rowname[1] = "subnet_bits";
|
230 |
|
|
rowtype[1] = "select";
|
231 |
|
|
rowsize[1] = "1";
|
232 |
|
|
function add_alias_control() {
|
233 |
|
|
var name = "subnet_address" + (totalrows - 1);
|
234 |
|
|
obj = document.getElementById(name);
|
235 |
|
|
obj.setAttribute('class', 'formfldalias');
|
236 |
|
|
obj.setAttribute('autocomplete', 'off');
|
237 |
|
|
objAlias[totalrows - 1] = new AutoSuggestControl(obj, new StateSuggestions(addressarray));
|
238 |
|
|
}
|
239 |
d29303c5
|
Colin Fleming
|
//]]>
|
240 |
8c4ee062
|
Darren Embry
|
</script>
|
241 |
|
|
|
242 |
f3475477
|
Darren Embry
|
<form action="services_router_advertisements.php" method="post" name="iform" id="iform">
|
243 |
5ef4a9e1
|
Darren Embry
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
244 |
|
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
245 |
d29303c5
|
Colin Fleming
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="router advert">
|
246 |
56463a6c
|
Phil Davis
|
<tr>
|
247 |
|
|
<td>
|
248 |
5ef4a9e1
|
Darren Embry
|
<?php
|
249 |
|
|
/* active tabs */
|
250 |
|
|
$tab_array = array();
|
251 |
|
|
$tabscounter = 0;
|
252 |
|
|
$i = 0;
|
253 |
|
|
foreach ($iflist as $ifent => $ifname) {
|
254 |
|
|
$oc = $config['interfaces'][$ifent];
|
255 |
db7a628c
|
Renato Botelho
|
if ((is_array($config['dhcpdv6'][$ifent]) && !isset($config['dhcpdv6'][$ifent]['enable']) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))) ||
|
256 |
56463a6c
|
Phil Davis
|
(!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6']))))) {
|
257 |
5ef4a9e1
|
Darren Embry
|
continue;
|
258 |
56463a6c
|
Phil Davis
|
}
|
259 |
|
|
if ($ifent == $if) {
|
260 |
5ef4a9e1
|
Darren Embry
|
$active = true;
|
261 |
56463a6c
|
Phil Davis
|
} else {
|
262 |
5ef4a9e1
|
Darren Embry
|
$active = false;
|
263 |
56463a6c
|
Phil Davis
|
}
|
264 |
5ef4a9e1
|
Darren Embry
|
$tab_array[] = array($ifname, $active, "services_dhcpv6.php?if={$ifent}");
|
265 |
|
|
$tabscounter++;
|
266 |
|
|
}
|
267 |
|
|
if ($tabscounter == 0) {
|
268 |
|
|
echo "</td></tr></table></form>";
|
269 |
|
|
include("fend.inc");
|
270 |
|
|
echo "</body>";
|
271 |
|
|
echo "</html>";
|
272 |
|
|
exit;
|
273 |
|
|
}
|
274 |
|
|
display_top_tabs($tab_array);
|
275 |
|
|
?>
|
276 |
56463a6c
|
Phil Davis
|
</td>
|
277 |
|
|
</tr>
|
278 |
|
|
<tr>
|
279 |
|
|
<td class="tabnavtbl">
|
280 |
f3475477
|
Darren Embry
|
<?php
|
281 |
56463a6c
|
Phil Davis
|
$tab_array = array();
|
282 |
|
|
$tab_array[] = array(gettext("DHCPv6 Server"), false, "services_dhcpv6.php?if={$if}");
|
283 |
|
|
$tab_array[] = array(gettext("Router Advertisements"), true, "services_router_advertisements.php?if={$if}");
|
284 |
|
|
display_top_tabs($tab_array);
|
285 |
f3475477
|
Darren Embry
|
?>
|
286 |
56463a6c
|
Phil Davis
|
</td>
|
287 |
|
|
</tr>
|
288 |
|
|
<tr>
|
289 |
|
|
<td>
|
290 |
|
|
<div id="mainarea">
|
291 |
|
|
<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
|
292 |
|
|
<tr>
|
293 |
|
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Router Advertisements");?></td>
|
294 |
|
|
<td width="78%" class="vtable">
|
295 |
|
|
<select name="ramode" id="ramode">
|
296 |
|
|
<?php foreach ($advertise_modes as $name => $value) { ?>
|
297 |
|
|
<option value="<?=$name ?>" <?php if ($pconfig['ramode'] == $name) echo "selected=\"selected\""; ?> > <?=$value ?></option>
|
298 |
|
|
<?php } ?>
|
299 |
|
|
</select>
|
300 |
|
|
<br />
|
301 |
|
|
<strong><?php printf(gettext("Select the Operating Mode for the Router Advertisement (RA) Daemon."))?></strong>
|
302 |
|
|
<?php printf(gettext("Use \"Router Only\" to only advertise this router, \"Unmanaged\" for Router Advertising with Stateless Autoconfig, \"Managed\" for assignment through (a) DHCPv6 Server, \"Assisted\" for DHCPv6 Server assignment combined with Stateless Autoconfig"));?>
|
303 |
|
|
<?php printf(gettext("It is not required to activate this DHCPv6 server when set to \"Managed\", this can be another host on the network")); ?>
|
304 |
|
|
</td>
|
305 |
|
|
</tr>
|
306 |
|
|
<tr>
|
307 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Router Priority");?></td>
|
308 |
|
|
<td width="78%" class="vtable">
|
309 |
|
|
<select name="rapriority" id="rapriority">
|
310 |
|
|
<?php foreach ($priority_modes as $name => $value) { ?>
|
311 |
|
|
<option value="<?=$name ?>" <?php if ($pconfig['rapriority'] == $name) echo "selected=\"selected\""; ?> > <?=$value ?></option>
|
312 |
|
|
<?php } ?>
|
313 |
|
|
</select>
|
314 |
|
|
<br />
|
315 |
|
|
<strong><?php printf(gettext("Select the Priority for the Router Advertisement (RA) Daemon."))?></strong>
|
316 |
|
|
</td>
|
317 |
|
|
</tr>
|
318 |
8c4ee062
|
Darren Embry
|
<?php
|
319 |
56463a6c
|
Phil Davis
|
$carplistif = array();
|
320 |
|
|
if (count($carplist) > 0) {
|
321 |
|
|
foreach ($carplist as $ifname => $vip) {
|
322 |
|
|
if ((preg_match("/^{$if}_/", $ifname)) && (is_ipaddrv6($vip))) {
|
323 |
|
|
$carplistif[$ifname] = $vip;
|
324 |
|
|
}
|
325 |
|
|
}
|
326 |
|
|
}
|
327 |
|
|
if (count($carplistif) > 0) {
|
328 |
8c4ee062
|
Darren Embry
|
?>
|
329 |
56463a6c
|
Phil Davis
|
<tr>
|
330 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("RA Interface");?></td>
|
331 |
|
|
<td width="78%" class="vtable">
|
332 |
|
|
<select name="rainterface" id="rainterface">
|
333 |
|
|
<?php foreach ($carplistif as $ifname => $vip) { ?>
|
334 |
|
|
<option value="interface" <?php if ($pconfig['rainterface'] == "interface") echo "selected=\"selected\""; ?> > <?=strtoupper($if); ?></option>
|
335 |
|
|
<option value="<?=$ifname ?>" <?php if ($pconfig['rainterface'] == $ifname) echo "selected=\"selected\""; ?> > <?="$ifname - $vip"; ?></option>
|
336 |
8c4ee062
|
Darren Embry
|
<?php } ?>
|
337 |
56463a6c
|
Phil Davis
|
</select>
|
338 |
|
|
<br />
|
339 |
|
|
<strong><?php printf(gettext("Select the Interface for the Router Advertisement (RA) Daemon."))?></strong>
|
340 |
|
|
</td>
|
341 |
|
|
</tr>
|
342 |
|
|
<?php
|
343 |
|
|
}
|
344 |
|
|
?>
|
345 |
|
|
<tr>
|
346 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("RA Subnet(s)");?></td>
|
347 |
|
|
<td width="78%" class="vtable">
|
348 |
|
|
<div><?= htmlentities($subnets_help) ?></div>
|
349 |
|
|
<table id="maintable" summary="subnets">
|
350 |
|
|
<tbody>
|
351 |
8c4ee062
|
Darren Embry
|
<?php
|
352 |
56463a6c
|
Phil Davis
|
$counter = 0;
|
353 |
|
|
foreach ($pconfig['subnets'] as $subnet) {
|
354 |
|
|
$address_name = "subnet_address" . $counter;
|
355 |
|
|
$bits_name = "subnet_bits" . $counter;
|
356 |
|
|
list($address, $subnet) = explode("/", $subnet);
|
357 |
|
|
?>
|
358 |
|
|
<tr>
|
359 |
|
|
<td>
|
360 |
|
|
<input autocomplete="off" name="<?= $address_name ?>" type="text" class="formfldalias" id="<?= $address_name ?>" size="30" value="<?= htmlentities($address) ?>" />
|
361 |
|
|
</td>
|
362 |
|
|
<td>
|
363 |
|
|
<select name="<?= $bits_name ?>" class="formselect" id="<?= $bits_name ?>">
|
364 |
|
|
<option value="">
|
365 |
|
|
<?php for ($i = 128; $i >= 0; $i -= 1) { ?>
|
366 |
|
|
<option value="<?= $i ?>" <?= ("$subnet" === "$i") ? "selected='selected'" : "" ?>><?= $i ?></option>
|
367 |
|
|
<?php } ?>
|
368 |
|
|
</select>
|
369 |
|
|
</td>
|
370 |
|
|
<td>
|
371 |
|
|
<a onclick="removeRow(this); return false;" href="#"><img border="0" src="/themes/<?echo $g['theme'];?>/images/icons/icon_x.gif" alt="" title="<?=gettext("remove this entry"); ?>" /></a>
|
372 |
|
|
</td>
|
373 |
|
|
</tr>
|
374 |
|
|
<?php
|
375 |
|
|
$counter += 1;
|
376 |
|
|
}
|
377 |
8c4ee062
|
Darren Embry
|
?>
|
378 |
56463a6c
|
Phil Davis
|
<tr style="display:none">
|
379 |
|
|
<td></td>
|
380 |
|
|
</tr>
|
381 |
|
|
</tbody>
|
382 |
|
|
</table>
|
383 |
|
|
<script type="text/javascript">
|
384 |
|
|
//<![CDATA[
|
385 |
|
|
field_counter_js = 2;
|
386 |
|
|
totalrows = <?= $counter ?>;
|
387 |
|
|
//]]>
|
388 |
|
|
</script>
|
389 |
|
|
<div id="addrowbutton">
|
390 |
|
|
<a onclick="javascript:addRowTo('maintable'); add_alias_control(); return false;" href="#"><!--
|
391 |
|
|
--><img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="" title="<?=gettext("add another entry"); ?>" /></a>
|
392 |
|
|
</div>
|
393 |
|
|
</td>
|
394 |
|
|
</tr>
|
395 |
|
|
|
396 |
|
|
<tr>
|
397 |
|
|
<td colspan="2" class="list" height="12"> </td>
|
398 |
|
|
</tr>
|
399 |
|
|
|
400 |
|
|
<tr>
|
401 |
|
|
<td colspan="2" valign="top" class="listtopic">DNS</td>
|
402 |
|
|
</tr>
|
403 |
|
|
|
404 |
|
|
<tr>
|
405 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("DNS servers");?></td>
|
406 |
|
|
<td width="78%" class="vtable">
|
407 |
|
|
<input name="radns1" type="text" class="formfld unknown" id="radns1" size="28" value="<?=htmlspecialchars($pconfig['radns1']);?>" /><br />
|
408 |
|
|
<input name="radns2" type="text" class="formfld unknown" id="radns2" size="28" value="<?=htmlspecialchars($pconfig['radns2']);?>" /><br />
|
409 |
|
|
<input name="radns3" type="text" class="formfld unknown" id="radns3" size="28" value="<?=htmlspecialchars($pconfig['radns3']);?>" /><br />
|
410 |
|
|
<input name="radns4" type="text" class="formfld unknown" id="radns4" size="28" value="<?=htmlspecialchars($pconfig['radns4']);?>" /><br />
|
411 |
75eef6ca
|
Chris Buechler
|
<?=gettext("NOTE: leave blank to use the system default DNS servers - this interface's IP if DNS Forwarder or Resolver is enabled, otherwise the servers configured on the General page.");?>
|
412 |
56463a6c
|
Phil Davis
|
</td>
|
413 |
|
|
</tr>
|
414 |
|
|
|
415 |
|
|
<tr>
|
416 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Domain search list");?></td>
|
417 |
|
|
<td width="78%" class="vtable">
|
418 |
|
|
<input name="radomainsearchlist" type="text" class="formfld unknown" id="radomainsearchlist" size="28" value="<?=htmlspecialchars($pconfig['radomainsearchlist']);?>" /><br />
|
419 |
|
|
<?=gettext("The RA server can optionally provide a domain search list. Use the semicolon character as separator");?>
|
420 |
|
|
</td>
|
421 |
|
|
</tr>
|
422 |
|
|
|
423 |
|
|
<tr>
|
424 |
|
|
<td width="22%" valign="top" class="vncell"> </td>
|
425 |
|
|
<td width="78%" class="vtable">
|
426 |
|
|
<input id="rasamednsasdhcp6" name="rasamednsasdhcp6" type="checkbox" value="yes" <?php if ($pconfig['rasamednsasdhcp6']) { echo "checked='checked'"; } ?> />
|
427 |
|
|
<strong><?= gettext("Use same settings as DHCPv6 server"); ?></strong>
|
428 |
|
|
</td>
|
429 |
|
|
</tr>
|
430 |
|
|
|
431 |
|
|
<tr>
|
432 |
|
|
<td width="22%" valign="top"> </td>
|
433 |
|
|
<td width="78%">
|
434 |
|
|
<input name="if" type="hidden" value="<?=$if;?>" />
|
435 |
|
|
<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
|
436 |
|
|
</td>
|
437 |
|
|
</tr>
|
438 |
|
|
</table>
|
439 |
|
|
</div>
|
440 |
|
|
</td>
|
441 |
|
|
</tr>
|
442 |
5ef4a9e1
|
Darren Embry
|
</table>
|
443 |
|
|
</form>
|
444 |
8c4ee062
|
Darren Embry
|
|
445 |
91f026b0
|
ayvis
|
<script type="text/javascript">
|
446 |
8c4ee062
|
Darren Embry
|
//<![CDATA[
|
447 |
4e0fc44f
|
Darren Embry
|
jQuery(function ($) {
|
448 |
|
|
var $rasamednsasdhcp6 = $("#rasamednsasdhcp6");
|
449 |
6190312f
|
Phil Davis
|
var $triggered_checkboxes = $("#radns1, #radns2, #radns3, #radns4, #radomainsearchlist");
|
450 |
4e0fc44f
|
Darren Embry
|
if ($rasamednsasdhcp6.length !== 1) { return; }
|
451 |
|
|
var onchange = function () {
|
452 |
|
|
var checked = $rasamednsasdhcp6.is(":checked");
|
453 |
|
|
if (checked) {
|
454 |
|
|
$triggered_checkboxes.each(function () { this.disabled = true; });
|
455 |
|
|
} else {
|
456 |
|
|
$triggered_checkboxes.each(function () { this.disabled = false; });
|
457 |
|
|
}
|
458 |
|
|
};
|
459 |
|
|
$rasamednsasdhcp6.bind("change", onchange);
|
460 |
|
|
onchange();
|
461 |
|
|
});
|
462 |
8c4ee062
|
Darren Embry
|
|
463 |
|
|
var addressarray = <?= json_encode(get_alias_list("host", "network", "openvpn", "urltable")); ?>;
|
464 |
|
|
var objAlias = [];
|
465 |
|
|
function createAutoSuggest () {
|
466 |
|
|
<?php for ($i = 0; $i < $counter; $i += 1) { ?>
|
467 |
|
|
objAlias.push(new AutoSuggestControl(document.getElementById('subnet_address<?= $i ?>'), new StateSuggestions(addressarray)));
|
468 |
|
|
<?php } ?>
|
469 |
|
|
new AutoSuggestControl(document.getElementById('radns1'), new StateSuggestions(addressarray));
|
470 |
|
|
new AutoSuggestControl(document.getElementById('radns2'), new StateSuggestions(addressarray));
|
471 |
6190312f
|
Phil Davis
|
new AutoSuggestControl(document.getElementById('radns3'), new StateSuggestions(addressarray));
|
472 |
|
|
new AutoSuggestControl(document.getElementById('radns4'), new StateSuggestions(addressarray));
|
473 |
8c4ee062
|
Darren Embry
|
}
|
474 |
|
|
setTimeout(createAutoSuggest, 500);
|
475 |
|
|
//]]>
|
476 |
4e0fc44f
|
Darren Embry
|
</script>
|
477 |
8c4ee062
|
Darren Embry
|
|
478 |
5ef4a9e1
|
Darren Embry
|
<?php include("fend.inc"); ?>
|
479 |
|
|
</body>
|
480 |
|
|
</html>
|