fix(reliability): explicit hop baseline restore, immune to stale pager snapshot
This commit is contained in:
@@ -4797,14 +4797,18 @@ def health_check():
|
||||
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).
|
||||
# the pause intentionally. Deliberately bypasses _resume_hop(): its
|
||||
# pager-snapshot may carry a stale hop=0 captured while the old boot
|
||||
# guard forced the value, which would silently keep 5 GHz pinned.
|
||||
# Baseline policy: idle system => wlan1mon hops.
|
||||
if not _HOP_PAUSE_HELD:
|
||||
try:
|
||||
before = _read_hop()
|
||||
if before == '0':
|
||||
if before != '1':
|
||||
import mk8_events
|
||||
_resume_hop()
|
||||
device_run(['uci', 'set', 'pineapd.wlan1mon.hop=1'])
|
||||
device_run(['uci', 'commit', 'pineapd'])
|
||||
device_run(['/etc/init.d/pineapd', 'reload'], timeout=30)
|
||||
mk8_events.log_event(
|
||||
'guard_fix',
|
||||
msg='restored wlan1mon.hop baseline (was %s)' % before)
|
||||
|
||||
@@ -282,10 +282,11 @@ class HopBaselineTest(unittest.TestCase):
|
||||
return_value=[]), \
|
||||
mock.patch('mk8_guard.reconcile',
|
||||
return_value={'changed': [], 'pool_cleared': False,
|
||||
'monitors_raised': []}), \
|
||||
mock.patch.object(server, '_resume_hop') as resume:
|
||||
'monitors_raised': []}):
|
||||
server.health_check()
|
||||
resume.assert_called_once()
|
||||
sets = [r for r in self.runs
|
||||
if r[:3] == ['uci', 'set', 'pineapd.wlan1mon.hop=1']]
|
||||
self.assertEqual(len(sets), 1)
|
||||
finally:
|
||||
server._HOP_PAUSE_HELD = old_held
|
||||
|
||||
@@ -300,9 +301,10 @@ class HopBaselineTest(unittest.TestCase):
|
||||
return_value=[]), \
|
||||
mock.patch('mk8_guard.reconcile',
|
||||
return_value={'changed': [], 'pool_cleared': False,
|
||||
'monitors_raised': []}), \
|
||||
mock.patch.object(server, '_resume_hop') as resume:
|
||||
'monitors_raised': []}):
|
||||
server.health_check()
|
||||
resume.assert_not_called()
|
||||
sets = [r for r in self.runs
|
||||
if r[:3] == ['uci', 'set', 'pineapd.wlan1mon.hop=1']]
|
||||
self.assertEqual(len(sets), 0)
|
||||
finally:
|
||||
server._HOP_PAUSE_HELD = old_held
|
||||
|
||||
Reference in New Issue
Block a user