Fix false presence: only trigger arrival on NUD_REACHABLE, not STALE/DELAY/PROBE
Kernel fires RTM_NEWNEIGH for NUD_STALE, NUD_DELAY, and NUD_PROBE states as it probes a potentially-departed device. Each probe was calling on_arrival() which refreshed last_seen, preventing the watchdog from ever detecting departure. Only NUD_REACHABLE confirms a device is actually on the network.
This commit is contained in:
@@ -1738,7 +1738,7 @@ def parse_ndmsg(data: bytes, msg_type: int) -> None:
|
||||
if not mac or mac in ('00:00:00:00:00:00', 'ff:ff:ff:ff:ff:ff'):
|
||||
return
|
||||
|
||||
if msg_type == RTM_NEWNEIGH and (state & (NUD_REACHABLE | NUD_STALE | NUD_DELAY | NUD_PROBE)):
|
||||
if msg_type == RTM_NEWNEIGH and (state & NUD_REACHABLE):
|
||||
on_arrival(mac, ip or 'unknown')
|
||||
elif msg_type == RTM_DELNEIGH:
|
||||
on_departure(mac)
|
||||
|
||||
Reference in New Issue
Block a user