summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-10-21 17:53:39 -0500
committerGitHub <noreply@github.com>2019-10-21 17:53:39 -0500
commit4ed6e7bf28eb409228008eb6ea4adab7837c71cd (patch)
treed1ee302f5880e7cc0fce1ea63cdca8badbd5be5f
parent0bc3e9f3d87d35c9bbf55bed1caa6f24a3678a95 (diff)
parent915116e69a532e427c0ddd2037138c5299f9e485 (diff)
downloadvyos-1x-4ed6e7bf28eb409228008eb6ea4adab7837c71cd.tar.gz
vyos-1x-4ed6e7bf28eb409228008eb6ea4adab7837c71cd.zip
Merge pull request #147 from jdmac87/current
T1755: Python KeyError exceptions raised with 'show vpn ipsec sa' command under use of certain IPSEC cipher suites.
-rwxr-xr-xsrc/op_mode/show_ipsec_sa.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/op_mode/show_ipsec_sa.py b/src/op_mode/show_ipsec_sa.py
index 0828743e8..e319cc38d 100755
--- a/src/op_mode/show_ipsec_sa.py
+++ b/src/op_mode/show_ipsec_sa.py
@@ -82,13 +82,24 @@ for sa in sas:
pkts_str = re.sub(r'B', r'', pkts_str)
enc = isa["encr-alg"].decode()
- key_size = isa["encr-keysize"].decode()
- hash = isa["integ-alg"].decode()
+ if "encr-keysize" in isa:
+ key_size = isa["encr-keysize"].decode()
+ else:
+ key_size = ""
+ if "integ-alg" in isa:
+ hash = isa["integ-alg"].decode()
+ else:
+ hash = ""
if "dh-group" in isa:
dh_group = isa["dh-group"].decode()
else:
dh_group = ""
- proposal = "{0}_{1}/{2}".format(enc, key_size, hash)
+
+ proposal = enc
+ if key_size:
+ proposal = "{0}_{1}".format(proposal, key_size)
+ if hash:
+ proposal = "{0}/{1}".format(proposal, hash)
if dh_group:
proposal = "{0}/{1}".format(proposal, dh_group)