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. --- src/etc/ipsec.d/vti-up-down | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/etc/ipsec.d/vti-up-down b/src/etc/ipsec.d/vti-up-down index 49acd27d2..58089bbae 100755 --- a/src/etc/ipsec.d/vti-up-down +++ b/src/etc/ipsec.d/vti-up-down @@ -29,7 +29,7 @@ from vyos.configquery import ConfigTreeQuery from vyos.configdict import get_interface_dict from vyos.utils.commit import wait_for_commit_lock from vyos.utils.process import call -from vyos.utils.vti_updown_db import open_vti_updown_db_for_update +from vyos.utils.vti_updown_db import open_vti_updown_db_for_create_or_update def supply_interface_dict(interface): # Lazy-load the running config on first invocation @@ -58,10 +58,10 @@ if __name__ == '__main__': wait_for_commit_lock() if verb in ['up-client', 'up-client-v6', 'up-host', 'up-host-v6']: - with open_vti_updown_db_for_update() as db: + with open_vti_updown_db_for_create_or_update() as db: db.add(interface, connection, protocol) db.commit(supply_interface_dict) elif verb in ['down-client', 'down-client-v6', 'down-host', 'down-host-v6']: - with open_vti_updown_db_for_update() as db: + with open_vti_updown_db_for_create_or_update() as db: db.remove(interface, connection, protocol) db.commit(supply_interface_dict) -- cgit v1.2.3