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:42:16 +0200 |
commit | 0d1ad777daf25ef415bf45032d41b587baf20781 (patch) | |
tree | b003333e46f72f44241eb91fc6bc6c6fcc2f5f85 | |
parent | d4f25a76e3ffc79eb3322951f73f386d410458cb (diff) | |
download | vyos-1x-0d1ad777daf25ef415bf45032d41b587baf20781.tar.gz vyos-1x-0d1ad777daf25ef415bf45032d41b587baf20781.zip |
ping: T3707: add UnicodeError exception when invalid IP address is passed
-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 |