summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--python/vyos/util.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/python/vyos/util.py b/python/vyos/util.py
index 61ce59324..e62f9d5cf 100644
--- a/python/vyos/util.py
+++ b/python/vyos/util.py
@@ -1063,9 +1063,13 @@ def check_port_availability(ipaddress, port, protocol):
if protocol == 'udp':
server = UDPServer((ipaddress, port), None, bind_and_activate=True)
server.server_close()
- return True
- except:
- return False
+ except Exception as e:
+ # errno.h:
+ #define EADDRINUSE 98 /* Address already in use */
+ if e.errno == 98:
+ return False
+
+ return True
def install_into_config(conf, config_paths, override_prompt=True):
# Allows op-mode scripts to install values if called from an active config session