diff options
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/filter.inc | 13 | ||||
-rw-r--r-- | etc/inc/gwlb.inc | 26 | ||||
-rw-r--r-- | etc/inc/interfaces.inc | 16 | ||||
-rw-r--r-- | etc/inc/ipsec.inc | 10 |
4 files changed, 16 insertions, 49 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 8eef18e..a40260d 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -2775,17 +2775,8 @@ EOD; } $gwv6 = get_interface_gateway_v6($ifdescr); - switch($ifcfg['type6']) { - case "6rd": - case "6to4": - $stf = "{$ifdescr}_stf"; - $pdlen = 64 - calculate_ipv6_delegation_length($ifdescr); - break; - default: - $stf = $ifcfg['if']; - $pdlen = 64 - calculate_ipv6_delegation_length($ifdescr); - break; - } + $stf = get_real_interface($ifdescr, "inet6"); + $pdlen = 64 - calculate_ipv6_delegation_length($ifdescr); if (is_ipaddrv6($gwv6) && is_ipaddrv6($ifcfg['ipv6'])) { $ipfrules .= "pass out route-to ( {$stf} {$gwv6} ) inet6 from {$ifcfg['ipv6']} to !{$ifcfg['ipv6']}/{$pdlen} keep state allow-opts label \"let out anything from firewall host itself\"\n"; if (is_array($ifcfg['vips6'])) { diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index a8373a8..112d0f6 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -429,20 +429,10 @@ function return_gateways_array($disabled = false, $localhost = false) { $gateway['friendlyiface'] = $gateway['interface']; /* special treatment for tunnel interfaces */ - if($gateway['ipprotocol'] == "inet6") { - switch($wancfg['ipaddrv6']) { - case "6rd": - case "6to4": - $gateway['interface'] = "{$gateway['interface']}_stf"; - break; - default: - $gateway['interface'] = get_real_interface($gateway['interface']); - break; - } - } - if($gateway['ipprotocol'] == "inet") { + if ($gateway['ipprotocol'] == "inet6") + $gateway['interface'] = get_real_interface($gateway['interface'], "inet6"); + else if ($gateway['ipprotocol'] == "inet") $gateway['interface'] = get_real_interface($gateway['interface']); - } /* entry has a default flag, use it */ if (isset($gateway['defaultgw'])) { @@ -584,18 +574,12 @@ function return_gateways_array($disabled = false, $localhost = false) { $gateway['dynamic'] = false; $gateway['ipprotocol'] = "inet6"; $gateway['gateway'] = get_interface_gateway_v6($ifname, $gateway['dynamic']); + $gateway['interface'] = get_real_interface($ifname, "inet6"); switch($ifcfg['ipaddrv6']) { - case "6to4": - $gateway['interface'] = "{$ifname}_stf"; - $gateway['dynamic'] = "default"; - break; case "6rd": - $gateway['interface'] = "{$ifname}_stf"; + case "6to4": $gateway['dynamic'] = "default"; break; - default: - $gateway['interface'] = get_real_interface($ifname); - break; } $gateway['friendlyiface'] = $ifname; $gateway['name'] = "{$friendly}{$ctype}"; diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index d085ac3..0e4e4ae 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -4490,15 +4490,7 @@ function get_interface_ipv6($interface = "wan", $flush = false) { global $config; - $realif = get_failover_interface($interface); - if (is_array($config['interfaces'][$interface])) { - switch($config['interfaces'][$interface]['ipaddrv6']) { - case "6rd": - case "6to4": - $realif = "{$interface}_stf"; - break; - } - } + $realif = get_failover_interface($interface, "inet6"); if (!$realif) { if (preg_match("/^[a-z0-9]+_vip/i", $interface)) $realif = $interface; @@ -4928,11 +4920,11 @@ function interfaces_staticarp_configure($if) { return 0; } -function get_failover_interface($interface) { +function get_failover_interface($interface, $family = "all") { global $config; /* shortcut to get_real_interface if we find it in the config */ if(is_array($config['interfaces'][$interface])) { - $wanif = get_real_interface($interface); + $wanif = get_real_interface($interface, $family); return $wanif; } @@ -4948,7 +4940,7 @@ function get_failover_interface($interface) { return $wanif; } /* fall through to get_real_interface */ - $wanif = get_real_interface($interface); + $wanif = get_real_interface($interface, $family); return $wanif; } diff --git a/etc/inc/ipsec.inc b/etc/inc/ipsec.inc index 2d5c1a7..8b8f1b9 100644 --- a/etc/inc/ipsec.inc +++ b/etc/inc/ipsec.inc @@ -151,10 +151,11 @@ function ipsec_get_phase1_src(& $ph1ent) { if ($ph1ent['interface']) { if (!is_ipaddr($ph1ent['interface'])) { - $if = get_failover_interface($ph1ent['interface']); - if($ph1ent['protocol'] == "inet6") { + if ($ph1ent['protocol'] == "inet6") { + $if = get_failover_interface($ph1ent['interface'], "inet6"); $interfaceip = get_interface_ipv6($if); } else { + $if = get_failover_interface($ph1ent['interface']); $interfaceip = get_interface_ip($if); } } else { @@ -162,11 +163,10 @@ function ipsec_get_phase1_src(& $ph1ent) { } } else { $if = "wan"; - if($ph1ent['protocol'] == "inet6") { + if ($ph1ent['protocol'] == "inet6") $interfaceip = get_interface_ipv6($if); - } else { + else $interfaceip = get_interface_ip($if); - } } return $interfaceip; |