From c474e79d14636a218767220dc0d21e1700ac95dc Mon Sep 17 00:00:00 2001 From: Tommaso Bailetti Date: Fri, 20 Dec 2024 15:45:06 +0100 Subject: [PATCH] fix: reversed condition for strict validation --- .../create-module/40strict_interface_validation | 10 ++++++++++ imageroot/pypkg/network.py | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100755 imageroot/actions/create-module/40strict_interface_validation 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