diff --git a/imageroot/actions/create-module/40strict_interface_validation b/imageroot/actions/create-module/40strict_interface_validation new file mode 100755 index 0000000..cef5bb1 --- /dev/null +++ b/imageroot/actions/create-module/40strict_interface_validation @@ -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) diff --git a/imageroot/pypkg/network.py b/imageroot/pypkg/network.py index 230d484..f1ab585 100644 --- a/imageroot/pypkg/network.py +++ b/imageroot/pypkg/network.py @@ -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