interfaces: register em1_stf instead of wan_stf

Discussed with: @adschellevis
This commit is contained in:
Franco Fichtner 2018-08-13 00:35:01 +02:00
parent 207ed37fac
commit adf314a4ab
2 changed files with 15 additions and 14 deletions

View File

@ -1068,7 +1068,7 @@ function interface_bring_down($interface = "wan", $ifacecfg = false)
break;
case "6rd":
case "6to4":
$realif = "{$interface}_stf";
$realif = "{$realif}_stf";
if (does_interface_exist("$realif")) {
$ip6 = get_interface_ipv6($interface);
if (is_ipaddrv6($ip6)) {
@ -2718,7 +2718,7 @@ function interface_6rd_configure($interface = 'wan', $wancfg)
$rd6brgw = "{$rd6prefix}{$wancfg['gateway-6rd']}";
$stfiface = "{$interface}_stf";
$stfiface = "{$wanif}_stf";
if (does_interface_exist($stfiface)) {
legacy_interface_destroy($stfiface);
}
@ -2812,7 +2812,7 @@ function interface_6to4_configure($interface = 'wan', $wancfg)
$stflanarr[7] = 1;
$stflan = Net_IPv6::compress(implode(":", $stflanarr));
$stfiface = "{$interface}_stf";
$stfiface = "{$wanif}_stf";
if (does_interface_exist($stfiface)) {
legacy_interface_destroy($stfiface);
}
@ -3667,9 +3667,9 @@ function get_real_interface($interface = 'wan', $family = 'all')
$ipaddrv6 = "";
}
switch ($ipaddrv6) {
case "6rd":
case "6to4":
$wanif = "{$interface}_stf";
case '6rd':
case '6to4':
$wanif = "{$cfg['if']}_stf";
break;
case 'pppoe':
case 'ppp':

View File

@ -80,16 +80,17 @@ class Plugin
$this->interfaceMapping = array_merge($this->interfaceMapping, $mapping);
// generate virtual IPv6 interfaces
foreach ($this->interfaceMapping as $key => &$intf) {
if (!empty($intf['ipaddrv6']) && ($intf['ipaddrv6'] == '6rd' || $intf['ipaddrv6'] == '6to4')) {
if (!empty($intf['ipaddrv6']) && ($intf['ipaddrv6'] == '6rd' || $intf['ipaddrv6'] == '6to4')) {
$realif = "{$intf['if']}_stf";
// create new interface
$this->interfaceMapping[$key . '_stf'] = array();
$this->interfaceMapping[$key . '_stf']['if'] = $key . '_stf'; // TODO: rename to technical name
$this->interfaceMapping[$key . '_stf']['ifconfig']['ipv6'] = $intf['ifconfig']['ipv6'];
$this->interfaceMapping[$key . '_stf']['gatewayv6'] = $intf['gatewayv6'];
$this->interfaceMapping[$key . '_stf']['descr'] = $intf['descr'];
$this->interfaceMapping[$key . '_stf']['is_IPv6_override'] = true;
$this->interfaceMapping[$realif] = array();
$this->interfaceMapping[$realif]['ifconfig']['ipv6'] = $intf['ifconfig']['ipv6'];
$this->interfaceMapping[$realif]['gatewayv6'] = $intf['gatewayv6'];
$this->interfaceMapping[$realif]['is_IPv6_override'] = true;
$this->interfaceMapping[$realif]['descr'] = $intf['descr'];
$this->interfaceMapping[$realif]['if'] = $realif;
// link original interface
$intf['IPv6_override'] = $key . '_stf';
$intf['IPv6_override'] = $realif;
}
}
}