Normalize a requested network identifier to a storage slug.
(identifier: Optional[str])
| 1859 | if v in _NI_CRITICAL: |
| 1860 | return 2 |
| 1861 | return 1 |
| 1862 | |
| 1863 | |
| 1864 | def _net_integrity_check_once(): |
| 1865 | """Run the fast core checks (DNS/ARP/DHCP + RA-Guard posture) plus, when extended |
| 1866 | monitoring is on, the next round-robin batch of the passive Watch scanners. Update |
| 1867 | per-check state and alert on any check that worsens. Returns the overall verdict.""" |
| 1868 | import network_diagnostics as nd |
| 1869 | global _net_integrity_rotation |
| 1870 | cfg = shared_data.config |
| 1871 | |
| 1872 | # Capture interface for the segment-scoped scanners: the configured pin |
| 1873 | # (net_integrity_interface) or auto — a link-up wired port first, so a |
| 1874 | # sensor plugged into a switch but managed over WiFi watches the cable, |
| 1875 | # not wlan0 — falling back to the default-route interface. |
| 1876 | mon_iface = str(cfg.get('net_integrity_interface') or '').strip() or None |
| 1877 | cap_iface = nd._capture_iface(mon_iface) |
| 1878 | |
| 1879 | def watch(fn, **kw): |
| 1880 | try: |
| 1881 | r = fn(**kw) |
no test coverage detected