fix(reliability): supervisor restores hop baseline unless a role holds the pause
This commit is contained in:
@@ -3445,11 +3445,16 @@ def _read_hop():
|
||||
return out.strip()
|
||||
|
||||
|
||||
_HOP_PAUSE_HELD = False # True while a Mark VIII role/attack holds hop off
|
||||
|
||||
|
||||
def _pause_hop():
|
||||
global _HOP_PAUSE_HELD
|
||||
if _read_hop() != '0':
|
||||
device_run(['uci', 'set', 'pineapd.wlan1mon.hop=0'])
|
||||
device_run(['uci', 'commit', 'pineapd'])
|
||||
device_run(['/etc/init.d/pineapd', 'reload'])
|
||||
_HOP_PAUSE_HELD = True
|
||||
|
||||
|
||||
def _resume_hop():
|
||||
@@ -3468,6 +3473,8 @@ def _resume_hop():
|
||||
device_run(['uci', 'set', 'pineapd.wlan1mon.hop=%s' % wanted])
|
||||
device_run(['uci', 'commit', 'pineapd'])
|
||||
device_run(['/etc/init.d/pineapd', 'reload'])
|
||||
global _HOP_PAUSE_HELD
|
||||
_HOP_PAUSE_HELD = False
|
||||
|
||||
|
||||
def _remove_radio1_ap():
|
||||
@@ -4789,6 +4796,20 @@ def health_check():
|
||||
msg='reconciler re-applied: %s' % ','.join(rep['changed']))
|
||||
except Exception:
|
||||
pass
|
||||
# Restore the hopping baseline unless a Mark VIII role/attack holds
|
||||
# the pause intentionally (_resume_hop self-guards against fighting a
|
||||
# live Pager hop enable).
|
||||
if not _HOP_PAUSE_HELD:
|
||||
try:
|
||||
before = _read_hop()
|
||||
if before == '0':
|
||||
import mk8_events
|
||||
_resume_hop()
|
||||
mk8_events.log_event(
|
||||
'guard_fix',
|
||||
msg='restored wlan1mon.hop baseline (was %s)' % before)
|
||||
except Exception:
|
||||
pass
|
||||
h['mem_percent'] = _mem_percent()
|
||||
if h['mem_percent'] >= MEM_WARN_PERCENT:
|
||||
h['mem_streak'] = h.get('mem_streak', 0) + 1
|
||||
|
||||
Reference in New Issue
Block a user