fix(auditor): report range decisions the kernel can't enforce instead of healing
A LAPI range decision (e.g. 195.178.110.0/24) inserted into an nft set without the interval flag is stored as its bare network address. The string diff saw that as one missing and one extra entry, and every heal re-added the same address, so nodes stuck in DESYNC_DETECTED with the flap guard suppressing repeat heals. Pair such ranges with their network address, report them as unenforceable_ranges with a dedicated warning, and keep them out of the drift counts and fingerprint. The reporter records unenforceable_range_count and shows DEGRADED for a node that is otherwise in sync. Desync log lines now name the missing and extra values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
57ed6cfc1c
commit
e76e957282
6 files changed
+175
-4
No files matched your search
+15
-1
@@ -128,12 +128,17 @@ class LocalStateReporter:
|
||||
drift_events_increment=0,
|
||||
heal_result=None,
|
||||
heal_suppressed=False,
|
||||
unenforceable_range_count=0,
|
||||
):
|
||||
"""
|
||||
Writes the current health snapshot to a JSON file.
|
||||
|
||||
heal_suppressed marks a drift the heal gate skipped because the same drift was
|
||||
healed moments ago, so every drift event is either a heal attempt or a suppressed heal.
|
||||
|
||||
unenforceable_range_count is the number of LAPI range decisions the kernel holds
|
||||
only as a single address. They are not drift a heal can fix, so a node that is
|
||||
otherwise in sync reports DEGRADED rather than HEALTHY.
|
||||
"""
|
||||
previous = self._load_previous_state()
|
||||
effective_heal_result = (
|
||||
@@ -193,13 +198,14 @@ class LocalStateReporter:
|
||||
status_data = {
|
||||
"node_name": self.node_name,
|
||||
"last_check": datetime.now(timezone.utc).isoformat(),
|
||||
"status": "HEALTHY" if is_synced else "DESYNC_DETECTED",
|
||||
"status": self._status_label(is_synced, unenforceable_range_count),
|
||||
"is_synced": is_synced,
|
||||
"kernel_ban_count": ban_count,
|
||||
"last_error": last_error,
|
||||
"missing_count": missing_count,
|
||||
"extra_count": extra_count,
|
||||
"metadata_drift_count": metadata_drift_count,
|
||||
"unenforceable_range_count": unenforceable_range_count,
|
||||
"last_drift_fingerprint": last_drift_fingerprint,
|
||||
"last_heal_result": effective_heal_result,
|
||||
"last_heal_timestamp": effective_last_heal_timestamp,
|
||||
@@ -227,6 +233,14 @@ class LocalStateReporter:
|
||||
except Exception as e:
|
||||
logging.error(f"Reporter: Failed to write state file: {e}")
|
||||
|
||||
@staticmethod
|
||||
def _status_label(is_synced, unenforceable_range_count):
|
||||
if not is_synced:
|
||||
return "DESYNC_DETECTED"
|
||||
if unenforceable_range_count:
|
||||
return "DEGRADED"
|
||||
return "HEALTHY"
|
||||
|
||||
def get_history_file(self):
|
||||
base, _ = os.path.splitext(self.state_file)
|
||||
return f"{base}.history"
|
||||
|
||||
Reference in new issue
Block a user