Reverse-DNS an IP via getent (honours nsswitch, bounded by _run's timeout). Returns the PTR hostname or None.
(ip)
| 819 | interface — the right lens on a multi-homed box.""" |
| 820 | iface = interface if _valid_iface(interface or '') else None |
| 821 | gw = _iface_gateway(iface) if iface else _default_gateway() |
| 822 | if not gw: |
| 823 | return {'success': True, 'verdict': 'unknown', 'gateway': None, |
| 824 | 'interface': iface, |
| 825 | 'reasons': [('no default gateway via %s — nothing to check' % iface) |
| 826 | if iface else 'no default gateway on this host — nothing to check'], |
| 827 | 'impersonators': [], 'neighbor_count': 0} |
| 828 | |
| 829 | gw_mac = _neigh_mac(gw) |
| 830 | reasons = [] |
| 831 | verdict = 'clean' |
| 832 | learned = False |
| 833 | with _arp_baseline_lock: |
| 834 | baseline = _arp_baseline_load() |
| 835 | gws = baseline.setdefault('gateways', {}) |
| 836 | base_mac = gws.get(gw) |
no test coverage detected