mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-16 01:24:38 +00:00
interfaces, add "IPv6 Static over parent v4 PPPoE link" for https://github.com/opnsense/core/pull/2017 ditching some side affects from get_real_interface() in the process.
This commit is contained in:
parent
9eac980047
commit
f722081b87
@ -680,9 +680,9 @@ function return_gateways_array($disabled = false, $localhost = false, $inactive
|
||||
|
||||
/* special treatment for tunnel interfaces */
|
||||
if ($gateway['ipprotocol'] == "inet6") {
|
||||
$gateway['interface'] = get_real_interface($gateway['interface'], "inet6", false, false);
|
||||
$gateway['interface'] = get_real_interface($gateway['interface'], "inet6", false);
|
||||
} else {
|
||||
$gateway['interface'] = get_real_interface($gateway['interface'], "all", false, false);
|
||||
$gateway['interface'] = get_real_interface($gateway['interface'], "all", false);
|
||||
}
|
||||
|
||||
/* entry has a default flag, use it */
|
||||
|
||||
@ -1116,19 +1116,29 @@ function interface_bring_down($interface = "wan", $ifacecfg = false)
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* NOTE: The $realifv6 is needed when WANv4 is type PPP and v6 is DHCP and the option v6 from v4 is used.
|
||||
* In this case the real $realif of v4 is different from that of v6 for operation.
|
||||
* Keep this in mind while doing changes here!
|
||||
*/
|
||||
$realif = get_real_interface($interface);
|
||||
$realifv6 = get_real_interface($interface, "inet6");
|
||||
if (!in_array($interface, array('openvpn', 'ppp', 'ipsec', 'enc0'))) {
|
||||
/**
|
||||
* NOTE: The $realifv6 is needed when WANv4 is type PPP and v6 is DHCP and the option v6 from v4 is used.
|
||||
* XXX: we kept this in place due to dropping the $realv6iface parameter from get_real_interface(),
|
||||
*/
|
||||
$cfg = &config_read_array('interfaces', $interface);
|
||||
$ipaddrv6 = empty($cfg['ipaddrv6']) ? null : $cfg['ipaddrv6'];
|
||||
if (!in_array($ipaddrv6, array('6rd', '6to4', 'pppoe', 'ppp', 'l2tp', 'pptp'))) {
|
||||
$ipaddr = empty($cfg['ipaddr']) ? null : $cfg['ipaddr'];
|
||||
if (in_array($ipaddr, array('pppoe', 'ppp', 'l2tp', 'pptp'))) {
|
||||
$parents = get_parent_interface($interface);
|
||||
$realifv6 = !empty($parents[0]) ? $parents[0] : $cfg['if'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($ifacecfg === false) {
|
||||
$ifcfg = $config['interfaces'][$interface];
|
||||
$ppps = array();
|
||||
if (isset($config['ppps']['ppp'])) {
|
||||
$ppps = $config['ppps']['ppp'];
|
||||
}
|
||||
$realif = get_real_interface($interface);
|
||||
$realifv6 = get_real_interface($interface, "inet6", true);
|
||||
} elseif (!is_array($ifacecfg)) {
|
||||
log_error('Wrong parameters used during interface_bring_down()');
|
||||
$ifcfg = $config['interfaces'][$interface];
|
||||
@ -1136,8 +1146,6 @@ function interface_bring_down($interface = "wan", $ifacecfg = false)
|
||||
if (isset($config['ppps']['ppp'])) {
|
||||
$ppps = $config['ppps']['ppp'];
|
||||
}
|
||||
$realif = get_real_interface($interface);
|
||||
$realifv6 = get_real_interface($interface, "inet6", true);
|
||||
} else {
|
||||
$ifcfg = $ifacecfg['ifcfg'];
|
||||
$ppps = $ifacecfg['ppps'];
|
||||
@ -1145,9 +1153,6 @@ function interface_bring_down($interface = "wan", $ifacecfg = false)
|
||||
$realif = $ifacecfg['ifcfg']['realif'];
|
||||
/* XXX: Any better way? */
|
||||
$realifv6 = $realif;
|
||||
} else {
|
||||
$realif = get_real_interface($interface);
|
||||
$realifv6 = get_real_interface($interface, "inet6", true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3872,7 +3877,7 @@ function interface_get_wireless_clone($wlif)
|
||||
}
|
||||
}
|
||||
|
||||
function get_real_interface($interface = "wan", $family = "all", $realv6iface = false, $flush = true)
|
||||
function get_real_interface($interface = "wan", $family = "all", $flush = true)
|
||||
{
|
||||
global $config;
|
||||
|
||||
@ -3926,7 +3931,7 @@ function get_real_interface($interface = "wan", $family = "all", $realv6iface =
|
||||
case 'ppp':
|
||||
case 'l2tp':
|
||||
case 'pptp':
|
||||
if (isset($cfg['dhcp6usev4iface']) && $realv6iface === false) {
|
||||
if (isset($cfg['dhcp6usev4iface'])) {
|
||||
$wanif = $cfg['if'];
|
||||
} else {
|
||||
$parents = get_parent_interface($interface);
|
||||
|
||||
@ -363,6 +363,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
$pconfig['dhcp6sendsolicit'] = isset($a_interfaces[$if]['dhcp6sendsolicit']);
|
||||
$pconfig['dhcp6prefixonly'] = isset($a_interfaces[$if]['dhcp6prefixonly']);
|
||||
$pconfig['dhcp6usev4iface'] = isset($a_interfaces[$if]['dhcp6usev4iface']);
|
||||
// Due to the settings being split per interface type, we need to copy the settings that use the same
|
||||
// config directive.
|
||||
$pconfig['staticv6usev4iface'] = $pconfig['dhcp6usev4iface'];
|
||||
$pconfig['adv_dhcp6_debug'] = isset($a_interfaces[$if]['adv_dhcp6_debug']);
|
||||
$pconfig['track6-prefix-id--hex'] = sprintf("%x", empty($pconfig['track6-prefix-id']) ? 0 :$pconfig['track6-prefix-id']);
|
||||
|
||||
@ -1049,6 +1052,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
||||
// switch ipv6 config by type
|
||||
switch($pconfig['type6']) {
|
||||
case "staticv6":
|
||||
if (!empty($pconfig['staticv6usev4iface'])) {
|
||||
$new_config['dhcp6usev4iface'] = true;
|
||||
}
|
||||
$new_config['ipaddrv6'] = $pconfig['ipaddrv6'];
|
||||
$new_config['subnetv6'] = $pconfig['subnetv6'];
|
||||
if ($pconfig['gatewayv6'] != "none") {
|
||||
@ -2358,6 +2364,17 @@ include("head.inc");
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a id="help_for_staticv6usev4iface" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Static IPv6 over V4 PPPoE"); ?></td>
|
||||
<td>
|
||||
<input name="staticv6usev4iface" type="checkbox" id="staticv6usev4iface" value="yes" <?=!empty($pconfig['staticv6usev4iface']) ? "checked=\"checked\"" : ""; ?> />
|
||||
<div class="hidden" for="help_for_staticv6usev4iface">
|
||||
<?=gettext("When set, this option allows the setting of an IPv6 static assignment " .
|
||||
"but passes that over the PPPoE link negotiated by the V4 link. " .
|
||||
"This is allows the gateway to correctly route the gateway monitor pings .");?>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><a id="help_for_gatewayv6" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("IPv6 Upstream Gateway"); ?></td>
|
||||
<td>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user