diff options
author | Christian Poessinger <christian@poessinger.com> | 2019-08-27 19:49:18 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-08-27 19:49:18 +0200 |
commit | 34adc76f589cb01406155007ce49c5855764c79c (patch) | |
tree | 59c92ac8b998f1530e448ef0af3ac4e1f700f409 /python/vyos | |
parent | 343a48be36b1573286db8f944aa933911b09530b (diff) | |
download | vyos-1x-34adc76f589cb01406155007ce49c5855764c79c.tar.gz vyos-1x-34adc76f589cb01406155007ce49c5855764c79c.zip |
Python/VyOS validate: add is_ip() to check for IPv4 or IPv4 address
Diffstat (limited to 'python/vyos')
-rw-r--r-- | python/vyos/validate.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/python/vyos/validate.py b/python/vyos/validate.py index 97a401423..258f7f76a 100644 --- a/python/vyos/validate.py +++ b/python/vyos/validate.py @@ -16,6 +16,12 @@ import netifaces import ipaddress +def is_ip(addr): + """ + Check addr if it is an IPv4 or IPv6 address + """ + return is_ipv4(addr) or is_ipv6(addr) + def is_ipv4(addr): """ Check addr if it is an IPv4 address/network. Returns True/False |