summaryrefslogtreecommitdiff
path: root/src/conf_mode/tftp_server.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/conf_mode/tftp_server.py')
-rwxr-xr-xsrc/conf_mode/tftp_server.py13
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