Repository navigation
network.arp: fall back to ip neigh when net-tools is absent (refs #57541) - #69621
Merged
Merged
Conversation
network.arp() was guarded by @salt.utils.decorators.path.which("arp"),
which raises CommandNotFoundError when the net-tools arp command is not
installed. net-tools is deprecated (since 2011) and absent by default on
modern distributions, so network.arp broke on those systems with no
fallback.
PR saltstack#64351 migrated network.netstat/network.routes to iproute2 with a
which()-based fallback (ss / ip route) and added network.ip_neighs, but
left the public network.arp() on net-tools. This completes that work:
on Linux, when the arp command is unavailable, arp() now dispatches to
ip_neighs() (ip neigh show), which returns the same {mac: ip} mapping.
Non-Linux kernels (SunOS/OpenBSD/AIX) keep using their native arp
command, mirroring how network.netstat() is structured.
Refs saltstack#57541, saltstack#64351.
Validated on AlmaLinux 8, 9 and 10: net-tools is absent by default, and
network.arp returns the neighbour table via the ip neigh fallback.
Every test in tests/unit/modules/test_network.py already has a same-named twin in tests/pytests/unit/modules/test_network.py with identical mocks, inputs, and expected values, under equivalent loader wiring. Keeping both copies means fixes only land in one, which is exactly how test_arp broke on this branch: arp() gained the ip neigh fallback and only the pytest copy was updated. The one gap was test___virtual__is_windows_false, whose pytest twin had been weakened from assertEqual(result, True) to a bare truthiness assert that would also pass for the (False, reason) failure tuple. Restore the strict check and remove the legacy file, leaving a single canonical home for these tests.
Merged
3 tasks done
dwoz
approved these changes
Jul 3, 2026
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
network.arp()was guarded by@salt.utils.decorators.path.which("arp"), which raisesCommandNotFoundErrorwhen the net-toolsarpcommand is not installed. net-tools has been deprecated since 2011 and is absent by default on modern distributions (e.g. EL8/9/10, current Debian/Ubuntu), sonetwork.arpbroke on those systems with no fallback.PR #64351 migrated
network.netstat/network.routesto iproute2 with awhich()-based fallback (ss/ip route) and addednetwork.ip_neighs, but left the publicnetwork.arp()on net-tools. This completes that work: on Linux, when thearpcommand is unavailable,arp()dispatches toip_neighs()(ip neigh show), which returns the same{mac: ip}mapping. Non-Linux kernels (SunOS/OpenBSD/AIX) keep using their nativearpcommand, mirroring hownetwork.netstat()is structured.What issues does this PR fix or reference?
Refs #57541, #64351.
#64351 closed #57541 (the net-tools deprecation tech-debt issue) but the public
network.arp()was only guarded, not migrated. This is the follow-up that completes it. An audit of the remaining net-tools commands in scope (ifconfig, netstat, route, iwconfig, iptunnel, nameif) foundnetwork.arp()to be the only remaining Linux code path that hard-fails without net-tools; the others are already migrated (#64351), platform-native (BSD/macOS/Solaris/AIX), or gated to unavailable (iwtools).Previous Behavior
On a Linux minion with iproute2 but no net-tools,
salt-call network.arpraised:New Behavior
network.arpreturns the neighbour table viaip neighwhen net-toolsarpis absent; behavior is unchanged whenarpis present or on non-Linux kernels.Tests written?
Yes. Replaced
test_arpwith explicit coverage of all three branches (Linux + net-toolsarp, Linux fallback toip neigh, and non-Linux using the nativearpcommand). Fulltest_network.pypasses (39 tests).Validated on real AlmaLinux 8, 9, and 10 VMs: net-tools is absent by default on all three, and
network.arpreturns the neighbour table via theip neighfallback.Out of scope
ps.netstatalso carries an@path.which("netstat")decorator, but it degrades to unavailable (not a crash) and already has a companionps.ss, so it is left as-is to keep this change surgical.