diff options
Diffstat (limited to 'ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c')
-rw-r--r-- | ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c b/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c index 1b73c694f..53aa95a75 100644 --- a/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c +++ b/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c @@ -304,11 +304,13 @@ int hl_on_event(interface_t * interface, const facelet_t * facelet) */ if (facelet_get_face(facelet, &face) < 0) { ERROR("Could not retrieve face from facelet"); + ret = -FACELET_ERROR_REASON_INTERNAL_ERROR; goto ERR_FACE; } if (!data->s) { /* We are not connected to the forwarder */ + ret = -FACELET_ERROR_REASON_FORWARDER_OFFLINE; goto ERR; } @@ -328,6 +330,7 @@ int hl_on_event(interface_t * interface, const facelet_t * facelet) rc = hc_face_create(data->s, &hc_face); if (rc < 0) { ERROR("Failed to create face\n"); + ret = -FACELET_ERROR_REASON_UNSPECIFIED_ERROR; goto ERR; } INFO("Created face id=%d", hc_face.id); @@ -336,6 +339,7 @@ int hl_on_event(interface_t * interface, const facelet_t * facelet) int n = facelet_get_route_array(facelet, &route_array); if (n < 0) { ERROR("Failed to create default hICN/IPv4 route"); + ret = -FACELET_ERROR_REASON_UNSPECIFIED_ERROR; goto ERR; } if (n == 0) { @@ -394,7 +398,6 @@ int hl_on_event(interface_t * interface, const facelet_t * facelet) continue; } } - } break; @@ -406,6 +409,7 @@ int hl_on_event(interface_t * interface, const facelet_t * facelet) rc = hc_face_delete(data->s, &hc_face); if (rc < 0) { ERROR("Failed to delete face\n"); + ret = -FACELET_ERROR_REASON_UNSPECIFIED_ERROR; goto ERR; } break; @@ -419,10 +423,12 @@ int hl_on_event(interface_t * interface, const facelet_t * facelet) rc = hc_face_get(data->s, &hc_face, &face_found); if (rc < 0) { ERROR("Failed to find face\n"); + ret = -FACELET_ERROR_REASON_INTERNAL_ERROR; goto ERR; } if (!face_found) { ERROR("Face to update has not been found"); + ret = -FACELET_ERROR_REASON_UNSPECIFIED_ERROR; goto ERR; } char conn_id_or_name[SYMBOLIC_NAME_LEN]; @@ -432,11 +438,13 @@ int hl_on_event(interface_t * interface, const facelet_t * facelet) face_state_t admin_state; if (facelet_get_admin_state(facelet, &admin_state) < 0) { ERROR("Failed to retrieve facelet admin state"); + ret = -FACELET_ERROR_REASON_INTERNAL_ERROR; goto ERR; } if (hc_connection_set_admin_state(data->s, conn_id_or_name, admin_state) < 0) { ERROR("Failed to update admin state"); + ret = -FACELET_ERROR_REASON_UNSPECIFIED_ERROR; goto ERR; } INFO("Admin state updated"); @@ -446,16 +454,14 @@ int hl_on_event(interface_t * interface, const facelet_t * facelet) default: ERROR("Unknown event %s\n", facelet_event_str[facelet_get_event(facelet)]); /* Unsupported events */ + ret = -FACELET_ERROR_REASON_INTERNAL_ERROR; goto ERR; } - face_free(face); - return ret; - ERR: face_free(face); ERR_FACE: - return -1; + return ret; } int hl_callback(interface_t * interface, int fd, void * unused) |