interfaces: revert futile parts of b34ba9a61f655 #5630

This commit is contained in:
Franco Fichtner 2022-04-27 08:31:36 +02:00
parent 9ff04d14b4
commit 249afc5877
3 changed files with 11 additions and 59 deletions

View File

@ -2890,12 +2890,6 @@ function DHCP6_Config_File_Basic($interface, $wancfg, $wanif, $id = 0)
$preflen = 64 - $wancfg['dhcp6-ia-pd-len'];
$dhcp6cconf .= " prefix ::/{$preflen} infinity;\n";
}
if (isset($wancfg['dhcp6-prefix-id']) && is_numeric($wancfg['dhcp6-prefix-id'])) {
$dhcp6cconf .= " prefix-interface {$wanif} {\n";
$dhcp6cconf .= " sla-id {$wancfg['dhcp6-prefix-id']};\n";
$dhcp6cconf .= " sla-len {$wancfg['dhcp6-ia-pd-len']};\n";
$dhcp6cconf .= " };\n";
}
foreach (link_interface_to_track6($interface) as $friendly => $lancfg) {
if (is_numeric($lancfg['track6-prefix-id'])) {
$trackifv6 = get_real_interface($friendly, 'inet6');
@ -4356,7 +4350,7 @@ function interfaces_primary_address6($interface, $ifconfig_details = null)
empty($interfaces_a[$interface]['adv_dhcp6_config_file_override']) &&
((!empty($interfaces_a[$interface]['adv_dhcp6_config_advanced']) &&
empty($interfaces_a[$interface]['adv_dhcp6_id_assoc_statement_address_enable'])) ||
(isset($interfaces_a[$interface]['dhcp6prefixonly']) && !isset($interfaces_a[$interface]['dhcp6-prefix-id'])))
isset($interfaces_a[$interface]['dhcp6prefixonly']))
) {
/* extend the search scope for a non-NA mode to tracking interfaces */
$interface = array_merge([$interface], array_keys(link_interface_to_track6($interface)));

View File

@ -1,7 +1,7 @@
<?php
/*
* Copyright (C) 2014-2022 Deciso B.V.
* Copyright (C) 2014-2015 Deciso B.V.
* Copyright (C) 2010 Erik Fonnesbeck
* Copyright (C) 2008-2010 Ermal Luçi
* Copyright (C) 2004-2008 Scott Ullrich <sullrich@gmail.com>
@ -366,7 +366,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
'alias-subnet',
'descr',
'dhcp6-ia-pd-len',
'dhcp6-prefix-id',
'dhcp6vlanprio',
'dhcphostname',
'dhcprejectfrom',
@ -408,7 +407,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig['dhcp6prefixonly'] = isset($a_interfaces[$if]['dhcp6prefixonly']);
$pconfig['dhcp6usev4iface'] = isset($a_interfaces[$if]['dhcp6usev4iface']);
$pconfig['track6-prefix-id--hex'] = sprintf("%x", empty($pconfig['track6-prefix-id']) ? 0 : $pconfig['track6-prefix-id']);
$pconfig['dhcp6-prefix-id--hex'] = isset($pconfig['dhcp6-prefix-id']) && $pconfig['dhcp6-prefix-id'] != '' ? sprintf("%x", $pconfig['dhcp6-prefix-id']) : '';
$pconfig['dhcpd6track6allowoverride'] = isset($a_interfaces[$if]['dhcpd6track6allowoverride']);
/*
@ -706,26 +704,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if (!empty($pconfig['adv_dhcp6_config_file_override'] && !file_exists($pconfig['adv_dhcp6_config_file_override_path']))) {
$input_errors[] = sprintf(gettext('The DHCPv6 override file "%s" does not exist.'), $pconfig['adv_dhcp6_config_file_override_path']);
}
if (isset($pconfig['dhcp6-prefix-id--hex']) && $pconfig['dhcp6-prefix-id--hex'] != '') {
if (!ctype_xdigit($pconfig['dhcp6-prefix-id--hex'])) {
$input_errors[] = gettext("You must enter a valid hexadecimal number for the IPv6 prefix ID.");
} else {
$ipv6_delegation_length = calculate_ipv6_delegation_length($if);
if ($ipv6_delegation_length >= 0) {
$ipv6_num_prefix_ids = pow(2, $ipv6_delegation_length);
$dhcp6_prefix_id = intval($pconfig['dhcp6-prefix-id--hex'], 16);
if ($dhcp6_prefix_id < 0 || $dhcp6_prefix_id >= $ipv6_num_prefix_ids) {
$input_errors[] = gettext("You specified an IPv6 prefix ID that is out of range.");
}
}
foreach (link_interface_to_track6($pconfig['track6-interface']) as $trackif => $trackcfg) {
if ($trackcfg['track6-prefix-id'] == $dhcp6_prefix_id) {
$input_errors[] = gettext('You specified an IPv6 prefix ID that is already in use.');
break;
}
}
}
}
break;
case '6rd':
if (empty($pconfig['gateway-6rd']) || !is_ipaddrv4($pconfig['gateway-6rd'])) {
@ -774,11 +752,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
break;
}
}
if (isset($config['interfaces'][$pconfig['track6-interface']]['dhcp6-prefix-id'])) {
if ($config['interfaces'][$pconfig['track6-interface']]['dhcp6-prefix-id'] == $track6_prefix_id) {
$input_errors[] = gettext('You specified an IPv6 prefix ID that is already in use.');
}
}
}
}
break;
@ -1166,9 +1139,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if (isset($pconfig['dhcp6vlanprio']) && $pconfig['dhcp6vlanprio'] !== '') {
$new_config['dhcp6vlanprio'] = $pconfig['dhcp6vlanprio'];
}
if (isset($pconfig['dhcp6-prefix-id--hex']) && ctype_xdigit($pconfig['dhcp6-prefix-id--hex'])) {
$new_config['dhcp6-prefix-id'] = intval($pconfig['dhcp6-prefix-id--hex'], 16);
}
$new_config['adv_dhcp6_interface_statement_send_options'] = $pconfig['adv_dhcp6_interface_statement_send_options'];
$new_config['adv_dhcp6_interface_statement_request_options'] = $pconfig['adv_dhcp6_interface_statement_request_options'];
$new_config['adv_dhcp6_interface_statement_information_only_enable'] = $pconfig['adv_dhcp6_interface_statement_information_only_enable'];
@ -2704,11 +2674,11 @@ include("head.inc");
</td>
</tr>
<tr class="dhcpv6_basic">
<td><a id="help_for_dhcp6-ia-pd-send-hint" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Send IPv6 prefix hint"); ?></td>
<td><a id="help_for_dhcp6prefixonly" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Request only an IPv6 prefix"); ?></td>
<td>
<input name="dhcp6-ia-pd-send-hint" type="checkbox" id="dhcp6-ia-pd-send-hint" value="yes" <?=!empty($pconfig['dhcp6-ia-pd-send-hint']) ? "checked=\"checked\"" : "";?> />
<div class="hidden" data-for="help_for_dhcp6-ia-pd-send-hint">
<?=gettext("Send an IPv6 prefix hint to indicate the desired prefix size for delegation"); ?>
<input name="dhcp6prefixonly" type="checkbox" id="dhcp6prefixonly" value="yes" <?=!empty($pconfig['dhcp6prefixonly']) ? "checked=\"checked\"" : "";?> />
<div class="hidden" data-for="help_for_dhcp6prefixonly">
<?= gettext('Only request an IPv6 prefix; do not request an IPv6 address.') ?>
</div>
</td>
</tr>
@ -2749,23 +2719,11 @@ include("head.inc");
</td>
</tr>
<tr class="dhcpv6_basic">
<td><a id="help_for_dhcp6prefixonly" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Request only an IPv6 prefix"); ?></td>
<td><a id="help_for_dhcp6-ia-pd-send-hint" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Send IPv6 prefix hint"); ?></td>
<td>
<input name="dhcp6prefixonly" type="checkbox" id="dhcp6prefixonly" value="yes" <?=!empty($pconfig['dhcp6prefixonly']) ? "checked=\"checked\"" : "";?> />
<div class="hidden" data-for="help_for_dhcp6prefixonly">
<?= gettext('Only request an IPv6 prefix; do not request an IPv6 address.') ?>
</div>
</td>
</tr>
<tr class="dhcpv6_basic">
<td><a id="help_for_dhcp6-prefix-id" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("IPv6 Prefix ID"); ?></td>
<td>
<div class="input-group" style="max-width:348px">
<div class="input-group-addon">0x</div>
<input name="dhcp6-prefix-id--hex" type="text" class="form-control" id="dhcp6-prefix-id--hex" value="<?= html_safe($pconfig['dhcp6-prefix-id--hex']) ?>" />
</div>
<div class="hidden" data-for="help_for_dhcp6-prefix-id">
<?= gettext('The value in this field is the delegated hexadecimal IPv6 prefix ID. This determines the configurable /64 network ID based on the dynamic IPv6 connection.') ?>
<input name="dhcp6-ia-pd-send-hint" type="checkbox" id="dhcp6-ia-pd-send-hint" value="yes" <?=!empty($pconfig['dhcp6-ia-pd-send-hint']) ? "checked=\"checked\"" : "";?> />
<div class="hidden" data-for="help_for_dhcp6-ia-pd-send-hint">
<?=gettext("Send an IPv6 prefix hint to indicate the desired prefix size for delegation"); ?>
</div>
</td>
</tr>

View File

@ -166,7 +166,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
<td style="width:45%; word-break: break-word;">
<?= htmlspecialchars($ifinfo['ipaddr']) ?>
<?= !empty($ifinfo['ipaddr']) ? '<br/>' : '' ?>
<?= htmlspecialchars(!is_ipaddrv6($ifinfo['ipaddrv6']) ? $ifinfo['linklocal'] : $ifinfo['ipaddrv6']) ?>
<?= htmlspecialchars(isset($config['interfaces'][$ifdescr]['dhcp6prefixonly']) ? $ifinfo['linklocal'] : $ifinfo['ipaddrv6']) ?>
</td>
</tr>
<?php endforeach ?>