Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipsec: T3333: Fix status for SA state op-mode #805

Merged
merged 1 commit into from Apr 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/op_mode/show_ipsec_sa.py
Expand Up @@ -43,8 +43,11 @@
# list_sas() returns a list of single-item dicts
for peer in sa:
parent_sa = sa[peer]
child_sas = parent_sa["child-sas"]
installed_sas = {k: v for k, v in child_sas.items() if v["state"] == b"INSTALLED"}

if parent_sa["state"] == b"ESTABLISHED":
# parent_sa["state"] = IKE state, child_sas["state"] = ESP state
if parent_sa["state"] == b"ESTABLISHED" and installed_sas:
state = "up"
else:
state = "down"
Expand All @@ -61,9 +64,6 @@
remote_id = "N/A"

# The counters can only be obtained from the child SAs
child_sas = parent_sa["child-sas"]
installed_sas = {k: v for k, v in child_sas.items() if v["state"] == b"INSTALLED"}

if not installed_sas:
data = [peer, state, "N/A", "N/A", "N/A", "N/A", "N/A", "N/A"]
sa_data.append(data)
Expand Down