Skip to content

Commit

Permalink
interfaces: register em1_stf instead of wan_stf
Browse files Browse the repository at this point in the history
Discussed with: @AdSchellevis
  • Loading branch information
fichtner committed Aug 12, 2018
1 parent 207ed37 commit adf314a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
12 changes: 6 additions & 6 deletions src/etc/inc/interfaces.inc
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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':
Expand Down
17 changes: 9 additions & 8 deletions src/opnsense/mvc/app/library/OPNsense/Firewall/Plugin.php
Expand Up @@ -80,16 +80,17 @@ public function setInterfaceMapping(&$mapping)
$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;
}
}
}
Expand Down

1 comment on commit adf314a

@AdSchellevis
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fichtner nice, thank you!

Please sign in to comment.