diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-08-01 10:41:02 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-08-01 10:43:18 +0200 |
commit | d3a0b9bcb30e36633bad0edf39c1f92039bebcb7 (patch) | |
tree | a56632823702ea0a47b8155ddb9cb089ec947159 | |
parent | 225be098db7095e779f3fa2f6cf53ca08c8faf9b (diff) | |
download | vyos-1x-d3a0b9bcb30e36633bad0edf39c1f92039bebcb7.tar.gz vyos-1x-d3a0b9bcb30e36633bad0edf39c1f92039bebcb7.zip |
ping: T3707: add UnicodeError exception when invalid IP address is passed
(cherry picked from commit 0d1ad777daf25ef415bf45032d41b587baf20781)
-rwxr-xr-x | src/op_mode/ping.py | 2 |
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 |