summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKyrylo Yatsenko <hedrok@gmail.com>2025-07-22 10:00:23 +0300
committerKyrylo Yatsenko <hedrok@gmail.com>2025-07-23 11:14:47 +0300
commit6060c194e3f75bdf7f23df6a892dd0f593b802d0 (patch)
tree1a9654e2531f88fa836f4e376b9803b4bdf96bd1 /src
parentfe8559ec092aea60bf4104dfb1f91cd790ce9b55 (diff)
downloadvyos-1x-6060c194e3f75bdf7f23df6a892dd0f593b802d0.tar.gz
vyos-1x-6060c194e3f75bdf7f23df6a892dd0f593b802d0.zip
T7489: Fix output state of ipsec passthrough child
Show state of passthrough tunnels as always up. Passthrough children of connection have PASS mode but have no sa and are not shown in vici list_sas. Fix by passing mode from vici list_connections to _get_child_sa_state and always return 'up' for child with PASS mode.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/op_mode/ipsec.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/op_mode/ipsec.py b/src/op_mode/ipsec.py
index 649e4d095..4ff035416 100755
--- a/src/op_mode/ipsec.py
+++ b/src/op_mode/ipsec.py
@@ -230,17 +230,25 @@ def _get_parent_sa_state(connection_name: str, data: list) -> str:
return ike_state
-def _get_child_sa_state(connection_name: str, tunnel_name: str, data: list) -> str:
+def _get_child_sa_state(
+ connection_name: str, tunnel_name: str, data: list, mode: str
+) -> str:
"""Get child SA state by connection and tunnel name
Args:
connection_name (str): Connection name
tunnel_name (str): Tunnel name
data (list): List of current SAs from vici
+ mode (str): Mode of child from vici list_connections
Returns:
- str: `up` if child SA state is 'installed' otherwise `down`
+ str: `up` if child SA state is 'installed' or child is passthrough
+ otherwise `down`
"""
+ # passthrough child (trap mode) has 'PASS' mode and is always up,
+ # but has no sa, so is not present in list_sas (data)
+ if mode == 'PASS':
+ return 'up'
child_sa = 'down'
if not data:
return child_sa
@@ -330,7 +338,8 @@ def _get_raw_data_connections(list_connections: list, list_sas: list) -> list:
base_list['children'] = []
children = conn_conf['children']
for tunnel, tun_options in children.items():
- state = _get_child_sa_state(connection, tunnel, list_sas)
+ mode = tun_options.get('mode')
+ state = _get_child_sa_state(connection, tunnel, list_sas, mode)
local_ts = tun_options.get('local-ts')
remote_ts = tun_options.get('remote-ts')
dpd_action = tun_options.get('dpd_action')