From 938bb66901d5b2d2ef101caf8508c166df025c5a Mon Sep 17 00:00:00 2001 From: highvolt-dev Date: Sat, 11 Feb 2023 16:59:16 -0500 Subject: [PATCH] explicitly pass -4 flag to ping command to try ipv4 with ping command except for OS X clients, fixes #77 --- tmo_monitor/gateway/base.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tmo_monitor/gateway/base.py b/tmo_monitor/gateway/base.py index 0374f5b..fed2cb4 100644 --- a/tmo_monitor/gateway/base.py +++ b/tmo_monitor/gateway/base.py @@ -10,6 +10,7 @@ class ControllerBase: # functions that don't touch the API def ping(self, ping_host, ping_count, ping_interval, interface = None, ping_6 = False): is_win = platform.system() == 'Windows' + is_mac = platform.system() == 'Darwin' ping_cmd = [] extra_flags = [] @@ -21,6 +22,9 @@ def ping(self, ping_host, ping_count, ping_interval, interface = None, ping_6 = ping_bin = 'ping6' else: extra_flags.append('-6') + # Explicitly use -4 flag for IPv4 except for Mac OS X + elif not is_mac: + extra_flags.append('-4') # Add optional interface flag if interface: