summaryrefslogtreecommitdiffstats
path: root/ctrl/facemgr/src/interfaces/hicn_light
diff options
context:
space:
mode:
authorJordan Augé <jordan.auge+fdio@cisco.com>2019-11-05 12:56:37 +0100
committerJordan Augé <jordan.auge+fdio@cisco.com>2019-11-17 01:01:47 +0100
commita2efba68e8fc25459ee524e31fc7228ee62d89ce (patch)
treeb3dadbbd105b224d90f1a2abd6aaca39e52587fa /ctrl/facemgr/src/interfaces/hicn_light
parent5d45b1b26fd4671d8ad2dabee7631ab499862487 (diff)
[HICN-378] Add a maximum number of reattempts in face manager before entering face ignore mode
Change-Id: Id6f8cc958d3c50027475d72d80eed6b65ac0996b Signed-off-by: Jordan Augé <jordan.auge+fdio@cisco.com>
Diffstat (limited to 'ctrl/facemgr/src/interfaces/hicn_light')
-rw-r--r--ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c16
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 945b60af2..76edfec10 100644
--- a/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c
+++ b/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c
@@ -238,11 +238,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;
}
@@ -260,6 +262,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);
@@ -268,6 +271,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) {
@@ -326,7 +330,6 @@ int hl_on_event(interface_t * interface, const facelet_t * facelet)
continue;
}
}
-
}
break;
@@ -338,6 +341,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;
@@ -351,10 +355,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];
@@ -364,11 +370,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");
@@ -378,16 +386,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)