From e1fd60f8e46965830cecd1932ac3d2039300b6a7 Mon Sep 17 00:00:00 2001 From: Oleksandr Kuchmystyi Date: Fri, 28 Nov 2025 15:23:58 +0300 Subject: ipsec: T8001: Commit fails removing VTI interface in IPsec config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix cases where commit or IPsec up/down hooks fail if the VTI interface has already been deleted or the `/tmp/ipsec_vti_interfaces` file does not exist. Changes: - Return empty dict from `get_interface_config()` if it returns None to avoid TypeError when accessing 'operstate' (vti_updown_db.py). - Use `open_vti_updown_db_for_create_or_update()` in `vti‑up‑down` script so the temporary interface tracking file is created automatically when missing. --- python/vyos/utils/vti_updown_db.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'python') diff --git a/python/vyos/utils/vti_updown_db.py b/python/vyos/utils/vti_updown_db.py index f4dd24007..0587b48e8 100644 --- a/python/vyos/utils/vti_updown_db.py +++ b/python/vyos/utils/vti_updown_db.py @@ -173,7 +173,7 @@ class VTIUpDownDB: self._fileHandle.truncate() for interface in self._ifsDown: - vti_link = get_interface_config(interface) + vti_link = get_interface_config(interface) or {} vti_link_up = (vti_link['operstate'] != 'DOWN' if 'operstate' in vti_link else False) if vti_link_up: call(f'sudo ip link set {interface} down') @@ -182,7 +182,7 @@ class VTIUpDownDB: self._ifsDown.clear() for interface in self._ifsUp: - vti_link = get_interface_config(interface) + vti_link = get_interface_config(interface) or {} vti_link_up = (vti_link['operstate'] != 'DOWN' if 'operstate' in vti_link else False) if not vti_link_up: vti = interface_dict_supplier(interface) -- cgit v1.2.3