aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2020-10-06 08:04:10 +0000
committerBeno�t Ganne <bganne@cisco.com>2020-10-13 09:49:57 +0000
commitdc6378f71bc7c9835845a91dbbc1646ea46df51e (patch)
tree6dd8cf34bb5c7b970e2ff52283380c23118c8964 /src/plugins
parent623d87fd39c53e2f4d8718014e76836fe07c4245 (diff)
ikev2: fix coverity warning
Type: fix Change-Id: Iee96b3ea3e71ec248c3c3c98d153a08372b5faf0 Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/ikev2/ikev2.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/plugins/ikev2/ikev2.c b/src/plugins/ikev2/ikev2.c
index 44528e1fdaf..62a77f9c6d8 100644
--- a/src/plugins/ikev2/ikev2.c
+++ b/src/plugins/ikev2/ikev2.c
@@ -2714,6 +2714,26 @@ ikev2_set_ip_address (ikev2_sa_t * sa, const void *src,
ip_address_set (&sa->iaddr, iaddr, af);
}
+static void
+ikev2_elog_uint_peers_addr (u32 exchange, ip4_header_t * ip4,
+ ip6_header_t * ip6, u8 is_ip4)
+{
+ u32 src, dst;
+ if (is_ip4)
+ {
+ src = ip4->src_address.as_u32;
+ dst = ip4->dst_address.as_u32;
+ }
+ else
+ {
+ src = ip6->src_address.as_u32[3];
+ dst = ip6->dst_address.as_u32[3];
+ }
+ ikev2_elog_uint_peers (IKEV2_LOG_WARNING, "IKEv2 exchange %d "
+ "received from %d.%d.%d.%d to %d.%d.%d.%d",
+ exchange, src, dst);
+}
+
static_always_inline uword
ikev2_node_internal (vlib_main_t * vm,
vlib_node_runtime_t * node, vlib_frame_t * frame,
@@ -3118,11 +3138,7 @@ ikev2_node_internal (vlib_main_t * vm,
}
else
{
- ikev2_elog_uint_peers (IKEV2_LOG_WARNING, "IKEv2 exchange %d "
- "received from %d.%d.%d.%d to %d.%d.%d.%d",
- ike0->exchange,
- ip40->src_address.as_u32,
- ip40->dst_address.as_u32);
+ ikev2_elog_uint_peers_addr (ike0->exchange, ip40, ip60, is_ip4);
}
dispatch0: