From a9786a6be03620ea235ddf0ad36eb3cf71b00fec Mon Sep 17 00:00:00 2001 From: Ad Schellevis Date: Fri, 12 Jul 2019 15:58:19 +0200 Subject: [PATCH] System: gateways, make tunnel type interfaces less attractive for gateway selection by default --- .../mvc/app/library/OPNsense/Routing/Gateways.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/opnsense/mvc/app/library/OPNsense/Routing/Gateways.php b/src/opnsense/mvc/app/library/OPNsense/Routing/Gateways.php index 9bd375c54..8b010200f 100644 --- a/src/opnsense/mvc/app/library/OPNsense/Routing/Gateways.php +++ b/src/opnsense/mvc/app/library/OPNsense/Routing/Gateways.php @@ -198,7 +198,6 @@ class Gateways $ctype = $ctype != null ? $ctype : "GW"; // default configuration, when not set in gateway_item $thisconf = [ - "priority" => 255, "interface" => $ifname, "weight" => 1, "ipprotocol" => $ipproto, @@ -208,6 +207,13 @@ class Gateways "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) {