Commit 66832ca1 authored by Franco Fichtner's avatar Franco Fichtner

services: untangle dhcpv6 server and router advertisements a bit

(cherry picked from commit 41430381)
(cherry picked from commit 5937d16c)
parent b6adc208
......@@ -205,10 +205,12 @@
<LogFile VisibleName="Log File" order="400" url="/diag_logs_dhcp.php"/>
</DHCP>
<DHCPv6 cssClass="fa fa-bullseye fa-fw">
<Server order="100" url="/services_dhcpv6.php">
<Advertisements order="100" url="/services_router_advertisements.php">
<Interface url="/services_router_advertisements.php?*" visibility="hidden"/>
</Advertisements>
<Server order="200" url="/services_dhcpv6.php">
<Interface url="/services_dhcpv6.php?*" visibility="hidden"/>
<Edit url="/services_dhcpv6_edit.php?*" visibility="hidden"/>
<RA url="/services_router_advertisements.php?*" visibility="hidden"/>
</Server>
<Relay order="300" url="/services_dhcpv6_relay.php"/>
<Leases order="400" url="/status_dhcpv6_leases.php">
......
......@@ -348,6 +348,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$service_hook = 'dhcpd';
legacy_html_escape_form_data($pconfig);
include("head.inc");
?>
<body>
......@@ -442,29 +443,21 @@ include("head.inc");
<section class="col-xs-12">
<?php
/* active tabs */
$tab_array_main = array();
$tab_array = array();
foreach ($config['interfaces'] as $if_id => $intf) {
if (isset($intf['enable']) && isset($intf['ipaddrv6']) && is_ipaddrv6($intf['ipaddrv6'])) {
$ifname = !empty($intf['descr']) ? htmlspecialchars($intf['descr']) : strtoupper($if_id);
if ($if_id == $if) {
$tab_array_main[] = array($ifname, true, "services_dhcpv6.php?if={$if_id}");
} else {
$tab_array_main[] = array($ifname, false, "services_dhcpv6.php?if={$if_id}");
}
$tab_array[] = array($ifname, $if_id == $if, "services_dhcpv6.php?if={$if_id}");
}
}
$tab_array = array();
$tab_array[] = array(gettext("DHCPv6 Server"), true, "services_dhcpv6.php?if={$if}");
$tab_array[] = array(gettext("Router Advertisements"), false, "services_router_advertisements.php?if={$if}");
display_top_tabs($tab_array_main);
display_top_tabs($tab_array);
?>
<div class="tab-content content-box col-xs-12">
<form method="post" name="iform" id="iform">
<?php if (!empty($config['dhcrelay6']['enabled'])): ?>
<?php print_content_box(gettext('DHCP Relay is currently enabled. Cannot enable the DHCP Server service while the DHCP Relay is enabled on any interface.')); ?>
<?php elseif (count($tab_array_main) == 0):?>
<?php elseif (count($tab_array) == 0):?>
<?php print_content_box(gettext('No interfaces found with a static IPv6 address.')); ?>
<?php else: ?>
<div class="table-responsive">
......@@ -773,18 +766,6 @@ include("head.inc");
<input name="submit" type="submit" class="formbtn btn btn-primary" value="<?=gettext("Save");?>"/>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td> <p><span class="vexpl"><span class="text-danger"><strong><?=gettext("Note:");?><br />
</strong></span><?=gettext("The DNS servers entered in"); ?> <a href="system_general.php"><?=gettext("System: " .
"General setup"); ?></a> <?=gettext("(or the"); ?> <a href="services_dnsmasq.php"><?=gettext("DNS " .
"forwarder"); ?></a>, <?=gettext("if enabled)"); ?> </span><span class="vexpl"><?=gettext("will " .
"be assigned to clients by the DHCP server."); ?><br />
<?=gettext("The DHCP lease table can be viewed on the"); ?> <a href="status_dhcpv6_leases.php"><?=gettext("Status: " .
"DHCPv6 leases"); ?></a> <?=gettext("page."); ?><br />
</span></p>
</td>
</tr>
</table>
</div>
</form>
......
......@@ -36,8 +36,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if (!empty($_GET['if']) && !empty($config['interfaces'][$_GET['if']])) {
$if = $_GET['if'];
} else {
$savemsg = "<p><b>" . gettext("The DHCPv6 Server can only be enabled on interfaces configured with static IP addresses") . ".</b></p>" .
"<p><b>" . gettext("Only interfaces configured with a static IP will be shown") . ".</b></p>";
$savemsg = gettext(
'Router Advertisements can only be enabled on interfaces configured with static ' .
'IP addresses. Only interfaces configured with a static IP will be shown.'
);
foreach ($config['interfaces'] as $if_id => $intf) {
if (!empty($intf['enable']) && is_ipaddrv6($intf['ipaddrv6']) && !is_linklocal($oc['ipaddrv6'])) {
$if = $if_id;
......@@ -154,6 +156,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
}
$service_hook = 'radvd';
legacy_html_escape_form_data($pconfig);
include("head.inc");
......@@ -197,27 +200,19 @@ include("head.inc");
<section class="col-xs-12">
<?php
/* active tabs */
$tab_array_main = array();
$tab_array = array();
foreach ($config['interfaces'] as $if_id => $intf) {
if (!empty($intf['enable']) && is_ipaddrv6($intf['ipaddrv6'])) {
$ifname = !empty($intf['descr']) ? htmlspecialchars($intf['descr']) : strtoupper($if_id);
if ($if_id == $if) {
$tab_array_main[] = array($ifname, true, "services_dhcpv6.php?if={$if_id}");
} else {
$tab_array_main[] = array($ifname, false, "services_dhcpv6.php?if={$if_id}");
}
$tab_array[] = array($ifname, $if_id == $if, "services_router_advertisements.php?if={$if_id}");
}
}
$tab_array = array();
$tab_array[] = array(gettext("DHCPv6 Server"), false, "services_dhcpv6.php?if={$if}");
$tab_array[] = array(gettext("Router Advertisements"), true, "services_router_advertisements.php?if={$if}");
display_top_tabs($tab_array_main);
display_top_tabs($tab_array);
?>
<div class="tab-content content-box col-xs-12">
<form method="post" name="iform" id="iform">
<?php if (count($tab_array_main) == 0):?>
<?php if (count($tab_array) == 0):?>
<?php print_content_box(gettext('No interfaces found with a static IPv6 address.')); ?>
<?php else: ?>
<div class="table-responsive">
......@@ -367,6 +362,9 @@ include("head.inc");
<div class="hidden" for="help_for_radns">
<?=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.");?>
</div>
<br />
<input id="rasamednsasdhcp6" name="rasamednsasdhcp6" type="checkbox" value="yes" <?=!empty($pconfig['rasamednsasdhcp6']) ? "checked='checked'" : "";?> />
<strong><?= gettext("Use the DNS settings of the DHCPv6 server"); ?></strong>
</td>
</tr>
<tr>
......@@ -405,13 +403,6 @@ include("head.inc");
</div>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
<input id="rasamednsasdhcp6" name="rasamednsasdhcp6" type="checkbox" value="yes" <?=!empty($pconfig['rasamednsasdhcp6']) ? "checked='checked'" : "";?> />
<strong><?= gettext("Use same settings as DHCPv6 server"); ?></strong>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment