aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKingwel Xie <kingwel.xie@ericsson.com>2019-03-07 06:34:30 -0500
committerNeale Ranns <nranns@cisco.com>2019-03-07 13:31:39 +0000
commitd3d1205087783eb36c9e44d98a33a0f01adb47c9 (patch)
tree6b2f1a863e9af7ddd9f6b38590f1a62b37a3f31c /src
parent48ae19e9096fab98b14eaddaaa73e1b54bcbda8d (diff)
ipsec: cli bug fixes
1. fix wrong assignemnt of lik/rik 2. keys initialized to 0, to avoid using random data in stack. could cause memory overlapped then crash 3. show sa->id in hex format Change-Id: Id0430aa49bb55c27cee4f97f8c0e4ec87515dcd2 Signed-off-by: Kingwel Xie <kingwel.xie@ericsson.com>
Diffstat (limited to 'src')
-rw-r--r--src/vnet/ipsec/ipsec_cli.c12
-rw-r--r--src/vnet/ipsec/ipsec_format.c2
2 files changed, 9 insertions, 5 deletions
diff --git a/src/vnet/ipsec/ipsec_cli.c b/src/vnet/ipsec/ipsec_cli.c
index ee2e870c343..648455bbecf 100644
--- a/src/vnet/ipsec/ipsec_cli.c
+++ b/src/vnet/ipsec/ipsec_cli.c
@@ -82,7 +82,8 @@ ipsec_sa_add_del_command_fn (vlib_main_t * vm,
ipsec_protocol_t proto;
ipsec_sa_flags_t flags;
clib_error_t *error;
- ipsec_key_t ck, ik;
+ ipsec_key_t ck = { 0 };
+ ipsec_key_t ik = { 0 };
int is_add, rv;
u32 id, spi;
@@ -619,7 +620,10 @@ create_ipsec_tunnel_command_fn (vlib_main_t * vm,
u8 ipv4_set = 0;
u8 ipv6_set = 0;
clib_error_t *error = NULL;
- ipsec_key_t rck, lck, lik, rik;
+ ipsec_key_t rck = { 0 };
+ ipsec_key_t lck = { 0 };
+ ipsec_key_t lik = { 0 };
+ ipsec_key_t rik = { 0 };
clib_memset (&a, 0, sizeof (a));
a.is_add = 1;
@@ -709,9 +713,9 @@ create_ipsec_tunnel_command_fn (vlib_main_t * vm,
clib_memcpy (a.remote_crypto_key, rck.data, rck.len);
a.remote_crypto_key_len = rck.len;
- clib_memcpy (a.local_integ_key, lck.data, lck.len);
+ clib_memcpy (a.local_integ_key, lik.data, lik.len);
a.local_integ_key_len = lck.len;
- clib_memcpy (a.remote_integ_key, rck.data, rck.len);
+ clib_memcpy (a.remote_integ_key, rik.data, rik.len);
a.remote_integ_key_len = rck.len;
rv = ipsec_add_del_tunnel_if (&a);
diff --git a/src/vnet/ipsec/ipsec_format.c b/src/vnet/ipsec/ipsec_format.c
index dc66569702e..d65b2a7ee4f 100644
--- a/src/vnet/ipsec/ipsec_format.c
+++ b/src/vnet/ipsec/ipsec_format.c
@@ -244,7 +244,7 @@ format_ipsec_sa (u8 * s, va_list * args)
sa = pool_elt_at_index (im->sad, sai);
- s = format (s, "[%d] sa %u spi %u mode %s%s protocol %s%s%s%s",
+ s = format (s, "[%d] sa 0x%x spi %u mode %s%s protocol %s%s%s%s",
sai, sa->id, sa->spi,
sa->is_tunnel ? "tunnel" : "transport",
sa->is_tunnel_ip6 ? "-ip6" : "",