get_arp_table: 'age' carries the expiry countdown, not the entry's age #24

Closed
opened 2026-10-18 16:15:18 +00:00 by christianmanivong · 1 comment
Owner

get_arp_table fills age from OPNsense's expires field (napalm_opnsense/opnsense.py:436 and :615). expires counts down to the entry's expiry. NAPALM's age is the number of seconds since the entry was last seen, so it counts up. A large value here means a fresh entry, and readers that follow the NAPALM contract read it the other way round.

netOrk reads age as the age: detect_ip_changes takes the freshest entry per MAC as "lowest age", and since NetOrk/netork#1114 dates an entry as poll time - age. OPNsense entries therefore look older than they are, and the most recently refreshed entry looks the stalest.

Fix: report the age, not the remaining lifetime. If the age is not available, report -1.0 (unknown), the way the static/permanent rows at :584 already do. If OPNsense gives the configured lifetime, age = lifetime - expires is an option, but only if that lifetime is reliable.

Prio: P3, wrong semantics feeding the IP-change detection. Found while fixing NetOrk/netork#1114. The same bug is in napalm-bsd.

`get_arp_table` fills `age` from OPNsense's `expires` field (`napalm_opnsense/opnsense.py:436` and `:615`). `expires` counts **down** to the entry's expiry. NAPALM's `age` is the number of seconds since the entry was last seen, so it counts **up**. A large value here means a fresh entry, and readers that follow the NAPALM contract read it the other way round. netOrk reads `age` as the age: `detect_ip_changes` takes the freshest entry per MAC as "lowest age", and since NetOrk/netork#1114 dates an entry as `poll time - age`. OPNsense entries therefore look older than they are, and the most recently refreshed entry looks the stalest. **Fix:** report the age, not the remaining lifetime. If the age is not available, report `-1.0` (unknown), the way the static/permanent rows at `:584` already do. If OPNsense gives the configured lifetime, `age = lifetime - expires` is an option, but only if that lifetime is reliable. Prio: P3, wrong semantics feeding the IP-change detection. Found while fixing NetOrk/netork#1114. The same bug is in napalm-bsd.
Author
Owner

Already fixed on main by bb0810d ("fix: an ARP entry's expiry is no age", 2026-10-30): opnsense.py:512 and :698 report age -1.0 (ARP_AGE_UNKNOWN); tested by test_expires_is_not_an_age. Duplicate of #25.

Already fixed on main by bb0810d ("fix: an ARP entry's expiry is no age", 2026-10-30): `opnsense.py:512` and `:698` report age -1.0 (`ARP_AGE_UNKNOWN`); tested by `test_expires_is_not_an_age`. Duplicate of #25.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NAPALM/napalm-opnsense#24