From 1439c2bc8a95e4b72dad45aafe4c1f7a581bcd5a Mon Sep 17 00:00:00 2001 From: Jordan Augé Date: Sat, 14 Dec 2019 01:50:16 +0100 Subject: [HICN-455] libhicnctrl incorrectly handles absence of forwarder in synchronous mode after it has connected MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I3999c4f8706d3df6a003ebf2574bc20c41ce102a Signed-off-by: Jordan Augé --- hicn-light/src/hicn/config/configuration.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'hicn-light') 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; -- cgit 1.2.3-korg