fix: an unknown ARP age is -1.0, not 0.0
driver / lint (pull_request) Successful in 17s
driver / standard (pull_request) Successful in 19s
driver / types (pull_request) Successful in 1m5s
driver / test (3.13) (pull_request) Successful in 1m2s
driver / test (3.12) (pull_request) Successful in 1m8s
driver / lowest (pull_request) Successful in 31s
driver / build (pull_request) Successful in 33s
driver / security (pull_request) Successful in 1m7s
CI / driver (pull_request) Successful in 2m28s
driver / publish (pull_request) Skipped

Neither ip neigh nor /proc/net/arp has an age, so get_arp_table reports
ARP_AGE_UNKNOWN instead of 0.0 ("confirmed just now").

NetOrk/netork#1327
This commit is contained in:
Christian Manivong committed 2026-10-30 08:37:08 +01:00
1 parent b1a2950d9d
commit b0270d3430
3 files changed
+20 -2

No files matched your search

+13
View File
@@ -274,6 +274,19 @@ class TestGetArpTable:
assert "192.168.1.100" in ips
assert "192.168.1.101" in ips
def test_ip_neigh_reports_no_age(self, driver):
# REACHABLE or STALE, `ip neigh` says nothing about when the neighbour
# was last confirmed; 0.0 would read as "just now" (NetOrk/netork#1327).
driver._send_command = lambda cmd, **kw: IP_NEIGH_SHOW
assert {e["age"] for e in driver.get_arp_table()} == {-1.0}
def test_proc_net_arp_reports_no_age(self, driver):
driver._send_command = lambda cmd, **kw: (
"IP address HW type Flags HW address Mask Device\n"
"192.168.1.100 0x1 0x2 aa:bb:cc:dd:ee:ff * br-lan\n"
)
assert [e["age"] for e in driver.get_arp_table()] == [-1.0]
class TestGetMacAddressTable:
def test_returns_list(self, driver):