Collect values for an nmcli field (e.g. IP4.DOMAINS, IP4.DNS) across all devices. nmcli prints repeated keys as `FIELD[1]:value`.
(field)
| 742 | # single MAC answering for many IPs (one host impersonating the whole subnet). |
| 743 | # The kernel neighbour table is authoritative and needs no capture, so this is |
| 744 | # cheap enough to run on a schedule from the integrity monitor. |
| 745 | # -------------------------------------------------------------------------- |
| 746 | |
| 747 | _ARP_BASELINE_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), |
| 748 | 'data', 'arp_baseline.json') |
| 749 | _arp_baseline_lock = threading.Lock() |
| 750 | # A MAC bound to at least this many IPs in the neighbour table is treated as a |
| 751 | # possible impersonator. Proxy-ARP routers can legitimately answer for a few, so |
| 752 | # keep the floor above normal noise. |
| 753 | _ARP_IMPERSONATOR_MIN_IPS = 4 |
| 754 | |
| 755 | |
| 756 | def _neigh_entries(iface=None): |
| 757 | """Parse `ip -4 neigh` into [(ip, mac, state)] for entries with a lladdr. |
| 758 | Scoped to one interface's segment when `iface` is given.""" |
| 759 | cmd = ['ip', '-4', 'neigh', 'show'] |
| 760 | if iface: |
| 761 | cmd += ['dev', iface] |
| 762 | res = _run(cmd, timeout=5) |
| 763 | out = [] |
no test coverage detected