Skip to content

Commit 6c95139

Browse files
committed
feat(ns-ha): show arping failure reason
1 parent 52b88b5 commit 6c95139

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

packages/ns-ha/files/ns-ha-enable

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,11 @@ def send_gratuitous_arp(file):
6868
# Remove /mask if present
6969
ip = ip.split('/')[0]
7070
# Send gratuitous ARP to update switches ARP tables
71-
aproc = subprocess.run(["/usr/bin/arping", "-c", "1", "-U", "-I", device, ip], capture_output=True)
72-
logger.info("Sending gratuitous ARP on interface %s (%s) for IP %s: %s", interface, device, ip, "success" if aproc.returncode == 0 else "fail")
71+
aproc = subprocess.run(["/usr/bin/arping", "-c", "1", "-U", "-I", device, ip], capture_output=True, text=True)
72+
if aproc.returncode == 0:
73+
logger.info("Sending gratuitous ARP on interface %s (%s) for IP %s: success", interface, device, ip)
74+
else:
75+
logger.error("Sending gratuitous ARP on interface %s (%s) for IP %s: fail, %s", interface, device, ip, aproc.stderr.strip())
7376

7477
def enable_hotspot_mac():
7578
u = EUci()

0 commit comments

Comments
 (0)