summaryrefslogtreecommitdiffstats
path: root/hicn-light
diff options
context:
space:
mode:
authorJordan Augé <jordan.auge+fdio@cisco.com>2019-12-14 01:50:16 +0100
committerJordan Augé <jordan.auge+fdio@cisco.com>2019-12-14 02:12:37 +0100
commit1439c2bc8a95e4b72dad45aafe4c1f7a581bcd5a (patch)
tree77c269c7a39ce76d2143fb160d4ebe43fbee8ae8 /hicn-light
parentd4aab68ff7a309b0cf500ff947dbbbf83ab0ab03 (diff)
[HICN-455] libhicnctrl incorrectly handles absence of forwarder in synchronous mode after it has connected
Change-Id: I3999c4f8706d3df6a003ebf2574bc20c41ce102a Signed-off-by: Jordan Augé <jordan.auge+fdio@cisco.com>
Diffstat (limited to 'hicn-light')
-rw-r--r--hicn-light/src/hicn/config/configuration.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/hicn-light/src/hicn/config/configuration.c b/hicn-light/src/hicn/config/configuration.c
index e41fb3e45..8f97af3b1 100644
--- a/hicn-light/src/hicn/config/configuration.c
+++ b/hicn-light/src/hicn/config/configuration.c
@@ -275,6 +275,7 @@ struct iovec *configuration_ProcessRegistrationList(Configuration *config,
FibEntryList *fibList = forwarder_GetFibEntries(config->forwarder);
size_t payloadSize = fibEntryList_Length(fibList);
+ size_t effective_payloadSize = 0;
size_t pointerLocation = 0;
struct sockaddr_in tmpAddr;
struct sockaddr_in6 tmpAddr6;
@@ -288,6 +289,9 @@ struct iovec *configuration_ProcessRegistrationList(Configuration *config,
NameBitvector *prefix = name_GetContentName(fibEntry_GetPrefix(entry));
const NumberSet *nexthops = fibEntry_GetNexthops(entry);
+ if (numberSet_Length(nexthops) == 0)
+ continue;
+
if (numberSet_Length(nexthops) > 1) {
// payload extended, need reallocate, further entries via nexthops
payloadSize = payloadSize + numberSet_Length(nexthops) - 1;
@@ -316,6 +320,7 @@ struct iovec *configuration_ProcessRegistrationList(Configuration *config,
listRouteCommand->cost = 1; // cost
pointerLocation++;
+ effective_payloadSize++;
addressDestroy(&addressEntry);
}
}
@@ -323,7 +328,7 @@ struct iovec *configuration_ProcessRegistrationList(Configuration *config,
// send response
header_control_message *header = request[0].iov_base;
header->messageType = RESPONSE_LIGHT;
- header->length = (unsigned)payloadSize;
+ header->length = (unsigned)effective_payloadSize;
struct iovec *response =
parcMemory_AllocateAndClear(sizeof(struct iovec) * 2);
@@ -331,7 +336,7 @@ struct iovec *configuration_ProcessRegistrationList(Configuration *config,
response[0].iov_base = header;
response[0].iov_len = sizeof(header_control_message);
response[1].iov_base = payloadResponse;
- response[1].iov_len = sizeof(list_routes_command) * payloadSize;
+ response[1].iov_len = sizeof(list_routes_command) * effective_payloadSize;
fibEntryList_Destroy(&fibList);
return response;