diff options
Diffstat (limited to 'ctrl')
-rw-r--r-- | ctrl/facemgr/src/facelet.c | 4 | ||||
-rw-r--r-- | ctrl/libhicnctrl/src/modules/hicn_plugin/route.c | 10 | ||||
-rw-r--r-- | ctrl/libhicnctrl/src/objects/connection.c | 1 |
3 files changed, 8 insertions, 7 deletions
diff --git a/ctrl/facemgr/src/facelet.c b/ctrl/facemgr/src/facelet.c index a299cc5ac..4723b8940 100644 --- a/ctrl/facemgr/src/facelet.c +++ b/ctrl/facemgr/src/facelet.c @@ -1047,8 +1047,6 @@ int facelet_snprintf(char *s, size_t size, const facelet_t *facelet) { rc = snprintf(cur, s + size - cur, "}>"); if (rc < 0) return rc; cur += rc; - if (cur >= s + size) return (int)(cur - s); - return (int)(cur - s); } @@ -1222,7 +1220,5 @@ int facelet_snprintf_json(char *s, size_t size, const facelet_t *facelet, rc = snprintf(cur, s + size - cur, "%*s%s", 4 * indent, "", "}"); if (rc < 0) return rc; cur += rc; - if (cur >= s + size) return (int)(cur - s); - return (int)(cur - s); } 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; diff --git a/ctrl/libhicnctrl/src/objects/connection.c b/ctrl/libhicnctrl/src/objects/connection.c index 0f8bafb10..ca09d9a54 100644 --- a/ctrl/libhicnctrl/src/objects/connection.c +++ b/ctrl/libhicnctrl/src/objects/connection.c @@ -189,7 +189,6 @@ int hc_connection_cmp(const hc_connection_t *c1, const hc_connection_t *c2) { if (rc != 0) return rc; rc = INT_CMP(c1->remote_port, c2->remote_port); - if (rc != 0) return rc; return rc; } |