Skip to content

Commit

Permalink
interfaces: pick proper route for stf tunnels
Browse files Browse the repository at this point in the history
  • Loading branch information
fichtner committed Jan 23, 2021
1 parent f1f0c3f commit f4e2728
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/opnsense/mvc/app/library/OPNsense/Routing/Gateways.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ public function getGateways()
foreach (["inet", "inet6"] as $ipproto) {
// filename suffix and interface type as defined in the interface
$descr = !empty($ifcfg['descr']) ? $ifcfg['descr'] : $ifname;
$isuffix = $ipproto == 'inet6' && in_array($ifcfg['ipaddrv6'], ['6to4', '6rd']) ? '_stf' : '';
$fsuffix = $ipproto == "inet6" ? "v6" : "";
$ctype = self::convertType($ipproto, $ifcfg);
$ctype = $ctype != null ? $ctype : "GW";
Expand All @@ -211,7 +212,7 @@ public function getGateways()
"name" => strtoupper("{$descr}_{$ctype}"),
"descr" => "Interface " . strtoupper("{$descr}_{$ctype}") . " Gateway",
"monitor_disable" => true, // disable monitoring by default
"if" => $ifcfg['if'],
"if" => "{$ifcfg['if']}{$isuffix}",
"dynamic" => true,
"virtual" => true
];
Expand All @@ -237,8 +238,8 @@ public function getGateways()
if (!empty($thisconf['virtual']) && in_array($thisconf['name'], $reservednames)) {
// if name is already taken, don't try to add a new (virtual) entry
null;
} elseif (file_exists("/tmp/{$ifcfg['if']}_router" . $fsuffix)) {
$thisconf['gateway'] = trim(@file_get_contents("/tmp/{$ifcfg['if']}_router" . $fsuffix));
} elseif (file_exists("/tmp/{$ifcfg['if']}{$isuffix}_router{$fsuffix}")) {
$thisconf['gateway'] = trim(@file_get_contents("/tmp/{$ifcfg['if']}{$isuffix}_router{$fsuffix}"));
if (empty($thisconf['monitor_disable']) && empty($thisconf['monitor'])) {
$thisconf['monitor'] = $thisconf['gateway'];
}
Expand Down

0 comments on commit f4e2728

Please sign in to comment.