Skip to content

Commit

Permalink
fix: reversed condition for strict validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Tbaile committed Dec 20, 2024
1 parent 3f67221 commit 0de35af
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions imageroot/actions/create-module/40strict_interface_validation
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python3

#
# Copyright (C) 2024 Nethesis S.r.l.
# SPDX-License-Identifier: GPL-3.0-or-later
#

import agent

agent.set_env("DNSMASQ_STRICT_INTERFACE_VALIDATION", 1)
2 changes: 1 addition & 1 deletion imageroot/pypkg/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def list_interfaces():
"""
subprocess_result = subprocess.run(["ip", "-4", "-j", "addr"], check=True, capture_output=True)
interfaces = [__format_interface(interface) for interface in json.loads(subprocess_result.stdout) if __filter_interface(interface)]
if os.environ.get('DNSMASQ_RELAXED_INTERFACE_VALIDATION', "0") == "0":
if os.environ.get('DNSMASQ_STRICT_INTERFACE_VALIDATION', "0") == "1":
interfaces = [interface for interface in interfaces if interface['addresses'][0]['network'].is_private]
return interfaces

Expand Down

0 comments on commit 0de35af

Please sign in to comment.