aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ctrl/facemgr/includes/hicn/facemgr/facelet.h3
-rw-r--r--ctrl/facemgr/src/api.c175
-rw-r--r--ctrl/facemgr/src/facelet.c70
-rw-r--r--ctrl/facemgr/src/interfaces/android_utility/android_utility.c2
-rw-r--r--ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c4
-rw-r--r--ctrl/facemgr/src/interfaces/netlink/netlink.c10
-rw-r--r--ctrl/facemgr/src/interfaces/priority_controller/priority_controller.c4
-rw-r--r--ctrl/facemgr/src/interfaces/updown/updown.c2
-rw-r--r--ctrl/libhicnctrl/src/api.c4
-rw-r--r--hicn-plugin/src/punt.c8
-rw-r--r--lib/includes/hicn/util/set.h28
-rw-r--r--libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc2
-rw-r--r--libtransport/src/hicn/transport/protocols/rtc.h4
13 files changed, 173 insertions, 143 deletions
diff --git a/ctrl/facemgr/includes/hicn/facemgr/facelet.h b/ctrl/facemgr/includes/hicn/facemgr/facelet.h
index 355af551d..cfdc5540e 100644
--- a/ctrl/facemgr/includes/hicn/facemgr/facelet.h
+++ b/ctrl/facemgr/includes/hicn/facemgr/facelet.h
@@ -226,6 +226,7 @@ facelet_t * facelet_create();
facelet_t * facelet_create_from_netdevice(netdevice_t * netdevice);
+unsigned facelet_get_id(facelet_t * facelet);
void facelet_set_id(facelet_t * facelet, unsigned id);
int facelet_validate_face(const facelet_t * facelet);
@@ -271,6 +272,7 @@ int facelet_merge(facelet_t * facelet, facelet_t * facelet_to_merge);
facelet_status_t facelet_get_status(const facelet_t * facelet);
void facelet_set_status(facelet_t * facelet, facelet_status_t status);
+void facelet_set_attr_clean(facelet_t * facelet);
void facelet_set_error(facelet_t * facelet, facelet_error_reason_t reason);
void facelet_unset_error(facelet_t * facelet);
@@ -287,6 +289,7 @@ void facelet_set_event(facelet_t * facelet, facelet_event_t event);
int facelet_add_route(facelet_t * facelet, hicn_route_t * route);
int facelet_remove_route(facelet_t * facelet, hicn_route_t * route, hicn_route_t ** route_removed);
+int facelet_clear_routes(facelet_t * facelet);
int facelet_get_route_array(const facelet_t * facelet, hicn_route_t *** route_array);
int facelet_snprintf(char * buf, size_t size, const facelet_t * facelet);
diff --git a/ctrl/facemgr/src/api.c b/ctrl/facemgr/src/api.c
index d9bba43a9..ac436a433 100644
--- a/ctrl/facemgr/src/api.c
+++ b/ctrl/facemgr/src/api.c
@@ -303,7 +303,8 @@ facemgr_set_config(facemgr_t * facemgr, facemgr_cfg_t * cfg)
} else {
for (unsigned i = 0; i < n; i++) {
facelet_t * facelet = facelet_dup(facelet_array[i]);
- facelet_set_status(facelet, FACELET_STATUS_CLEAN);
+ facelet_set_status(facelet, FACELET_STATUS_UNDEFINED);
+ facelet_set_attr_clean(facelet);
if (facelet_array_add(facemgr->static_facelets, facelet)) {
ERROR("[facemgr_finalize] Could not add static facelet to face manager");
}
@@ -1087,28 +1088,33 @@ facemgr_process_facelet(facemgr_t * facemgr, facelet_t * facelet)
goto ERR;
}
- if (facelet_set_remove(facemgr->facelet_cache, facelet, NULL) < 0) {
- ERROR("[facemgr_process_facelet] Could not remove deleted facelet from cache");
- goto ERR;
- }
- facelet_free(facelet);
- goto END;
-
+ /* Facelets created from static get deleted */
#if 0
- /* This works assuming the call to hicn-light is blocking */
- DEBUG("[facemgr_process_facelet] Cleaning cached data");
- facelet_unset_local_addr(facelet);
- facelet_unset_local_port(facelet);
- facelet_unset_remote_addr(facelet);
- facelet_unset_remote_port(facelet);
- facelet_unset_admin_state(facelet);
- facelet_unset_state(facelet);
- facelet_unset_bj_done(facelet);
+ if (facelet_get_id(facelet) > 0) {
+ if (facelet_set_remove(facemgr->facelet_cache, facelet, NULL) < 0) {
+ ERROR("[facemgr_process_facelet] Could not remove deleted facelet from cache");
+ return -1;
+ }
+ facelet_free(facelet);
+ } else {
+#endif
+ /* This works assuming the call to hicn-light is blocking */
+ DEBUG("[facemgr_process_facelet] Cleaning cached data");
+ facelet_unset_local_addr(facelet);
+ facelet_unset_local_port(facelet);
+ facelet_unset_remote_addr(facelet);
+ facelet_unset_remote_port(facelet);
+ facelet_unset_admin_state(facelet);
+ facelet_unset_state(facelet);
+ facelet_unset_bj_done(facelet);
+ facelet_clear_routes(facelet);
#ifdef WITH_ANDROID_UTILITY
- facelet_unset_au_done(facelet);
+ facelet_unset_au_done(facelet);
#endif /* WITH_ANDROID_UTILITY */
- facelet_set_status(facelet, FACELET_STATUS_DELETED);
+ facelet_set_status(facelet, FACELET_STATUS_DELETED);
+#if 0
+ }
#endif
break;
@@ -1126,7 +1132,6 @@ facemgr_process_facelet(facemgr_t * facemgr, facelet_t * facelet)
}
facelet_unset_error(facelet);
-END:
return 0;
ERR:
@@ -1207,11 +1212,15 @@ facemgr_start_reattempts(facemgr_t * facemgr)
int
facemgr_process_facelet_create(facemgr_t * facemgr, facelet_t * facelet)
{
+ char facelet_s[MAXSZ_FACELET];
+ facelet_snprintf(facelet_s, MAXSZ_FACELET, facelet);
+ DEBUG("[facemgr_process_facelet_create] %s", facelet_s);
switch(facelet_get_status(facelet)) {
case FACELET_STATUS_UNCERTAIN:
case FACELET_STATUS_INCOMPLETE:
case FACELET_STATUS_CREATE:
/* No change */
+ DEBUG("[facemgr_process_facelet_create] UNCHANGED STATUS");
break;
case FACELET_STATUS_UPDATE:
case FACELET_STATUS_DELETE:
@@ -1222,6 +1231,7 @@ facemgr_process_facelet_create(facemgr_t * facemgr, facelet_t * facelet)
* correctly if the face is still present.
* TODO What if some fields have been updated ?
*/
+ DEBUG("[facemgr_process_facelet_create] SET STATUS TO CREATE");
facelet_set_status(facelet, FACELET_STATUS_CREATE);
break;
case FACELET_STATUS_CLEAN:
@@ -1230,6 +1240,7 @@ facemgr_process_facelet_create(facemgr_t * facemgr, facelet_t * facelet)
* We should have nothing to do unless some fields have
* been updated.
*/
+ DEBUG("[facemgr_process_facelet_create] NOTHING TO DO");
break;
case FACELET_STATUS_DOWN:
@@ -1239,6 +1250,7 @@ facemgr_process_facelet_create(facemgr_t * facemgr, facelet_t * facelet)
* missing information, and proceed to face creation.
* Rule changes should be handled separately.
*/
+ DEBUG("[facemgr_process_facelet_create] SET STATUS TO INCOMPLETE");
facelet_set_status(facelet, FACELET_STATUS_INCOMPLETE);
break;
case FACELET_STATUS_UNDEFINED:
@@ -1247,6 +1259,8 @@ facemgr_process_facelet_create(facemgr_t * facemgr, facelet_t * facelet)
return -1;
}
+
+ DEBUG("[facemgr_process_facelet_create] Processing facelet");
if (facemgr_process_facelet(facemgr, facelet) < 0) {
ERROR("[facemgr_process_facelet_create] Error processing facelet");
return -1;
@@ -1315,6 +1329,8 @@ facemgr_consider_static_facelet(facemgr_t * facemgr, facelet_t * facelet)
if (facelet_found)
return 0;
+ facelet_set_id(static_facelet, ++facemgr->cur_static_id);
+
if (facelet_array_add(facemgr->static_facelets, static_facelet) < 0) {
ERROR("[facemgr_consider_static_facelet] Could not add facelet to static array");
facelet_free(static_facelet);
@@ -1432,14 +1448,19 @@ facemgr_process_facelet_get(facemgr_t * facemgr, facelet_t * facelet)
int
facemgr_process_facelet_update(facemgr_t * facemgr, facelet_t * facelet)
{
+ char facelet_s[MAXSZ_FACELET];
+ facelet_snprintf(facelet_s, MAXSZ_FACELET, facelet);
+ DEBUG("[facemgr_process_facelet_update] %s", facelet_s);
switch(facelet_get_status(facelet)) {
case FACELET_STATUS_UNCERTAIN:
case FACELET_STATUS_INCOMPLETE:
case FACELET_STATUS_CREATE:
case FACELET_STATUS_UPDATE:
/* No change */
+ DEBUG("[facemgr_process_facelet_update] UNCHANGED STATUS");
break;
case FACELET_STATUS_CLEAN:
+ DEBUG("[facemgr_process_facelet_update] SET STATUS TO UPDATE");
facelet_set_status(facelet, FACELET_STATUS_UPDATE);
break;
case FACELET_STATUS_DOWN:
@@ -1447,6 +1468,7 @@ facemgr_process_facelet_update(facemgr_t * facemgr, facelet_t * facelet)
case FACELET_STATUS_DELETED:
case FACELET_STATUS_IGNORED:
/* Reconsider face creation in light of new information */
+ DEBUG("[facemgr_process_facelet_update] SET STATUS TO UNCERTAIN");
facelet_set_status(facelet, FACELET_STATUS_UNCERTAIN);
break;
case FACELET_STATUS_UNDEFINED:
@@ -1455,6 +1477,7 @@ facemgr_process_facelet_update(facemgr_t * facemgr, facelet_t * facelet)
return -1;
}
+ DEBUG("[facemgr_process_facelet_update] Processing facelet");
if (facemgr_process_facelet(facemgr, facelet) < 0) {
ERROR("[facemgr_process_facelet_update] Error processing facelet");
return -1;
@@ -1478,77 +1501,59 @@ facemgr_process_facelet_delete(facemgr_t * facemgr, facelet_t * facelet)
case FACELET_STATUS_INCOMPLETE:
case FACELET_STATUS_IGNORED:
case FACELET_STATUS_DOWN:
- if (facelet_set_remove(facemgr->facelet_cache, facelet, NULL) < 0) {
- ERROR("[facemgr_process_facelet] Could not remove deleted facelet from cache");
- return -1;
- }
-
- facelet_free(facelet);
- return 0;
+ case FACELET_STATUS_CREATE:
#if 0
- facelet_unset_local_addr(facelet);
- facelet_unset_local_port(facelet);
- facelet_unset_remote_addr(facelet);
- facelet_unset_remote_port(facelet);
- facelet_unset_bj_done(facelet);
+ /* Facelets created from static get deleted */
+ if (facelet_get_id(facelet) > 0) {
+ if (facelet_set_remove(facemgr->facelet_cache, facelet, NULL) < 0) {
+ ERROR("[facemgr_process_facelet] Could not remove deleted facelet from cache");
+ return -1;
+ }
+ facelet_free(facelet);
+ } else {
+#endif
+ /* Face has not been created */
+ DEBUG("[facemgr_process_facelet] Cleaning cached data");
+ facelet_unset_local_addr(facelet);
+ facelet_unset_local_port(facelet);
+ facelet_unset_remote_addr(facelet);
+ facelet_unset_remote_port(facelet);
+ facelet_unset_admin_state(facelet);
+ facelet_unset_state(facelet);
+ facelet_unset_bj_done(facelet);
+ facelet_clear_routes(facelet);
#ifdef WITH_ANDROID_UTILITY
- facelet_unset_au_done(facelet);
+ facelet_unset_au_done(facelet);
#endif /* WITH_ANDROID_UTILITY */
- facelet_set_status(facelet, FACELET_STATUS_DELETED);
+ facelet_unset_error(facelet);
+ facelet_set_status(facelet, FACELET_STATUS_DELETED);
+#if 0
+ }
#endif
break;
- case FACELET_STATUS_CREATE:
+
case FACELET_STATUS_UPDATE:
case FACELET_STATUS_CLEAN:
facelet_set_status(facelet, FACELET_STATUS_DELETE);
+ if (facemgr_process_facelet(facemgr, facelet) < 0) {
+ ERROR("[facemgr_process_facelet_delete] Error processing facelet");
+ return -1;
+ }
break;
+
case FACELET_STATUS_DELETE:
case FACELET_STATUS_DELETED:
/* Nothing to do */
- DEBUG("%s\n", facelet_status_str[facelet_get_status(facelet)]);
break;
+
case FACELET_STATUS_UNDEFINED:
case FACELET_STATUS_N:
ERROR("[facemgr_process_facelet_delete] Unexpected facelet status");
return -1;
}
- if (facemgr_process_facelet(facemgr, facelet) < 0) {
- ERROR("[facemgr_process_facelet_delete] Error processing facelet");
- return -1;
- }
-
- return 0;
-}
-
-#if 0
-int facemgr_process_facelet_first_time(facemgr_t * facemgr, facelet_t * facelet)
-{
- assert(facelet);
-
- facelet_set_status(facelet, FACELET_STATUS_UNCERTAIN);
- char facelet_s[MAXSZ_FACELET];
- facelet_snprintf(facelet_s, MAXSZ_FACELET, facelet);
- if (facelet_set_add(facemgr->facelet_cache, facelet) < 0) {
- ERROR("[facemgr_process_facelet_first_time] Error adding facelet to cache");
- goto ERR_CACHE;
- }
-
- if (facemgr_process_facelet_create(facemgr, facelet) < 0) {
- ERROR("[facemgr_process_facelet_first_time] Error processing facelet CREATE event");
- goto ERR_CREATE;
- }
-
return 0;
-
-ERR_CREATE:
- if (facelet_set_remove(facemgr->facelet_cache, facelet, NULL) < 0) {
- ERROR("[facemgr_process_facelet_first_time] Error removing failed facelet from cache");
- }
-ERR_CACHE:
- return -1;
}
-#endif
int facemgr_on_event(facemgr_t * facemgr, facelet_t * facelet);
@@ -1563,10 +1568,10 @@ facemgr_process_facelet_create_no_family(facemgr_t * facemgr, facelet_t * facele
ERROR("[facemgr_process_facelet_create_no_family] Error allocating default IPv4 face");
} else {
facelet_set_family(facelet_v4, AF_INET);
- facelet_set_status(facelet_v4, FACELET_STATUS_CLEAN);
+ facelet_set_attr_clean(facelet_v4);
if (facemgr_on_event(facemgr, facelet_v4) < 0) {
ERROR("[facemgr_process_facelet_create_no_family] Error creating default IPv4 face");
- facelet_free(facelet_v4);
+ //facelet_free(facelet_v4);
}
}
@@ -1576,10 +1581,10 @@ facemgr_process_facelet_create_no_family(facemgr_t * facemgr, facelet_t * facele
ERROR("[facemgr_process_facelet_create_no_family] Error allocating default IPv6 face");
} else {
facelet_set_family(facelet_v6, AF_INET6);
- facelet_set_status(facelet_v6, FACELET_STATUS_CLEAN);
+ facelet_set_attr_clean(facelet_v6);
if (facemgr_on_event(facemgr, facelet_v6) < 0) {
ERROR("[facemgr_process_facelet_create_no_family] Error creating default IPv6 face");
- facelet_free(facelet_v6);
+ //facelet_free(facelet_v6);
}
}
@@ -1618,13 +1623,14 @@ facemgr_process_facelet_create_no_family(facemgr_t * facemgr, facelet_t * facele
facelet_free(facelet_new);
continue;
}
+ facelet_set_id(facelet_new, facelet_get_id(static_facelet));
/* The id must be different than 0 */
- facelet_set_id(facelet_new, ++facemgr->cur_static_id);
- facelet_set_status(facelet_new, FACELET_STATUS_CLEAN);
+ facelet_set_attr_clean(facelet_new);
+ facelet_set_status(facelet, FACELET_STATUS_UNDEFINED);
if (facemgr_on_event(facemgr, facelet_new) < 0) {
ERROR("[facemgr_process_facelet_create_no_family] Error creating default IPv6 face");
- facelet_free(facelet_new);
+ //facelet_free(facelet_new);
}
}
}
@@ -1668,6 +1674,10 @@ facemgr_on_event(facemgr_t * facemgr, facelet_t * facelet_in)
facelet_t ** cached_facelets = NULL;
assert(facelet_in);
+ if (facelet_get_status(facelet_in) == FACELET_STATUS_UNDEFINED) {
+ facelet_set_status(facelet_in, FACELET_STATUS_UNCERTAIN);
+ }
+
int n = facelet_cache_lookup(facemgr->facelet_cache, facelet_in, &cached_facelets);
if (n < 0) {
ERROR("[facemgr_on_event] Error during cache lookup");
@@ -1687,6 +1697,7 @@ facemgr_on_event(facemgr_t * facemgr, facelet_t * facelet_in)
* assignment
*/
DEBUG("[facemgr_on_event] CREATE NEW %s", facelet_s);
+
if (!facelet_has_family(facelet_in)) {
facemgr_assign_face_type(facemgr, facelet_in);
if (facemgr_process_facelet_create_no_family(facemgr, facelet_in) < 0) {
@@ -1696,8 +1707,6 @@ facemgr_on_event(facemgr_t * facemgr, facelet_t * facelet_in)
goto DUMP_CACHE;
}
- facelet_set_status(facelet_in, FACELET_STATUS_UNCERTAIN);
-
if (facelet_set_add(facemgr->facelet_cache, facelet_in) < 0) {
ERROR("[facemgr_on_event] Error adding facelet to cache");
goto ERR;
@@ -1715,7 +1724,7 @@ facemgr_on_event(facemgr_t * facemgr, facelet_t * facelet_in)
case FACELET_EVENT_GET:
/* Insert new facelet in cached */
- DEBUG("[facemgr_on_event] GET NEW %s", facelet_s);
+ //DEBUG("[facemgr_on_event] GET NEW %s", facelet_s);
rc = facemgr_process_facelet_get(facemgr, facelet_in);
if (rc == 0)
remove_facelet = false;
@@ -1794,7 +1803,7 @@ facemgr_on_event(facemgr_t * facemgr, facelet_t * facelet_in)
continue;
}
- if (facemgr_process_facelet_create(facemgr, facelet_in) < 0) {
+ if (facemgr_process_facelet_create(facemgr, facelet) < 0) {
ERROR("[facemgr_on_event] Error processing facelet CREATE event");
ret = -1;
}
@@ -1806,8 +1815,8 @@ facemgr_on_event(facemgr_t * facemgr, facelet_t * facelet_in)
* This happens due to polling of the forwarder (or when it
* restarts)
*/
- DEBUG("[facemgr_on_event] GET EXISTING %s", facelet_old_s);
- DEBUG(" WITH %s", facelet_s);
+ //DEBUG("[facemgr_on_event] GET EXISTING %s", facelet_old_s);
+ //DEBUG(" WITH %s", facelet_s);
//ERROR("[facemgr_on_event] GET event for a face that already exists...");
dump = false;
continue;
diff --git a/ctrl/facemgr/src/facelet.c b/ctrl/facemgr/src/facelet.c
index 2308f3b6d..ac84f5f70 100644
--- a/ctrl/facemgr/src/facelet.c
+++ b/ctrl/facemgr/src/facelet.c
@@ -149,6 +149,12 @@ ERR_MALLOC:
return NULL;
}
+unsigned
+facelet_get_id(facelet_t * facelet)
+{
+ return facelet->id;
+}
+
void
facelet_set_id(facelet_t * facelet, unsigned id)
{
@@ -378,18 +384,7 @@ void
facelet_free(facelet_t * facelet)
{
/* Free up routes */
- hicn_route_t ** route_array;
- int n = route_set_get_array(facelet->routes, &route_array);
- if (n < 0) {
- ERROR("[facelet_free] Error getting route set associated to facelet");
- } else {
- for (unsigned i = 0; i < n; i++) {
- hicn_route_t * route = route_array[i];
- route_set_remove(facelet->routes, route, NULL);
- hicn_route_free(route);
- }
- }
- free(route_array);
+ route_set_clear(facelet->routes);
route_set_free(facelet->routes);
free(facelet);
}
@@ -433,21 +428,8 @@ facelet_dup(const facelet_t * current_facelet)
return facelet;
ERR_ROUTE:
- {
- /* Free all routes */
- hicn_route_t ** new_route_array;
- int n = route_set_get_array(facelet->routes, &new_route_array);
- if (n < 0) {
- ERROR("[facelet_free] Error getting route set associated to facelet");
- } else {
- for (unsigned i = 0; i < n; i++) {
- hicn_route_t * new_route = new_route_array[i];
- hicn_route_free(new_route);
- }
- }
- free(route_array);
+ /* This will free all routes */
facelet_free(facelet);
- }
ERR_CREATE:
return NULL;
}
@@ -563,6 +545,14 @@ facelet_match(const facelet_t * facelet, const facelet_t * facelet_match)
#define _(TYPE, NAME) MATCH_ATTRIBUTE(TYPE, NAME);
foreach_facelet_attr
#undef _
+
+#if 0
+ char facelet_s[MAXSZ_FACELET];
+ facelet_snprintf(facelet_s, MAXSZ_FACELET, facelet_match);
+ DEBUG("MATCHED FACELET %s", facelet_s);
+ facelet_snprintf(facelet_s, MAXSZ_FACELET, facelet);
+ DEBUG(" WITH %s", facelet_s);
+#endif
return true;
}
@@ -721,8 +711,15 @@ int facelet_merge(facelet_t * facelet, facelet_t * facelet_to_merge)
ERROR("[facelet_free] Error getting route set associated to facelet");
} else {
for (unsigned i = 0; i < n; i++) {
- hicn_route_t * route = hicn_route_dup(route_array[i]);
- route_set_add(facelet->routes, route);
+ hicn_route_t * route = route_array[i];
+ hicn_route_t * route_found = NULL;
+ if (route_set_get(facelet->routes, route, &route_found) < 0) {
+ ERROR("Error searching for route");
+ continue;
+ }
+ if (route_found)
+ continue;
+ route_set_add(facelet->routes, hicn_route_dup(route));
}
}
free(route_array);
@@ -903,6 +900,12 @@ facelet_get_status(const facelet_t * facelet)
return facelet->status;
}
+void
+facelet_set_status(facelet_t * facelet, facelet_status_t status)
+{
+ facelet->status = status;
+}
+
#define SET_ATTR_STATUS_CLEAN(TYPE, NAME) \
do { \
if (facelet->NAME ## _status == FACELET_ATTR_STATUS_DIRTY) \
@@ -910,14 +913,11 @@ do { \
} while (0)
void
-facelet_set_status(facelet_t * facelet, facelet_status_t status)
+facelet_set_attr_clean(facelet_t * facelet)
{
- if (status == FACELET_STATUS_CLEAN) {
#define _(TYPE, NAME) SET_ATTR_STATUS_CLEAN(TYPE, NAME);
foreach_facelet_attr
#undef _
- }
- facelet->status = status;
}
void
@@ -1007,6 +1007,12 @@ facelet_remove_route(facelet_t * facelet, hicn_route_t * route, hicn_route_t **
}
int
+facelet_clear_routes(facelet_t * facelet)
+{
+ return route_set_clear(facelet->routes);
+}
+
+int
facelet_get_route_array(const facelet_t * facelet, hicn_route_t *** route_array)
{
return route_set_get_array(facelet->routes, route_array);
diff --git a/ctrl/facemgr/src/interfaces/android_utility/android_utility.c b/ctrl/facemgr/src/interfaces/android_utility/android_utility.c
index 47d3cd106..8eca6c2b0 100644
--- a/ctrl/facemgr/src/interfaces/android_utility/android_utility.c
+++ b/ctrl/facemgr/src/interfaces/android_utility/android_utility.c
@@ -119,7 +119,7 @@ int au_on_event(interface_t * interface, facelet_t * facelet)
facelet_t * facelet_new = facelet_create();
facelet_set_netdevice(facelet_new, netdevice);
- facelet_set_status(facelet_new, FACELET_STATUS_CLEAN);
+ facelet_set_attr_clean(facelet_new);
facelet_set_netdevice_type(facelet_new, netdevice_type);
facelet_set_event(facelet_new, FACELET_EVENT_UPDATE);
diff --git a/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c b/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c
index 71243aea1..b4e1f0695 100644
--- a/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c
+++ b/ctrl/facemgr/src/interfaces/hicn_light/hicn_light.c
@@ -108,6 +108,10 @@ int hl_process_state(interface_t * interface)
case HL_STATE_ROUTES_SENT:
case HL_STATE_FACES_SENT:
+ INFO("[hl_process_state] Out of sync... resetting state");
+ data->state = HL_STATE_IDLE;
+ break;
+
case HL_STATE_UNDEFINED:
case HL_STATE_N:
ERROR("[hl_process_state] Unexpected state");
diff --git a/ctrl/facemgr/src/interfaces/netlink/netlink.c b/ctrl/facemgr/src/interfaces/netlink/netlink.c
index 4d92f2511..b57a4e480 100644
--- a/ctrl/facemgr/src/interfaces/netlink/netlink.c
+++ b/ctrl/facemgr/src/interfaces/netlink/netlink.c
@@ -428,7 +428,7 @@ int nl_callback(interface_t * interface, int fd, void * unused)
DEBUG("Interface %s: address was removed", interface_name);
if (facelet) {
facelet_set_event(facelet, FACELET_EVENT_SET_DOWN);
- facelet_set_status(facelet, FACELET_STATUS_CLEAN);
+ facelet_set_attr_clean(facelet);
interface_raise_event(interface, facelet);
}
break;
@@ -450,7 +450,7 @@ int nl_callback(interface_t * interface, int fd, void * unused)
if (facelet) {
facelet_set_event(facelet, FACELET_EVENT_UPDATE);
- facelet_set_status(facelet, FACELET_STATUS_CLEAN);
+ facelet_set_attr_clean(facelet);
interface_raise_event(interface, facelet);
}
break;
@@ -474,7 +474,7 @@ int nl_callback(interface_t * interface, int fd, void * unused)
break;
facelet_set_event(facelet, FACELET_EVENT_DELETE);
- facelet_set_status(facelet, FACELET_STATUS_CLEAN);
+ facelet_set_attr_clean(facelet);
interface_raise_event(interface, facelet);
break;
@@ -505,7 +505,7 @@ int nl_callback(interface_t * interface, int fd, void * unused)
if (up && running) {
facelet_set_event(facelet, FACELET_EVENT_CREATE);
//facelet_set_family(facelet, AF_INET);
- facelet_set_status(facelet, FACELET_STATUS_CLEAN);
+ facelet_set_attr_clean(facelet);
interface_raise_event(interface, facelet);
#if 0
@@ -520,7 +520,7 @@ int nl_callback(interface_t * interface, int fd, void * unused)
} else {
#if 1
facelet_set_event(facelet, FACELET_EVENT_SET_DOWN);
- facelet_set_status(facelet, FACELET_STATUS_CLEAN);
+ facelet_set_attr_clean(facelet);
interface_raise_event(interface, facelet);
#else
facelet_free(facelet);
diff --git a/ctrl/facemgr/src/interfaces/priority_controller/priority_controller.c b/ctrl/facemgr/src/interfaces/priority_controller/priority_controller.c
index 5452c0e85..76538185f 100644
--- a/ctrl/facemgr/src/interfaces/priority_controller/priority_controller.c
+++ b/ctrl/facemgr/src/interfaces/priority_controller/priority_controller.c
@@ -115,8 +115,8 @@ int priority_controller_callback(interface_t * interface, int fd, void * unused)
facelet_t * facelet_c = facelet_create();
facelet_set_netdevice_type(facelet_w, NETDEVICE_TYPE_WIFI);
facelet_set_netdevice_type(facelet_c, NETDEVICE_TYPE_CELLULAR);
- facelet_set_status(facelet_w, FACELET_STATUS_CLEAN);
- facelet_set_status(facelet_c, FACELET_STATUS_CLEAN);
+ facelet_set_attr_clean(facelet_w);
+ facelet_set_attr_clean(facelet_c);
switch(buf[0]) {
case '\0':
facelet_set_priority(facelet_w, 0);
diff --git a/ctrl/facemgr/src/interfaces/updown/updown.c b/ctrl/facemgr/src/interfaces/updown/updown.c
index b804cdac1..7d305a5cd 100644
--- a/ctrl/facemgr/src/interfaces/updown/updown.c
+++ b/ctrl/facemgr/src/interfaces/updown/updown.c
@@ -118,7 +118,7 @@ int updown_callback(interface_t * interface, int fd, void * unused)
/* Raise facelet update event */
facelet_t * facelet = facelet_create();
facelet_set_netdevice_type(facelet, NETDEVICE_TYPE_WIFI); //CELLULAR);
- facelet_set_status(facelet, FACELET_STATUS_CLEAN);
+ facelet_set_attr_clean(facelet);
switch(buf[0]) {
case '\0':
facelet_set_admin_state(facelet, FACE_STATE_DOWN);
diff --git a/ctrl/libhicnctrl/src/api.c b/ctrl/libhicnctrl/src/api.c
index 8a81c6c5f..b836ef800 100644
--- a/ctrl/libhicnctrl/src/api.c
+++ b/ctrl/libhicnctrl/src/api.c
@@ -1896,7 +1896,7 @@ hc_route_delete_async(hc_sock_t * s, hc_route_t * route)
int
_hc_route_list(hc_sock_t * s, hc_data_t ** pdata, bool async)
{
- DEBUG("[hc_route_list] async=%s", BOOLSTR(async));
+ //DEBUG("[hc_route_list] async=%s", BOOLSTR(async));
struct {
header_control_message hdr;
@@ -2441,7 +2441,7 @@ hc_face_list(hc_sock_t * s, hc_data_t ** pdata)
hc_data_t * connection_data;
hc_face_t face;
- DEBUG("[hc_face_list]");
+ //DEBUG("[hc_face_list]");
if (hc_connection_list(s, &connection_data) < 0) {
ERROR("[hc_face_list] Could not list connections.");
diff --git a/hicn-plugin/src/punt.c b/hicn-plugin/src/punt.c
index bb0c076f7..74d4c1056 100644
--- a/hicn-plugin/src/punt.c
+++ b/hicn-plugin/src/punt.c
@@ -67,7 +67,7 @@ ip_version_t udp4_src_ipv6 = {
.addr_len_bits = IPV6_ADDR_LEN_BITS,
.protocol_field = &udp4_protocol,
.udp_sport = &udp4_sport,
- .ip_version = 0x60,
+ .ip_version = 0x40,
};
ip_version_t udp4_dst_ipv4 = {
@@ -83,7 +83,7 @@ ip_version_t udp4_dst_ipv6 = {
.addr_len_bits = IPV6_ADDR_LEN_BITS,
.protocol_field = &udp4_protocol,
.udp_dport = &udp4_dport,
- .ip_version = 0x60,
+ .ip_version = 0x40,
};
ip_version_t udp6_src_ipv4 = {
@@ -91,7 +91,7 @@ ip_version_t udp6_src_ipv4 = {
.addr_len_bits = IPV4_ADDR_LEN_BITS,
.protocol_field = &udp6_protocol,
.udp_sport = &udp6_sport,
- .ip_version = 0x40,
+ .ip_version = 0x60,
};
ip_version_t udp6_src_ipv6 = {
@@ -107,7 +107,7 @@ ip_version_t udp6_dst_ipv4 = {
.addr_len_bits = IPV4_ADDR_LEN_BITS,
.protocol_field = &udp6_protocol,
.udp_dport = &udp6_dport,
- .ip_version = 0x40,
+ .ip_version = 0x60,
};
ip_version_t udp6_dst_ipv6 = {
diff --git a/lib/includes/hicn/util/set.h b/lib/includes/hicn/util/set.h
index c7dd7bf09..b4673a673 100644
--- a/lib/includes/hicn/util/set.h
+++ b/lib/includes/hicn/util/set.h
@@ -77,6 +77,8 @@ int NAME ## _add(NAME ## _t * set, const T element); \
\
int NAME ## _remove(NAME ## _t * set, const T search, T * element); \
\
+int NAME ## _clear(NAME ## _t * set); \
+ \
int NAME ## _get(const NAME ## _t * set, const T search, T * element); \
\
int NAME ## _get_array(const NAME ## _t * set, T ** element); \
@@ -98,16 +100,7 @@ NAME ## _initialize(NAME ## _t * set) \
int \
NAME ## _finalize(NAME ## _t * set) \
{ \
- T * array; \
- int n = NAME ## _get_array(set, &array); \
- if (n < 0) \
- return -1; \
- for (unsigned i = 0; i < n; i++) { \
- T element = array[i]; \
- NAME ## _remove(set, element, NULL); \
- } \
- free(array); \
- return 0; \
+ return NAME ## _clear(set); \
} \
\
NAME ## _t * \
@@ -161,6 +154,21 @@ NAME ## _remove(NAME ## _t * set, const T search, T * element) \
} \
\
int \
+NAME ## _clear(NAME ## _t * set) \
+{ \
+ T * array; \
+ int n = NAME ## _get_array(set, &array); \
+ if (n < 0) \
+ return -1; \
+ for (unsigned i = 0; i < n; i++) { \
+ T element = array[i]; \
+ NAME ## _remove(set, element, NULL); \
+ } \
+ free(array); \
+ return 0; \
+} \
+ \
+int \
NAME ## _get(const NAME ## _t * set, const T search, T * element) \
{ \
T * found = tfind(search, &set->root, (cmp_t)CMP); \
diff --git a/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc b/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc
index f1057aa57..bb93e0535 100644
--- a/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc
+++ b/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc
@@ -183,8 +183,8 @@ void RTCProducerSocket::produce(std::unique_ptr<utils::MemBuf> &&buffer) {
// remove interests from the interest cache if it exists
// this generates nacks that will tell to the consumer
// that a new data packet was produced
+ utils::SpinLock::Acquire locked(interests_cache_lock_);
if (!seqs_map_.empty()) {
- utils::SpinLock::Acquire locked(interests_cache_lock_);
for (auto it = seqs_map_.begin(); it != seqs_map_.end(); it++) {
if (it->first != old_curr) sendNack(it->first);
}
diff --git a/libtransport/src/hicn/transport/protocols/rtc.h b/libtransport/src/hicn/transport/protocols/rtc.h
index 697459bb7..2b9ed10a6 100644
--- a/libtransport/src/hicn/transport/protocols/rtc.h
+++ b/libtransport/src/hicn/transport/protocols/rtc.h
@@ -55,8 +55,8 @@
#define HICN_INITIAL_CWIN 1 // packets
#define HICN_INITIAL_CWIN_MAX 100000 // packets
#define HICN_MIN_CWIN 10 // packets
-#define HICN_WIN_INCREASE_FACTOR 1.1
-#define HICN_WIN_DECREASE_FACTOR 0.8
+#define HICN_WIN_INCREASE_FACTOR 1.5
+#define HICN_WIN_DECREASE_FACTOR 0.9
// statistics constants
#define HICN_BANDWIDTH_SLACK_FACTOR 1.8