diff options
author | Christian Poessinger <christian@poessinger.com> | 2018-08-26 16:55:49 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2018-08-26 16:55:49 +0200 |
commit | 5150b2890ec6a38dbeae2e105fce6855ce0f589e (patch) | |
tree | fdeeaa646001ae1f9d6ff4efbba7e9e483e48adf /src | |
parent | 81f0f401e2f255167ffa33ca3b300fd16540e5e6 (diff) | |
download | vyos-1x-5150b2890ec6a38dbeae2e105fce6855ce0f589e.tar.gz vyos-1x-5150b2890ec6a38dbeae2e105fce6855ce0f589e.zip |
tftp_server.py: fix indention and add more verbose comments
Diffstat (limited to 'src')
-rwxr-xr-x | src/conf_mode/tftp_server.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/conf_mode/tftp_server.py b/src/conf_mode/tftp_server.py index 8133ed215..8665f2964 100755 --- a/src/conf_mode/tftp_server.py +++ b/src/conf_mode/tftp_server.py @@ -59,12 +59,15 @@ default_config_data = { # Verify if an IP address is assigned to any interface, IPv4 and IPv6 def addrok(ipaddr, ipversion): + # For every available interface on this system for interface in netifaces.interfaces(): - # Retrieve IP address of network interfaces - if ipversion in netifaces.ifaddresses(interface).keys(): - for addr in netifaces.ifaddresses(interface)[ipversion]: - if addr['addr'] == ipaddr: - return True + # If it has any IPv4 or IPv6 address (depending on ipversion) configured + if ipversion in netifaces.ifaddresses(interface).keys(): + # For every configured IP address + for addr in netifaces.ifaddresses(interface)[ipversion]: + # Check if it matches to the address requested + if addr['addr'] == ipaddr: + return True return False |