Skip to content

Commit

Permalink
System: gateways, make tunnel type interfaces less attractive for gat…
Browse files Browse the repository at this point in the history
…eway selection by default
  • Loading branch information
AdSchellevis committed Jul 12, 2019
1 parent e42f8ba commit a9786a6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/opnsense/mvc/app/library/OPNsense/Routing/Gateways.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ public function getGateways()
$ctype = $ctype != null ? $ctype : "GW";
// default configuration, when not set in gateway_item
$thisconf = [
"priority" => 255,
"interface" => $ifname,
"weight" => 1,
"ipprotocol" => $ipproto,
Expand All @@ -208,6 +207,13 @@ public function getGateways()
"if" => $ifcfg['if'],
"dynamic" => true,
];
// set default priority
if (strstr($ifcfg['if'], 'gre') || strstr($ifcfg['if'], 'gif') || strstr($ifcfg['if'], 'ovpn')) {
// consider tunnel ttype interfaces least attractive by default
$thisconf['priority'] = 255;
} else {
$thisconf['priority'] = 254;
}
// locate interface gateway settings
if (!empty($dynamic_gw[$ifname])) {
foreach ($dynamic_gw[$ifname] as $gw_arr) {
Expand Down

0 comments on commit a9786a6

Please sign in to comment.