Skip to content

Commit

Permalink
Merge pull request #1273 from firewalla/master
Browse files Browse the repository at this point in the history
  • Loading branch information
MelvinTo authored May 31, 2024
2 parents dc1100c + a6f8a1f commit 21a531d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Binary file modified platform/gold/bin/firereset
Binary file not shown.
1 change: 1 addition & 0 deletions platform/gold/platform.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
NETWORK_SETUP=yes
BLUETOOTH_TIMEOUT=3600

function run_horse_light {
flash_interval=${1:-2}
Expand Down
12 changes: 6 additions & 6 deletions plugins/routing/routing_plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ class RoutingPlugin extends Plugin {
await routing.addRouteToTable(dnsIP, gw, intf, routing.RT_GLOBAL_DEFAULT, metric, 4).catch((err) => {
this.log.warn(`fail to add route -4 ${dnsIP} via ${gw} dev ${intf} table ${routing.RT_GLOBAL_DEFAULT}, err:`, err.message)});
await routing.addRouteToTable(dnsIP, gw, intf, "main", metric, 4).then(() => {
this._updateDnsRouteCache(dnsIP, gw, viaIntf, metric, "main");
this._updateDnsRouteCache(dnsIP, gw, intf, metric, "main");
}).catch((err) => {
this.log.warn(`fail to add route -4 ${dnsIP} via ${gw} dev ${intf} table main, err:`, err.message)});
}
Expand Down Expand Up @@ -417,7 +417,8 @@ class RoutingPlugin extends Plugin {
// async context and apply/flush context should be mutually exclusive, so they acquire the same LOCK_SHARED
await lock.acquire(inAsyncContext ? LOCK_SHARED : LOCK_APPLY_ACTIVE_WAN, async () => {
// flush global default routing table, no need to touch global static routing table here
if (this.pluginConfig && this.pluginConfig.smooth_failover) {
const type = this.networkConfig.default.type || "single";
if (type === 'primary_standby' && this.pluginConfig && this.pluginConfig.smooth_failover) {
const deadWANIntfs = this.getUnreadyWANPlugins();
await this._removeDeviceRouting(deadWANIntfs, routing.RT_GLOBAL_DEFAULT, af);
await this._removeDeviceRouting(deadWANIntfs, routing.RT_GLOBAL_LOCAL, af);
Expand All @@ -428,11 +429,10 @@ class RoutingPlugin extends Plugin {
await routing.flushRoutingTable(routing.RT_GLOBAL_LOCAL, af);
}

if (!this.pluginConfig || !this.pluginConfig.smooth_failover) {
if (type !== 'primary_standby' || !this.pluginConfig || !this.pluginConfig.smooth_failover) {
await this._removeMainRoutes(af);
}

const type = this.networkConfig.default.type || "single";
switch (type) {
case "single":
case "primary_standby": {
Expand Down Expand Up @@ -966,9 +966,9 @@ class RoutingPlugin extends Plugin {
const intfPlugin = this._wanStatus[intf] && this._wanStatus[intf].plugin
const type = (this.networkConfig && this.networkConfig.default && this.networkConfig.default.type) || "single";

if (this.pluginConfig && this.pluginConfig.smooth_failover) {
if (type === 'primary_standby' && this.pluginConfig && this.pluginConfig.smooth_failover) {
// update global default routes related to the interface
if (intfPlugin && type == 'primary_standby' && this.name == 'global') {
if (intfPlugin && this.name == 'global') {
this.refreshGlobalIntfRoutes(intf, 4);
break;
}
Expand Down

0 comments on commit 21a531d

Please sign in to comment.