aboutsummaryrefslogtreecommitdiffstats
path: root/ctrl/libhicnctrl/src/modules/hicn_plugin
diff options
context:
space:
mode:
authorMichele Papalini <micpapal@cisco.com>2023-02-02 17:49:46 +0100
committerMauro Sardara <msardara@cisco.com>2023-02-09 13:23:13 +0000
commite30c3a102081ccf345c457658dc557703fae67bb (patch)
tree81022d23ef15eb766f396e3f2d1e9f4b763ae4bf /ctrl/libhicnctrl/src/modules/hicn_plugin
parentabf7c63f1cb45276f379770319ddb537104022e8 (diff)
fix(hicn): fix bugs reported by sonarqube
Ref: HICN-837 Signed-off-by: Michele Papalini <micpapal@cisco.com> Change-Id: I0d02a11361b1ba5ad50123b2dd142c961998922f (cherry picked from commit 8a7e75e84a31180d51b9970d526709ec4dca2030)
Diffstat (limited to 'ctrl/libhicnctrl/src/modules/hicn_plugin')
-rw-r--r--ctrl/libhicnctrl/src/modules/hicn_plugin/route.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/ctrl/libhicnctrl/src/modules/hicn_plugin/route.c b/ctrl/libhicnctrl/src/modules/hicn_plugin/route.c
index e066862e2..4c9f8a638 100644
--- a/ctrl/libhicnctrl/src/modules/hicn_plugin/route.c
+++ b/ctrl/libhicnctrl/src/modules/hicn_plugin/route.c
@@ -39,8 +39,6 @@ static vapi_error_e parse_route_create(
vapi_payload_ip_route_add_del_reply *reply) {
if (reply == NULL || rv != VAPI_OK) return rv;
- if (reply->retval != VAPI_OK) return reply->retval;
-
return reply->retval;
}
@@ -114,6 +112,10 @@ static int _vpp_route_create(hc_sock_t *sock, hc_route_t *route) {
if (hicn_ip_address_is_v4(&(face->remote_addr)) &&
hicn_ip_address_is_v4(&(face->local_addr))) {
msg2 = vapi_alloc_hicn_api_udp_tunnel_add_del(s->g_vapi_ctx_instance);
+ if (msg2 == NULL) {
+ ret = -1;
+ goto done;
+ }
memcpy(msg2->payload.src_addr.un.ip4, &face->local_addr.v4,
sizeof(ip4_address_t));
msg2->payload.src_addr.af = ADDRESS_IP4;
@@ -125,6 +127,10 @@ static int _vpp_route_create(hc_sock_t *sock, hc_route_t *route) {
} else if (!hicn_ip_address_is_v4(&(route->face.remote_addr)) &&
!hicn_ip_address_is_v4(&(route->face.local_addr))) {
msg2 = vapi_alloc_hicn_api_udp_tunnel_add_del(s->g_vapi_ctx_instance);
+ if (msg2 == NULL) {
+ ret = -1;
+ goto done;
+ }
memcpy(msg2->payload.src_addr.un.ip6, &face->local_addr.v6,
sizeof(ip6_address_t));
msg2->payload.src_addr.af = ADDRESS_IP6;