Skip to content

Commit

Permalink
Merge pull request #1208 from jasonlyc/bug_fix
Browse files Browse the repository at this point in the history
only need to renew DHCP lease on DHCP wan carrier change
  • Loading branch information
MelvinTo authored Feb 1, 2024
2 parents 00f7a1c + c485405 commit fb7102b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions plugins/interface/intf_base_plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -1301,10 +1301,18 @@ class InterfaceBasePlugin extends Plugin {
this._wanConnState = this._wanConnState || { ready: true, successCount: OFF_ON_THRESHOLD - 1, failureCount: 0 };
this._wanConnState.successCount = OFF_ON_THRESHOLD - 1;
this._wanConnState.failureCount = ON_OFF_THRESHOLD - 1;
// WAN interface plugged, need to reapply WAN interface config
// WAN interface plugged, need to restart dhcp client if applicable
if (this.isDHCP()) {
this.propagateConfigChanged(true);
pl.scheduleReapply();
if (this.networkConfig.dhcp) {
this.flushIP(4).then(() => this.renewDHCPLease()).catch((err) => {
this.log.error(`Failed to renew DHCP lease on interface ${this.name}`, err.message);
});
}
if (this.networkConfig.dhcp6) {
this.flushIP(6).then(() => this.renewDHCP6Lease()).catch((err) => {
this.log.error(`Failed to renew DHCPv6 lease on interface ${this.name}`, err.message);
});
}
}
}
break;
Expand Down

0 comments on commit fb7102b

Please sign in to comment.