summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ctrl/facemgr/src/interfaces/netlink/netlink.c24
-rw-r--r--ctrl/libhicnctrl/src/api.c58
-rw-r--r--hicn-light/src/hicn/config/configuration.c11
-rw-r--r--hicn-light/src/hicn/content_store/contentStoreLRU.c5
-rw-r--r--hicn-light/src/hicn/core/mapme.c45
-rw-r--r--hicn-light/src/hicn/processor/fib.c4
-rw-r--r--hicn-light/src/hicn/strategies/loadBalancer.c29
-rw-r--r--hicn-plugin/CMakeLists.txt8
-rw-r--r--hicn-plugin/src/data_fwd_node.c2
-rw-r--r--hicn-plugin/src/data_push_node.c2
-rw-r--r--hicn-plugin/src/strategy.c3
11 files changed, 124 insertions, 67 deletions
diff --git a/ctrl/facemgr/src/interfaces/netlink/netlink.c b/ctrl/facemgr/src/interfaces/netlink/netlink.c
index b57a4e480..a1affd719 100644
--- a/ctrl/facemgr/src/interfaces/netlink/netlink.c
+++ b/ctrl/facemgr/src/interfaces/netlink/netlink.c
@@ -425,7 +425,7 @@ int nl_callback(interface_t * interface, int fd, void * unused)
break;
}
- DEBUG("Interface %s: address was removed", interface_name);
+ DEBUG("[NETLINK] Interface %s: address was removed", interface_name);
if (facelet) {
facelet_set_event(facelet, FACELET_EVENT_SET_DOWN);
facelet_set_attr_clean(facelet);
@@ -446,7 +446,7 @@ int nl_callback(interface_t * interface, int fd, void * unused)
break;
}
- DEBUG("Interface %s: new address was assigned: %s", interface_name, interface_address);
+ DEBUG("[NETLINK] Interface %s: new address was assigned: %s", interface_name, interface_address);
if (facelet) {
facelet_set_event(facelet, FACELET_EVENT_UPDATE);
@@ -468,7 +468,7 @@ int nl_callback(interface_t * interface, int fd, void * unused)
break;
}
- DEBUG("Network interface %s was removed", interface_name);
+ DEBUG("[NETLINK] Network interface %s was removed", interface_name);
if (!facelet)
break;
@@ -495,7 +495,7 @@ int nl_callback(interface_t * interface, int fd, void * unused)
// UP NOT RUNNING
// DOWN NOT RUNNING
#if 1
- DEBUG("New network interface %s, state: %s %s", interface_name,
+ DEBUG("[NETLINK] New network interface %s, state: %s %s", interface_name,
up ? "UP" : "DOWN",
running ? "RUNNING" : "NOT_RUNNING");
#endif
@@ -517,14 +517,14 @@ int nl_callback(interface_t * interface, int fd, void * unused)
facelet_set_family(facelet6, AF_INET6);
interface_raise_event(interface, facelet6);
#endif
- } else {
-#if 1
- facelet_set_event(facelet, FACELET_EVENT_SET_DOWN);
- facelet_set_attr_clean(facelet);
- interface_raise_event(interface, facelet);
-#else
- facelet_free(facelet);
-#endif
+// } else {
+//#if 1
+// facelet_set_event(facelet, FACELET_EVENT_SET_DOWN);
+// facelet_set_attr_clean(facelet);
+// interface_raise_event(interface, facelet);
+//#else
+// facelet_free(facelet);
+//#endif
}
break;
}
diff --git a/ctrl/libhicnctrl/src/api.c b/ctrl/libhicnctrl/src/api.c
index b836ef800..5e8536480 100644
--- a/ctrl/libhicnctrl/src/api.c
+++ b/ctrl/libhicnctrl/src/api.c
@@ -26,6 +26,12 @@
#include <sys/socket.h> // socket
#include <unistd.h> // close, fcntl
#include <fcntl.h> // fcntl
+#include <sys/types.h> // getpid
+#include <unistd.h> // getpid
+#ifdef __linux__
+#include <sys/syscall.h>
+#define gettid() syscall(SYS_gettid)
+#endif /* __linux__ */
#include <hicn/ctrl/api.h>
#include <hicn/ctrl/commands.h>
@@ -435,7 +441,11 @@ hc_sock_parse_url(const char * url, struct sockaddr * sa)
/* FIXME URL parsing is currently not implemented */
assert(!url);
- srand(time(NULL));
+#ifdef __linux__
+ srand(time(NULL) ^ getpid() ^ gettid());
+#else
+ srand(time(NULL) ^ getpid());
+#endif /* __linux__ */
/*
* A temporary solution is to inspect the sa_family fields of the passed in
@@ -704,16 +714,22 @@ hc_sock_process(hc_sock_t * s, hc_data_t ** data)
} else {
int rc;
rc = hc_data_ensure_available(s->cur_request->data, num_chunks);
- if (rc < 0)
- return -99;
+ if (rc < 0) {
+ ERROR("[hc_sock_process] Error in hc_data_ensure_available");
+ return -99;
+ }
for (int i = 0; i < num_chunks; i++) {
u8 * dst = hc_data_get_next(s->cur_request->data);
- if (!dst)
- return -99;
+ if (!dst) {
+ ERROR("[hc_sock_process] Error in hc_data_get_next");
+ return -99;
+ }
rc = s->cur_request->parse(s->buf + s->roff + i * s->cur_request->data->in_element_size, dst);
- if (rc < 0)
+ if (rc < 0) {
+ ERROR("[hc_sock_process] Error in parse");
err = -99; /* FIXME we let the loop complete (?) */
+ }
s->cur_request->data->size++;
}
}
@@ -757,9 +773,8 @@ hc_sock_callback(hc_sock_t * s, hc_data_t ** pdata)
for (;;) {
int n = hc_sock_recv(s);
- if (n == 0) {
+ if (n == 0)
goto ERR_EOF;
- }
if (n < 0) {
switch(errno) {
case ECONNRESET:
@@ -858,7 +873,7 @@ hc_execute_command(hc_sock_t * s, hc_msg_t * msg, size_t msg_len,
}
int seq = hc_sock_get_next_seq(s);
-
+
/* Create state used to process the request */
hc_sock_request_t * request = NULL;
request = hc_sock_request_create(seq, data, params->parse);
@@ -887,7 +902,10 @@ hc_execute_command(hc_sock_t * s, hc_msg_t * msg, size_t msg_len,
* several times before success... shall we alternate between blocking
* and non-blocking mode ?
*/
- if (hc_sock_recv(s) < 0)
+ int n = hc_sock_recv(s);
+ if (n == 0)
+ goto ERR_EOF;
+ if (n < 0)
continue; //break;
int rc = hc_sock_process(s, pdata);
switch(rc) {
@@ -898,15 +916,18 @@ hc_execute_command(hc_sock_t * s, hc_msg_t * msg, size_t msg_len,
break;
case -99:
ERROR("[hc_execute_command] Error processing socket results");
- goto ERR_PROCESS;
+ goto ERR;
break;
default:
ERROR("[hc_execute_command] Unexpected return value");
- goto ERR_PROCESS;
+ goto ERR;
}
}
+ERR_EOF:
ret = data->ret;
+ if (!data->complete)
+ return -1;
if (!pdata)
hc_data_free(data);
@@ -915,6 +936,7 @@ hc_execute_command(hc_sock_t * s, hc_msg_t * msg, size_t msg_len,
ERR_PROCESS:
ERR_MAP:
hc_sock_request_free(request);
+ERR:
ERR_REQUEST:
hc_data_free(data);
ERR_DATA:
@@ -1939,12 +1961,16 @@ hc_route_parse(void * in, hc_route_t * route)
{
list_routes_command * cmd = (list_routes_command *) in;
- if (!IS_VALID_ADDR_TYPE(cmd->addressType))
- return -1;
+ if (!IS_VALID_ADDR_TYPE(cmd->addressType)) {
+ ERROR("[hc_route_parse] Invalid address type");
+ return -1;
+ }
int family = map_from_addr_type[cmd->addressType];
- if (!IS_VALID_FAMILY(family))
- return -1;
+ if (!IS_VALID_FAMILY(family)) {
+ ERROR("[hc_route_parse] Invalid address family");
+ return -1;
+ }
*route = (hc_route_t) {
.face_id = cmd->connid,
diff --git a/hicn-light/src/hicn/config/configuration.c b/hicn-light/src/hicn/config/configuration.c
index 52dbf7a47..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;
@@ -364,7 +369,7 @@ struct iovec *configuration_ProcessCreateTunnel(Configuration *config,
if (symbolicNameTable_Exists(config->symbolicNameTable, symbolicName)) {
logger_Log(config->logger, LoggerFacility_Config, PARCLogLevel_Error,
- __func__, "Listener symbolic name already exists");
+ __func__, "Connection symbolic name already exists");
goto ERR;
}
diff --git a/hicn-light/src/hicn/content_store/contentStoreLRU.c b/hicn-light/src/hicn/content_store/contentStoreLRU.c
index 847d7a90e..76a2c8659 100644
--- a/hicn-light/src/hicn/content_store/contentStoreLRU.c
+++ b/hicn-light/src/hicn/content_store/contentStoreLRU.c
@@ -240,6 +240,11 @@ static bool _contentStoreLRU_PutContent(ContentStoreInterface *storeImpl,
return false;
}
+ ContentStoreEntry *storeEntry = parcHashCodeTable_Get(store->storageByName, content);
+ if(storeEntry){
+ _contentStoreLRU_PurgeStoreEntry(store, storeEntry);
+ }
+
uint64_t expiryTimeTicks = contentStoreEntry_MaxExpiryTime;
if (message_HasContentExpiryTime(content)) {
diff --git a/hicn-light/src/hicn/core/mapme.c b/hicn-light/src/hicn/core/mapme.c
index d5475f229..a0a34e8ce 100644
--- a/hicn-light/src/hicn/core/mapme.c
+++ b/hicn-light/src/hicn/core/mapme.c
@@ -338,6 +338,10 @@ static bool mapme_setFacePending(const MapMe *mapme, const Name *name,
Dispatcher *dispatcher = forwarder_GetDispatcher(mapme->forwarder);
PARCEventTimer *timer;
+ /* Safeguard during retransmissions */
+ if (!TFIB(fibEntry))
+ return true;
+
/*
* On the producer side, we have to clear the TFIB everytime we change the list
* of adjacencies, otherwise retransmissions will occur to preserve them.
@@ -347,28 +351,30 @@ static bool mapme_setFacePending(const MapMe *mapme, const Name *name,
* It is likely we cannot iterator and remove elements from the hashmap at
* the same time, so we proceed in two steps
*/
- NumberSet * conns = numberSet_Create();
+ if (parcHashMap_Size(TFIB(fibEntry)->nexthops) > 0) {
- PARCIterator *it = parcHashMap_CreateKeyIterator(TFIB(fibEntry)->nexthops);
- while (parcIterator_HasNext(it)) {
- PARCUnsigned *cid = parcIterator_Next(it);
- unsigned conn_id = parcUnsigned_GetUnsigned(cid);
- numberSet_Add(conns, conn_id);
- }
- parcIterator_Release(&it);
+ NumberSet * conns = numberSet_Create();
- for (size_t i = 0; i < numberSet_Length(conns); i++) {
- unsigned conn_id = numberSet_GetItem(conns, i);
- PARCEventTimer *oldTimer = (PARCEventTimer *)mapmeTFIB_Get(TFIB(fibEntry), conn_id);
- if (oldTimer)
+ PARCIterator *it = parcHashMap_CreateKeyIterator(TFIB(fibEntry)->nexthops);
+ while (parcIterator_HasNext(it)) {
+ PARCUnsigned *cid = parcIterator_Next(it);
+ unsigned conn_id = parcUnsigned_GetUnsigned(cid);
+ numberSet_Add(conns, conn_id);
+ }
+ parcIterator_Release(&it);
+
+ for (size_t i = 0; i < numberSet_Length(conns); i++) {
+ unsigned conn_id = numberSet_GetItem(conns, i);
+ PARCEventTimer *oldTimer = (PARCEventTimer *)mapmeTFIB_Get(TFIB(fibEntry), conn_id);
+ if (oldTimer)
parcEventTimer_Stop(oldTimer);
- mapmeTFIB_Remove(TFIB(fibEntry), conn_id);
- }
+ mapmeTFIB_Remove(TFIB(fibEntry), conn_id);
+ }
- numberSet_Release(&conns);
+ numberSet_Release(&conns);
+ }
}
-
// NOTE
// - at producer, send always true, we always send something reliably so we
// set the timer.
@@ -566,6 +572,9 @@ mapme_onConnectionEvent(const MapMe *mapme, const Connection *conn_added, connec
FibEntry *fibEntry = (FibEntry *)fibEntryList_Get(fiblist, i);
mapme_reconsiderFibEntry(mapme, fibEntry);
}
+
+ fibEntryList_Destroy(&fiblist);
+
INFO(mapme, "[MAP-Me] Done");
}
@@ -647,6 +656,9 @@ static bool mapme_onSpecialInterest(const MapMe *mapme,
FibEntry *fibEntry = fib_Contains(fib, name);
if (!fibEntry) {
+ INFO(mapme, "Ignored update with no FIB entry");
+ return 0;
+#if 0
INFO(mapme,
"[MAP-Me] - Re-creating FIB entry with next hop on connection %d",
conn_in_id);
@@ -685,6 +697,7 @@ static bool mapme_onSpecialInterest(const MapMe *mapme,
for (size_t i = 0; i < numberSet_Length(lpm_nexthops); i++) {
fibEntry_AddNexthop(fibEntry, numberSet_GetItem(lpm_nexthops, i));
}
+#endif
} else if (!TFIB(fibEntry)) {
/* Create TFIB associated to FIB entry */
diff --git a/hicn-light/src/hicn/processor/fib.c b/hicn-light/src/hicn/processor/fib.c
index 6bb29c404..c67bc6773 100644
--- a/hicn-light/src/hicn/processor/fib.c
+++ b/hicn-light/src/hicn/processor/fib.c
@@ -424,8 +424,10 @@ void fib_Remove(FIB *fib, const Name *name, unsigned connId) {
}
fibEntry_RemoveNexthopByConnectionId(entry, connId);
+#ifndef WITH_MAPME
if (fibEntry_NexthopCount(entry) == 0)
_removeNode(fib, name);
+#endif /* WITH_MAPME */
}
@@ -434,9 +436,11 @@ void _removeConnectionId(FibNode *n, unsigned connectionId,
if(n != NULL){
if(n->is_used){
fibEntry_RemoveNexthopByConnectionId(n->entry, connectionId);
+#ifndef WITH_MAPME
if (fibEntry_NexthopCount(n->entry) == 0) {
fibEntryList_Append(list, n->entry);
}
+#endif /* WITH_MAPME */
}
_removeConnectionId(n->right, connectionId, list);
_removeConnectionId(n->left, connectionId, list);
diff --git a/hicn-light/src/hicn/strategies/loadBalancer.c b/hicn-light/src/hicn/strategies/loadBalancer.c
index e3f377791..35d64e763 100644
--- a/hicn-light/src/hicn/strategies/loadBalancer.c
+++ b/hicn-light/src/hicn/strategies/loadBalancer.c
@@ -344,22 +344,23 @@ static void _strategyLoadBalancer_ImplDestroy(StrategyImpl **strategyPtr) {
StrategyImpl *impl = *strategyPtr;
StrategyLoadBalancer *strategy = (StrategyLoadBalancer *)impl->context;
+ if (parcHashMap_Size(strategy->strategy_state) > 0) {
+ PARCIterator *it = parcHashMap_CreateKeyIterator(strategy->strategy_state);
+ while (parcIterator_HasNext(it)) {
+ PARCUnsigned *cid = parcIterator_Next(it);
+ StrategyNexthopState *state =
+ (StrategyNexthopState *) parcHashMap_Get(strategy->strategy_state, cid);
+ parcObject_Release((void **) &state);
+ }
+ parcIterator_Release(&it);
- PARCIterator *it = parcHashMap_CreateKeyIterator(strategy->strategy_state);
- while (parcIterator_HasNext(it)) {
- PARCUnsigned *cid = parcIterator_Next(it);
- StrategyNexthopState *state =
- (StrategyNexthopState *)parcHashMap_Get(strategy->strategy_state, cid);
- parcObject_Release((void**)&state);
- }
- parcIterator_Release(&it);
-
- parcHashMap_Release(&(strategy->strategy_state));
+ parcHashMap_Release(&(strategy->strategy_state));
#ifndef WITH_POLICY
- numberSet_Release(&(strategy->nexthops));
+ numberSet_Release(&(strategy->nexthops));
#endif /* ! WITH_POLICY */
- parcMemory_Deallocate((void **)&strategy);
- parcMemory_Deallocate((void **)&impl);
- *strategyPtr = NULL;
+ parcMemory_Deallocate((void **) &strategy);
+ parcMemory_Deallocate((void **) &impl);
+ *strategyPtr = NULL;
+ }
}
diff --git a/hicn-plugin/CMakeLists.txt b/hicn-plugin/CMakeLists.txt
index 01ac26c7c..e8347c150 100644
--- a/hicn-plugin/CMakeLists.txt
+++ b/hicn-plugin/CMakeLists.txt
@@ -222,16 +222,16 @@ execute_process(
COMMAND
bash -c
"if [ ! -e ${CMAKE_CURRENT_BINARY_DIR}/vapi_json_parser.py ]; then
- curl https://git.fd.io/vpp/plain/src/vpp-api/vapi/vapi_json_parser.py?h=stable/1908 -o ${CMAKE_CURRENT_BINARY_DIR}/vapi_json_parser.py;
+ curl https://raw.githubusercontent.com/FDio/vpp/stable/1908/src/vpp-api/vapi/vapi_json_parser.py -o ${CMAKE_CURRENT_BINARY_DIR}/vapi_json_parser.py;
fi;
if [ ! -e ${CMAKE_CURRENT_BINARY_DIR}/vapi_c_gen.py ]; then
- curl https://git.fd.io/vpp/plain/src/vpp-api/vapi/vapi_c_gen.py?h=stable/1908 -o ${CMAKE_CURRENT_BINARY_DIR}/vapi_c_gen.py;
+ curl https://raw.githubusercontent.com/FDio/vpp/stable/1908/src/vpp-api/vapi/vapi_c_gen.py -o ${CMAKE_CURRENT_BINARY_DIR}/vapi_c_gen.py;
fi;
if [ ! -e ${CMAKE_CURRENT_BINARY_DIR}/vapi_cpp_gen.py ]; then
- curl https://git.fd.io/vpp/plain/src/vpp-api/vapi/vapi_cpp_gen.py?h=stable/1908 -o ${CMAKE_CURRENT_BINARY_DIR}/vapi_cpp_gen.py;
+ curl https://raw.githubusercontent.com/FDio/vpp/stable/1908/src/vpp-api/vapi/vapi_cpp_gen.py -o ${CMAKE_CURRENT_BINARY_DIR}/vapi_cpp_gen.py;
fi;
if [ ! -e ${CMAKE_CURRENT_BINARY_DIR}/vnet/ip/ip_types.api ]; then
- curl https://git.fd.io/vpp/plain/src/vnet/ip/ip_types.api?h=stable/1908 -o ${CMAKE_CURRENT_BINARY_DIR}/vnet/ip/ip_types.api;
+ curl https://raw.githubusercontent.com/FDio/vpp/stable/1908/src/vnet/ip/ip_types.api -o ${CMAKE_CURRENT_BINARY_DIR}/vnet/ip/ip_types.api;
fi;
chmod +x ${CMAKE_CURRENT_BINARY_DIR}/vapi_json_parser.py ${CMAKE_CURRENT_BINARY_DIR}/vapi_c_gen.py ${CMAKE_CURRENT_BINARY_DIR}/vapi_cpp_gen.py"
)
diff --git a/hicn-plugin/src/data_fwd_node.c b/hicn-plugin/src/data_fwd_node.c
index ca3baaa0d..1bb064fcf 100644
--- a/hicn-plugin/src/data_fwd_node.c
+++ b/hicn-plugin/src/data_fwd_node.c
@@ -399,7 +399,7 @@ hicn_satisfy_faces (vlib_main_t * vm, u32 bi0,
* Mark the buffer as smaller than TWO_CL. It will be stored as is in the CS, without excluding
* the hicn_header. Cloning is not possible, it will be copied.
*/
- if (b0->current_length < (buffer_advance + (CLIB_CACHE_LINE_BYTES * 2)))
+ if (b0->current_length <= (buffer_advance + (CLIB_CACHE_LINE_BYTES * 2)))
{
/* In this case the packet is copied. We don't need to add a reference as no buffer are
* chained to it.
diff --git a/hicn-plugin/src/data_push_node.c b/hicn-plugin/src/data_push_node.c
index ff28b4dea..21ebae16f 100644
--- a/hicn-plugin/src/data_push_node.c
+++ b/hicn-plugin/src/data_push_node.c
@@ -74,7 +74,7 @@ prep_buffer_for_cs (vlib_main_t * vm, vlib_buffer_t * b0, u8 isv6)
* Mark the buffer as smaller than TWO_CL. It will be stored as is in the CS, without excluding
* the hicn_header. Cloning is not possible, it will be copied.
*/
- if (b0->current_length < (buffer_advance + (CLIB_CACHE_LINE_BYTES * 2)))
+ if (b0->current_length <= (buffer_advance + (CLIB_CACHE_LINE_BYTES * 2)))
{
/* In this case the packet is copied. We don't need to add a reference as no buffer are
* chained to it.
diff --git a/hicn-plugin/src/strategy.c b/hicn-plugin/src/strategy.c
index 62c2ddc8b..15c0dc720 100644
--- a/hicn-plugin/src/strategy.c
+++ b/hicn-plugin/src/strategy.c
@@ -117,6 +117,9 @@ hicn_new_interest (hicn_strategy_runtime_t * rt, vlib_buffer_t * b0,
hicn_store_internal_state (b0, hicnb0->name_hash, node_id0,
dpo_ctx_id0, vft_id0, hash_entry_id,
bucket_id, bucket_is_overflow);
+ // We need to take a lock as the lock is not taken on the hash
+ // entry because it is a CS entry (hash_insert function).
+ hash_entry->locks++;
*next =
is_cs0 ? HICN_STRATEGY_NEXT_INTEREST_HITCS :
HICN_STRATEGY_NEXT_INTEREST_HITPIT;