System: gateways, make tunnel type interfaces less attractive for gateway selection by default

This commit is contained in:
Ad Schellevis 2019-07-12 15:58:19 +02:00
parent e42f8ba01c
commit a9786a6be0

View File

@ -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) {