summaryrefslogtreecommitdiff
path: root/src/op_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-08-01 10:41:02 +0200
committerChristian Poessinger <christian@poessinger.com>2021-08-01 10:42:16 +0200
commit0d1ad777daf25ef415bf45032d41b587baf20781 (patch)
treeb003333e46f72f44241eb91fc6bc6c6fcc2f5f85 /src/op_mode
parentd4f25a76e3ffc79eb3322951f73f386d410458cb (diff)
downloadvyos-1x-0d1ad777daf25ef415bf45032d41b587baf20781.tar.gz
vyos-1x-0d1ad777daf25ef415bf45032d41b587baf20781.zip
ping: T3707: add UnicodeError exception when invalid IP address is passed
Diffstat (limited to 'src/op_mode')
-rwxr-xr-xsrc/op_mode/ping.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/op_mode/ping.py b/src/op_mode/ping.py
index 924a889db..610f6a05d 100755
--- a/src/op_mode/ping.py
+++ b/src/op_mode/ping.py
@@ -220,6 +220,8 @@ if __name__ == '__main__':
try:
ip = socket.gethostbyname(host)
+ except UnicodeError:
+ sys.exit(f'ping: Unknown host: {host}')
except socket.gaierror:
ip = host