Skip to content

Commit e6985f9

Browse files
committed
pxe.arp_addresses_for: use iproute2
The former code relies on output from the net-tools implementation of the arp tool. At least the busybox implementation, found in Alpine Linux, has a different output. The `ip neigh` OTOH is designed as machine-readable and works both with iproute2 and busybox. Signed-off-by: Yann Dirson <[email protected]>
1 parent 9aa7b9e commit e6985f9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/pxe.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ def server_remove_bootconf(mac_address):
3636
def arp_addresses_for(mac_address):
3737
output = ssh(
3838
ARP_SERVER,
39-
['arp', '-n', '|', 'grep', mac_address, '|', 'awk', '\'{ print $1 }\'']
39+
['ip', 'neigh', 'show', 'nud', 'reachable',
40+
'|', 'grep', mac_address,
41+
'|', 'awk', '\'{ print $1 }\'']
4042
)
4143
candidate_ips = output.splitlines()
4244
return candidate_ips

0 commit comments

Comments
 (0)