summaryrefslogtreecommitdiff
path: root/interface-definitions/include/ipsec
diff options
context:
space:
mode:
authorRobert Navarro <crshman@gmail.com>2026-06-18 19:13:04 -0700
committerRobert Navarro <crshman@gmail.com>2026-06-23 21:49:41 -0700
commit368b0468bf4f1eaac8e0b61d0790206048eeb79a (patch)
treec202480d379046f19adb6736d6791f182295d3e7 /interface-definitions/include/ipsec
parente0114625c08a2a9826822958f53724995580716d (diff)
downloadvyos-1x-368b0468bf4f1eaac8e0b61d0790206048eeb79a.tar.gz
vyos-1x-368b0468bf4f1eaac8e0b61d0790206048eeb79a.zip
ipsec: T8975: lock vti-up-down state DB to prevent lost updates under concurrent rekey
The vti-up-down hook and vpn_ipsec.py modify a flat-file DB (/tmp/ipsec_vti_interfaces) through three context managers that do an unlocked read-modify-write. During a coordinated rekey, strongSwan fires the hook for many VTIs concurrently, so the writers lost-update each other: an interface whose up-client add is overwritten is left admin-down while its CHILD_SA stays installed. Serialise all DB access by reusing vyos.utils.locking.Lock. A new _vti_updown_db_lock() context manager wraps the three public context managers, and remove_vti_updown_db() holds the lock across both the DB processing and the os.unlink() to close the create/delete race. Make the helpers absence-safe under the lock so callers no longer compose a separate existence check with a locked operation: open_vti_updown_db_readonly() yields None when the DB does not exist and remove_vti_updown_db() is a no-op when it is absent. Drop the now-redundant unlocked vti_updown_db_exists() pre-checks in vti.py and vpn_ipsec.py and handle the None yield.
Diffstat (limited to 'interface-definitions/include/ipsec')
0 files changed, 0 insertions, 0 deletions