You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
IPv6 Gateway MAC Address Always Returns Zero on macOS #177
On macOS, the netdev crate retrieves IPv6 gateway addresses correctly but always returns MacAddr(0,0,0,0,0,0) for the gateway's MAC address, even when the neighbor is actively resolved in the system's neighbor discovery (NDP) cache.
Environment
OS: macOS
netdev version: 0.45.0
Rust version: 1.82+
Expected Behavior
The gateway MAC address should be populated with the resolved neighbor's MAC address from the system's neighbor discovery table, matching what ndp -a reports.
Actual Behavior
The gateway MAC address is always MacAddr(0,0,0,0,0,0) regardless of whether the neighbor has been resolved.
Root Cause
The netdev crate queries the routing table for gateway information but does not query the neighbor discovery (NDP) cache. On macOS, the routing table contains gateway IP addresses but not their associated MAC addresses. The MAC addresses are maintained separately in the kernel's neighbor cache and are accessible via the ndp command-line tool.
Proposed Solution
Query the neighbor discovery (NDP) cache to populate the gateway MAC address using the same sysctl() mechanism used for IPv4 ARP queries. For NDP use the IPv6 address family (AF_INET6) instead of IPv4 address family (AF_INET).
Thanks for the detailed report and proposed direction.
This has been addressed in the linked PR by querying the macOS kernel NDP cache directly using AF_INET6, NET_RT_FLAGS, and RTF_LLINFO. The implementation does not invoke the ndp command-line tool and matches link-local IPv6 neighbor entries using their interface indexes.
Activity
shellrow commentedon Aug 2, 2026
Thanks for the detailed report and proposed direction.
This has been addressed in the linked PR by querying the macOS kernel NDP cache directly using AF_INET6, NET_RT_FLAGS, and RTF_LLINFO. The implementation does not invoke the ndp command-line tool and matches link-local IPv6 neighbor entries using their interface indexes.