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:43:18 +0200
commitd3a0b9bcb30e36633bad0edf39c1f92039bebcb7 (patch)
treea56632823702ea0a47b8155ddb9cb089ec947159 /src/op_mode
parent225be098db7095e779f3fa2f6cf53ca08c8faf9b (diff)
downloadvyos-1x-d3a0b9bcb30e36633bad0edf39c1f92039bebcb7.tar.gz
vyos-1x-d3a0b9bcb30e36633bad0edf39c1f92039bebcb7.zip
ping: T3707: add UnicodeError exception when invalid IP address is passed
(cherry picked from commit 0d1ad777daf25ef415bf45032d41b587baf20781)
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