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 |
|
|
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 |
|
|
ini_set("memory_limit","64M");
|
59 |
|
|
|
60 |
|
|
$if = $_GET['if'];
|
61 |
|
|
if ($_POST['if'])
|
62 |
|
|
$if = $_POST['if'];
|
63 |
|
|
|
64 |
|
|
/* if OLSRD is enabled, allow WAN to house DHCP. */
|
65 |
|
|
if($config['installedpackages']['olsrd']) {
|
66 |
|
|
foreach($config['installedpackages']['olsrd']['config'] as $olsrd) {
|
67 |
e1968b0d
|
Renato Botelho
|
if($olsrd['enable']) {
|
68 |
|
|
$is_olsr_enabled = true;
|
69 |
|
|
break;
|
70 |
|
|
}
|
71 |
5ef4a9e1
|
Darren Embry
|
}
|
72 |
|
|
}
|
73 |
|
|
|
74 |
|
|
if (!$_GET['if'])
|
75 |
f3475477
|
Darren Embry
|
$savemsg = "<p><b>" . gettext("The DHCPv6 Server can only be enabled on interfaces configured with static IP addresses") . ".</b></p>" .
|
76 |
|
|
"<p><b>" . gettext("Only interfaces configured with a static IP will be shown") . ".</b></p>";
|
77 |
5ef4a9e1
|
Darren Embry
|
|
78 |
|
|
$iflist = get_configured_interface_with_descr();
|
79 |
|
|
|
80 |
|
|
/* set the starting interface */
|
81 |
|
|
if (!$if || !isset($iflist[$if])) {
|
82 |
|
|
foreach ($iflist as $ifent => $ifname) {
|
83 |
|
|
$oc = $config['interfaces'][$ifent];
|
84 |
db7a628c
|
Renato Botelho
|
if ((is_array($config['dhcpdv6'][$ifent]) && !isset($config['dhcpdv6'][$ifent]['enable']) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))) ||
|
85 |
|
|
(!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))))
|
86 |
5ef4a9e1
|
Darren Embry
|
continue;
|
87 |
|
|
$if = $ifent;
|
88 |
|
|
break;
|
89 |
|
|
}
|
90 |
|
|
}
|
91 |
|
|
|
92 |
fba196c3
|
Renato Botelho
|
if (is_array($config['dhcpdv6'][$if])) {
|
93 |
5ef4a9e1
|
Darren Embry
|
/* RA specific */
|
94 |
|
|
$pconfig['ramode'] = $config['dhcpdv6'][$if]['ramode'];
|
95 |
|
|
$pconfig['rapriority'] = $config['dhcpdv6'][$if]['rapriority'];
|
96 |
|
|
if($pconfig['rapriority'] == "")
|
97 |
|
|
$pconfig['rapriority'] = "medium";
|
98 |
|
|
$pconfig['rainterface'] = $config['dhcpdv6'][$if]['rainterface'];
|
99 |
163e4b91
|
Darren Embry
|
$pconfig['radomainsearchlist'] = $config['dhcpdv6'][$if]['radomainsearchlist'];
|
100 |
6190312f
|
Phil Davis
|
list($pconfig['radns1'],$pconfig['radns2'],$pconfig['radns3'],$pconfig['radns4']) = $config['dhcpdv6'][$if]['radnsserver'];
|
101 |
163e4b91
|
Darren Embry
|
$pconfig['rasamednsasdhcp6'] = isset($config['dhcpdv6'][$if]['rasamednsasdhcp6']);
|
102 |
8c4ee062
|
Darren Embry
|
|
103 |
|
|
$pconfig['subnets'] = $config['dhcpdv6'][$if]['subnets']['item'];
|
104 |
|
|
}
|
105 |
fba196c3
|
Renato Botelho
|
if (!is_array($pconfig['subnets']))
|
106 |
8c4ee062
|
Darren Embry
|
$pconfig['subnets'] = array();
|
107 |
5ef4a9e1
|
Darren Embry
|
|
108 |
|
|
$advertise_modes = array("disabled" => "Disabled",
|
109 |
f3475477
|
Darren Embry
|
"router" => "Router Only",
|
110 |
|
|
"unmanaged" => "Unmanaged",
|
111 |
|
|
"managed" => "Managed",
|
112 |
|
|
"assist" => "Assisted");
|
113 |
5ef4a9e1
|
Darren Embry
|
$priority_modes = array("low" => "Low",
|
114 |
f3475477
|
Darren Embry
|
"medium" => "Normal",
|
115 |
|
|
"high" => "High");
|
116 |
5ef4a9e1
|
Darren Embry
|
$carplist = get_configured_carp_interface_list();
|
117 |
|
|
|
118 |
8c4ee062
|
Darren Embry
|
$subnets_help = gettext("Subnets are specified in CIDR format. " .
|
119 |
e1968b0d
|
Renato Botelho
|
"Select the CIDR mask that pertains to each entry. " .
|
120 |
|
|
"/128 specifies a single IPv6 host; /64 specifies a normal IPv6 network; etc. " .
|
121 |
|
|
"If no subnets are specified here, the Router Advertisement (RA) Daemon will advertise to the subnet to which the router's interface is assigned.");
|
122 |
8c4ee062
|
Darren Embry
|
|
123 |
5ef4a9e1
|
Darren Embry
|
if ($_POST) {
|
124 |
|
|
unset($input_errors);
|
125 |
|
|
|
126 |
|
|
$pconfig = $_POST;
|
127 |
|
|
|
128 |
163e4b91
|
Darren Embry
|
/* input validation */
|
129 |
8c4ee062
|
Darren Embry
|
|
130 |
|
|
$pconfig['subnets'] = array();
|
131 |
|
|
for ($x = 0; $x < 5000; $x += 1) {
|
132 |
|
|
$address = trim($_POST['subnet_address' . $x]);
|
133 |
fba196c3
|
Renato Botelho
|
if ($address === "")
|
134 |
8c4ee062
|
Darren Embry
|
continue;
|
135 |
fba196c3
|
Renato Botelho
|
|
136 |
|
|
$bits = trim($_POST['subnet_bits' . $x]);
|
137 |
|
|
if ($bits === "")
|
138 |
|
|
$bits = "128";
|
139 |
|
|
|
140 |
|
|
if (is_alias($address)) {
|
141 |
8c4ee062
|
Darren Embry
|
$pconfig['subnets'][] = $address;
|
142 |
fba196c3
|
Renato Botelho
|
} else {
|
143 |
|
|
$pconfig['subnets'][] = $address . "/" . $bits;
|
144 |
|
|
if (!is_ipaddrv6($address))
|
145 |
|
|
$input_errors[] = sprintf(gettext("An invalid subnet or alias was specified. [%s/%s]"), $address, $bits);
|
146 |
8c4ee062
|
Darren Embry
|
}
|
147 |
|
|
}
|
148 |
|
|
|
149 |
6190312f
|
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'])))
|
150 |
|
|
$input_errors[] = gettext("A valid IPv6 address must be specified for each of the DNS servers.");
|
151 |
163e4b91
|
Darren Embry
|
if ($_POST['radomainsearchlist']) {
|
152 |
|
|
$domain_array=preg_split("/[ ;]+/",$_POST['radomainsearchlist']);
|
153 |
|
|
foreach ($domain_array as $curdomain) {
|
154 |
|
|
if (!is_domain($curdomain)) {
|
155 |
|
|
$input_errors[] = gettext("A valid domain search list must be specified.");
|
156 |
|
|
break;
|
157 |
|
|
}
|
158 |
|
|
}
|
159 |
|
|
}
|
160 |
|
|
|
161 |
5ef4a9e1
|
Darren Embry
|
if (!$input_errors) {
|
162 |
|
|
if (!is_array($config['dhcpdv6'][$if]))
|
163 |
|
|
$config['dhcpdv6'][$if] = array();
|
164 |
|
|
|
165 |
|
|
$config['dhcpdv6'][$if]['ramode'] = $_POST['ramode'];
|
166 |
|
|
$config['dhcpdv6'][$if]['rapriority'] = $_POST['rapriority'];
|
167 |
|
|
$config['dhcpdv6'][$if]['rainterface'] = $_POST['rainterface'];
|
168 |
e1968b0d
|
Renato Botelho
|
|
169 |
163e4b91
|
Darren Embry
|
$config['dhcpdv6'][$if]['radomainsearchlist'] = $_POST['radomainsearchlist'];
|
170 |
|
|
unset($config['dhcpdv6'][$if]['radnsserver']);
|
171 |
|
|
if ($_POST['radns1'])
|
172 |
|
|
$config['dhcpdv6'][$if]['radnsserver'][] = $_POST['radns1'];
|
173 |
|
|
if ($_POST['radns2'])
|
174 |
|
|
$config['dhcpdv6'][$if]['radnsserver'][] = $_POST['radns2'];
|
175 |
6190312f
|
Phil Davis
|
if ($_POST['radns3'])
|
176 |
|
|
$config['dhcpdv6'][$if]['radnsserver'][] = $_POST['radns3'];
|
177 |
|
|
if ($_POST['radns4'])
|
178 |
|
|
$config['dhcpdv6'][$if]['radnsserver'][] = $_POST['radns4'];
|
179 |
163e4b91
|
Darren Embry
|
|
180 |
|
|
$config['dhcpdv6'][$if]['rasamednsasdhcp6'] = ($_POST['rasamednsasdhcp6']) ? true : false;
|
181 |
|
|
|
182 |
8c4ee062
|
Darren Embry
|
if (count($pconfig['subnets'])) {
|
183 |
|
|
$config['dhcpdv6'][$if]['subnets']['item'] = $pconfig['subnets'];
|
184 |
|
|
} else {
|
185 |
|
|
unset($config['dhcpdv6'][$if]['subnets']);
|
186 |
|
|
}
|
187 |
|
|
|
188 |
5ef4a9e1
|
Darren Embry
|
write_config();
|
189 |
f3475477
|
Darren Embry
|
$retval = services_radvd_configure();
|
190 |
5ef4a9e1
|
Darren Embry
|
$savemsg = get_std_save_message($retval);
|
191 |
|
|
}
|
192 |
|
|
}
|
193 |
|
|
|
194 |
f3475477
|
Darren Embry
|
$pgtitle = array(gettext("Services"),gettext("Router advertisements"));
|
195 |
5ef4a9e1
|
Darren Embry
|
|
196 |
|
|
include("head.inc");
|
197 |
|
|
|
198 |
|
|
?>
|
199 |
|
|
|
200 |
|
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
201 |
|
|
<?php include("fbegin.inc"); ?>
|
202 |
8c4ee062
|
Darren Embry
|
|
203 |
|
|
<script type="text/javascript" src="/javascript/row_helper.js">
|
204 |
|
|
</script>
|
205 |
6672609b
|
Renato Botelho
|
<script type="text/javascript" src="/javascript/autosuggest.js?rev=1">
|
206 |
8c4ee062
|
Darren Embry
|
</script>
|
207 |
|
|
<script type="text/javascript" src="/javascript/suggestions.js">
|
208 |
|
|
</script>
|
209 |
|
|
<script type="text/javascript">
|
210 |
d29303c5
|
Colin Fleming
|
//<![CDATA[
|
211 |
8c4ee062
|
Darren Embry
|
rowname[0] = "subnet_address";
|
212 |
|
|
rowtype[0] = "textbox";
|
213 |
|
|
rowsize[0] = "30";
|
214 |
|
|
rowname[1] = "subnet_bits";
|
215 |
|
|
rowtype[1] = "select";
|
216 |
|
|
rowsize[1] = "1";
|
217 |
|
|
function add_alias_control() {
|
218 |
|
|
var name = "subnet_address" + (totalrows - 1);
|
219 |
|
|
obj = document.getElementById(name);
|
220 |
|
|
obj.setAttribute('class', 'formfldalias');
|
221 |
|
|
obj.setAttribute('autocomplete', 'off');
|
222 |
|
|
objAlias[totalrows - 1] = new AutoSuggestControl(obj, new StateSuggestions(addressarray));
|
223 |
|
|
}
|
224 |
d29303c5
|
Colin Fleming
|
//]]>
|
225 |
8c4ee062
|
Darren Embry
|
</script>
|
226 |
|
|
|
227 |
f3475477
|
Darren Embry
|
<form action="services_router_advertisements.php" method="post" name="iform" id="iform">
|
228 |
5ef4a9e1
|
Darren Embry
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
229 |
|
|
<?php if ($savemsg) print_info_box($savemsg); ?>
|
230 |
d29303c5
|
Colin Fleming
|
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="router advert">
|
231 |
5ef4a9e1
|
Darren Embry
|
<tr><td>
|
232 |
|
|
<?php
|
233 |
|
|
/* active tabs */
|
234 |
|
|
$tab_array = array();
|
235 |
|
|
$tabscounter = 0;
|
236 |
|
|
$i = 0;
|
237 |
|
|
foreach ($iflist as $ifent => $ifname) {
|
238 |
|
|
$oc = $config['interfaces'][$ifent];
|
239 |
db7a628c
|
Renato Botelho
|
if ((is_array($config['dhcpdv6'][$ifent]) && !isset($config['dhcpdv6'][$ifent]['enable']) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))) ||
|
240 |
|
|
(!is_array($config['dhcpdv6'][$ifent]) && !(is_ipaddrv6($oc['ipaddrv6']) && (!is_linklocal($oc['ipaddrv6'])))))
|
241 |
5ef4a9e1
|
Darren Embry
|
continue;
|
242 |
|
|
if ($ifent == $if)
|
243 |
|
|
$active = true;
|
244 |
|
|
else
|
245 |
|
|
$active = false;
|
246 |
|
|
$tab_array[] = array($ifname, $active, "services_dhcpv6.php?if={$ifent}");
|
247 |
|
|
$tabscounter++;
|
248 |
|
|
}
|
249 |
|
|
if ($tabscounter == 0) {
|
250 |
|
|
echo "</td></tr></table></form>";
|
251 |
|
|
include("fend.inc");
|
252 |
|
|
echo "</body>";
|
253 |
|
|
echo "</html>";
|
254 |
|
|
exit;
|
255 |
|
|
}
|
256 |
|
|
display_top_tabs($tab_array);
|
257 |
|
|
?>
|
258 |
|
|
</td></tr>
|
259 |
f3475477
|
Darren Embry
|
<tr><td class="tabnavtbl">
|
260 |
|
|
<?php
|
261 |
|
|
$tab_array = array();
|
262 |
|
|
$tab_array[] = array(gettext("DHCPv6 Server"), false, "services_dhcpv6.php?if={$if}");
|
263 |
|
|
$tab_array[] = array(gettext("Router Advertisements"), true, "services_router_advertisements.php?if={$if}");
|
264 |
|
|
display_top_tabs($tab_array);
|
265 |
|
|
?>
|
266 |
|
|
</td></tr>
|
267 |
5ef4a9e1
|
Darren Embry
|
<tr>
|
268 |
|
|
<td>
|
269 |
|
|
<div id="mainarea">
|
270 |
d29303c5
|
Colin Fleming
|
<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
|
271 |
5ef4a9e1
|
Darren Embry
|
<tr>
|
272 |
|
|
<td width="22%" valign="top" class="vncellreq"><?=gettext("Router Advertisements");?></td>
|
273 |
|
|
<td width="78%" class="vtable">
|
274 |
|
|
<select name="ramode" id="ramode">
|
275 |
|
|
<?php foreach($advertise_modes as $name => $value) { ?>
|
276 |
d29303c5
|
Colin Fleming
|
<option value="<?=$name ?>" <?php if ($pconfig['ramode'] == $name) echo "selected=\"selected\""; ?> > <?=$value ?></option>
|
277 |
5ef4a9e1
|
Darren Embry
|
<?php } ?>
|
278 |
|
|
</select><br />
|
279 |
|
|
<strong><?php printf(gettext("Select the Operating Mode for the Router Advertisement (RA) Daemon."))?></strong>
|
280 |
|
|
<?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"));?>
|
281 |
|
|
<?php printf(gettext("It is not required to activate this DHCPv6 server when set to \"Managed\", this can be another host on the network")); ?>
|
282 |
|
|
</td>
|
283 |
|
|
</tr>
|
284 |
|
|
<tr>
|
285 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Router Priority");?></td>
|
286 |
|
|
<td width="78%" class="vtable">
|
287 |
|
|
<select name="rapriority" id="rapriority">
|
288 |
|
|
<?php foreach($priority_modes as $name => $value) { ?>
|
289 |
d29303c5
|
Colin Fleming
|
<option value="<?=$name ?>" <?php if ($pconfig['rapriority'] == $name) echo "selected=\"selected\""; ?> > <?=$value ?></option>
|
290 |
5ef4a9e1
|
Darren Embry
|
<?php } ?>
|
291 |
|
|
</select><br />
|
292 |
|
|
<strong><?php printf(gettext("Select the Priority for the Router Advertisement (RA) Daemon."))?></strong>
|
293 |
|
|
</td>
|
294 |
|
|
</tr>
|
295 |
|
|
<?php
|
296 |
|
|
$carplistif = array();
|
297 |
|
|
if(count($carplist) > 0) {
|
298 |
|
|
foreach($carplist as $ifname => $vip) {
|
299 |
|
|
if((preg_match("/^{$if}_/", $ifname)) && (is_ipaddrv6($vip)))
|
300 |
|
|
$carplistif[$ifname] = $vip;
|
301 |
|
|
}
|
302 |
|
|
}
|
303 |
|
|
if(count($carplistif) > 0) {
|
304 |
|
|
?>
|
305 |
|
|
<tr>
|
306 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("RA Interface");?></td>
|
307 |
|
|
<td width="78%" class="vtable">
|
308 |
|
|
<select name="rainterface" id="rainterface">
|
309 |
|
|
<?php foreach($carplistif as $ifname => $vip) { ?>
|
310 |
d29303c5
|
Colin Fleming
|
<option value="interface" <?php if ($pconfig['rainterface'] == "interface") echo "selected=\"selected\""; ?> > <?=strtoupper($if); ?></option>
|
311 |
|
|
<option value="<?=$ifname ?>" <?php if ($pconfig['rainterface'] == $ifname) echo "selected=\"selected\""; ?> > <?="$ifname - $vip"; ?></option>
|
312 |
5ef4a9e1
|
Darren Embry
|
<?php } ?>
|
313 |
|
|
</select><br />
|
314 |
|
|
<strong><?php printf(gettext("Select the Interface for the Router Advertisement (RA) Daemon."))?></strong>
|
315 |
|
|
</td>
|
316 |
|
|
</tr>
|
317 |
|
|
<?php } ?>
|
318 |
4e0fc44f
|
Darren Embry
|
|
319 |
8c4ee062
|
Darren Embry
|
<tr>
|
320 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("RA Subnet(s)");?></td>
|
321 |
|
|
<td width="78%" class="vtable">
|
322 |
|
|
<div><?= htmlentities($subnets_help) ?></div>
|
323 |
d29303c5
|
Colin Fleming
|
<table id="maintable" summary="subnets">
|
324 |
8c4ee062
|
Darren Embry
|
<tbody>
|
325 |
|
|
<?php
|
326 |
|
|
$counter = 0;
|
327 |
|
|
foreach ($pconfig['subnets'] as $subnet) {
|
328 |
|
|
$address_name = "subnet_address" . $counter;
|
329 |
|
|
$bits_name = "subnet_bits" . $counter;
|
330 |
|
|
list($address, $subnet) = explode("/", $subnet);
|
331 |
|
|
?>
|
332 |
|
|
<tr>
|
333 |
|
|
<td>
|
334 |
|
|
<input autocomplete="off" name="<?= $address_name ?>" type="text" class="formfldalias" id="<?= $address_name ?>" size="30" value="<?= htmlentities($address) ?>" />
|
335 |
|
|
</td>
|
336 |
|
|
<td>
|
337 |
|
|
<select name="<?= $bits_name ?>" class="formselect" id="<?= $bits_name ?>">
|
338 |
|
|
<option value="">
|
339 |
|
|
<?php for ($i = 128; $i >= 0; $i -= 1) { ?>
|
340 |
|
|
<option value="<?= $i ?>" <?= ("$subnet" === "$i") ? "selected='selected'" : "" ?>><?= $i ?></option>
|
341 |
|
|
<?php } ?>
|
342 |
|
|
</select>
|
343 |
|
|
</td>
|
344 |
|
|
<td>
|
345 |
|
|
<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>
|
346 |
|
|
</td>
|
347 |
|
|
</tr>
|
348 |
|
|
<?php
|
349 |
|
|
$counter += 1;
|
350 |
|
|
}
|
351 |
|
|
?>
|
352 |
d29303c5
|
Colin Fleming
|
<tr style="display:none"><td></td></tr>
|
353 |
8c4ee062
|
Darren Embry
|
</tbody>
|
354 |
|
|
</table>
|
355 |
|
|
<script type="text/javascript">
|
356 |
d29303c5
|
Colin Fleming
|
//<![CDATA[
|
357 |
8c4ee062
|
Darren Embry
|
field_counter_js = 2;
|
358 |
|
|
totalrows = <?= $counter ?>;
|
359 |
d29303c5
|
Colin Fleming
|
//]]>
|
360 |
8c4ee062
|
Darren Embry
|
</script>
|
361 |
|
|
<div id="addrowbutton">
|
362 |
|
|
<a onclick="javascript:addRowTo('maintable'); add_alias_control(); return false;" href="#"><!--
|
363 |
|
|
--><img border="0" src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="" title="<?=gettext("add another entry"); ?>" /></a>
|
364 |
|
|
</div>
|
365 |
|
|
</td>
|
366 |
|
|
</tr>
|
367 |
e1968b0d
|
Renato Botelho
|
|
368 |
61071c30
|
bcyrill
|
<tr>
|
369 |
|
|
<td colspan="2" class="list" height="12"> </td>
|
370 |
|
|
</tr>
|
371 |
e1968b0d
|
Renato Botelho
|
|
372 |
4e0fc44f
|
Darren Embry
|
<tr>
|
373 |
|
|
<td colspan="2" valign="top" class="listtopic">DNS</td>
|
374 |
|
|
</tr>
|
375 |
|
|
|
376 |
|
|
<tr>
|
377 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("DNS servers");?></td>
|
378 |
|
|
<td width="78%" class="vtable">
|
379 |
d29303c5
|
Colin Fleming
|
<input name="radns1" type="text" class="formfld unknown" id="radns1" size="28" value="<?=htmlspecialchars($pconfig['radns1']);?>" /><br />
|
380 |
|
|
<input name="radns2" type="text" class="formfld unknown" id="radns2" size="28" value="<?=htmlspecialchars($pconfig['radns2']);?>" /><br />
|
381 |
6190312f
|
Phil Davis
|
<input name="radns3" type="text" class="formfld unknown" id="radns3" size="28" value="<?=htmlspecialchars($pconfig['radns3']);?>" /><br />
|
382 |
|
|
<input name="radns4" type="text" class="formfld unknown" id="radns4" size="28" value="<?=htmlspecialchars($pconfig['radns4']);?>" /><br />
|
383 |
4e0fc44f
|
Darren Embry
|
<?=gettext("NOTE: leave blank to use the system default DNS servers - this interface's IP if DNS forwarder is enabled, otherwise the servers configured on the General page.");?>
|
384 |
|
|
</td>
|
385 |
|
|
</tr>
|
386 |
|
|
|
387 |
|
|
<tr>
|
388 |
|
|
<td width="22%" valign="top" class="vncell"><?=gettext("Domain search list");?></td>
|
389 |
|
|
<td width="78%" class="vtable">
|
390 |
d29303c5
|
Colin Fleming
|
<input name="radomainsearchlist" type="text" class="formfld unknown" id="radomainsearchlist" size="28" value="<?=htmlspecialchars($pconfig['radomainsearchlist']);?>" /><br />
|
391 |
5aa68a55
|
Renato Botelho
|
<?=gettext("The RA server can optionally provide a domain search list. Use the semicolon character as separator");?>
|
392 |
4e0fc44f
|
Darren Embry
|
</td>
|
393 |
|
|
</tr>
|
394 |
|
|
|
395 |
|
|
<tr>
|
396 |
|
|
<td width="22%" valign="top" class="vncell"> </td>
|
397 |
|
|
<td width="78%" class="vtable">
|
398 |
|
|
<input id="rasamednsasdhcp6" name="rasamednsasdhcp6" type="checkbox" value="yes" <?php if ($pconfig['rasamednsasdhcp6']) { echo "checked='checked'"; } ?> />
|
399 |
|
|
<strong><?= gettext("Use same settings as DHCPv6 server"); ?></strong>
|
400 |
|
|
</td>
|
401 |
|
|
</tr>
|
402 |
|
|
|
403 |
5ef4a9e1
|
Darren Embry
|
<tr>
|
404 |
|
|
<td width="22%" valign="top"> </td>
|
405 |
|
|
<td width="78%">
|
406 |
f3475477
|
Darren Embry
|
<input name="if" type="hidden" value="<?=$if;?>" />
|
407 |
|
|
<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
|
408 |
5ef4a9e1
|
Darren Embry
|
</td>
|
409 |
|
|
</tr>
|
410 |
|
|
</table>
|
411 |
|
|
</div>
|
412 |
|
|
</td>
|
413 |
|
|
</tr>
|
414 |
|
|
</table>
|
415 |
|
|
</form>
|
416 |
8c4ee062
|
Darren Embry
|
|
417 |
91f026b0
|
ayvis
|
<script type="text/javascript">
|
418 |
8c4ee062
|
Darren Embry
|
//<![CDATA[
|
419 |
4e0fc44f
|
Darren Embry
|
jQuery(function ($) {
|
420 |
|
|
var $rasamednsasdhcp6 = $("#rasamednsasdhcp6");
|
421 |
6190312f
|
Phil Davis
|
var $triggered_checkboxes = $("#radns1, #radns2, #radns3, #radns4, #radomainsearchlist");
|
422 |
4e0fc44f
|
Darren Embry
|
if ($rasamednsasdhcp6.length !== 1) { return; }
|
423 |
|
|
var onchange = function () {
|
424 |
|
|
var checked = $rasamednsasdhcp6.is(":checked");
|
425 |
|
|
if (checked) {
|
426 |
|
|
$triggered_checkboxes.each(function () { this.disabled = true; });
|
427 |
|
|
} else {
|
428 |
|
|
$triggered_checkboxes.each(function () { this.disabled = false; });
|
429 |
|
|
}
|
430 |
|
|
};
|
431 |
|
|
$rasamednsasdhcp6.bind("change", onchange);
|
432 |
|
|
onchange();
|
433 |
|
|
});
|
434 |
8c4ee062
|
Darren Embry
|
|
435 |
|
|
var addressarray = <?= json_encode(get_alias_list("host", "network", "openvpn", "urltable")); ?>;
|
436 |
|
|
var objAlias = [];
|
437 |
|
|
function createAutoSuggest () {
|
438 |
|
|
<?php for ($i = 0; $i < $counter; $i += 1) { ?>
|
439 |
|
|
objAlias.push(new AutoSuggestControl(document.getElementById('subnet_address<?= $i ?>'), new StateSuggestions(addressarray)));
|
440 |
|
|
<?php } ?>
|
441 |
|
|
new AutoSuggestControl(document.getElementById('radns1'), new StateSuggestions(addressarray));
|
442 |
|
|
new AutoSuggestControl(document.getElementById('radns2'), new StateSuggestions(addressarray));
|
443 |
6190312f
|
Phil Davis
|
new AutoSuggestControl(document.getElementById('radns3'), new StateSuggestions(addressarray));
|
444 |
|
|
new AutoSuggestControl(document.getElementById('radns4'), new StateSuggestions(addressarray));
|
445 |
8c4ee062
|
Darren Embry
|
}
|
446 |
|
|
setTimeout(createAutoSuggest, 500);
|
447 |
|
|
//]]>
|
448 |
4e0fc44f
|
Darren Embry
|
</script>
|
449 |
8c4ee062
|
Darren Embry
|
|
450 |
5ef4a9e1
|
Darren Embry
|
<?php include("fend.inc"); ?>
|
451 |
|
|
</body>
|
452 |
|
|
</html>
|