aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ctrl/facemgr/src/api.c61
-rw-r--r--hicn-light/src/hicn/config/controlAdd.c4
-rw-r--r--hicn-light/src/hicn/processor/fibEntry.c2
3 files changed, 65 insertions, 2 deletions
diff --git a/ctrl/facemgr/src/api.c b/ctrl/facemgr/src/api.c
index 4233c469b..ddda26338 100644
--- a/ctrl/facemgr/src/api.c
+++ b/ctrl/facemgr/src/api.c
@@ -19,8 +19,25 @@
*/
#ifdef __ANDROID__
+
+/*
+ * Use AndroidUtility to determine interface types
+ *
+ * NOTE: this is currently disabled as SDK APIs do not allow to determine the
+ * type of interfaces that are DOWN
+ */
//#define WITH_ANDROID_UTILITY
+
+/*
+ * Use priority controller interface
+ */
#define WITH_PRIORITY_CONTROLLER
+
+/*
+ * Allow priority setting before interface is actually created
+ */
+#define WITH_DEFAULT_PRIORITIES
+
#endif /* __ANDROID__ */
#include <assert.h>
@@ -135,6 +152,11 @@ struct facemgr_s {
/* Static facelets */
facelet_array_t * static_facelets;
+#ifdef WITH_DEFAULT_PRIORITIES
+ /* Default priorities */
+ u32 default_priority[NETDEVICE_TYPE_N+1];
+#endif /* WITH_DEFAULT_PRIORITIES */
+
/********************************************************/
/* Interfaces - Those should be fully replaced by a map */
@@ -210,6 +232,14 @@ facemgr_initialize(facemgr_t * facemgr)
facemgr->timer_fd = 0;
facemgr->cur_static_id = 0;
+#ifdef WITH_DEFAULT_PRIORITIES
+
+#define _(x) facemgr->default_priority[NETDEVICE_TYPE_ ## x] = 0;
+foreach_netdevice_type
+#undef _
+
+#endif /* WITH_DEFAULT_PRIORITIES */
+
return 0;
ERR_CFG:
@@ -1657,6 +1687,19 @@ int
facemgr_process_facelet_create_no_family(facemgr_t * facemgr, facelet_t * facelet)
{
+#ifdef WITH_DEFAULT_PRIORITIES
+ /* Assign default priority based on face type */
+ netdevice_type_t netdevice_type = NETDEVICE_TYPE_UNDEFINED;
+ if (facelet_get_netdevice_type(facelet, &netdevice_type) < 0) {
+ ERROR("[facemgr_process_facelet_create_no_family] Error getting netdevice_type: no default priority set.");
+ goto ERR_PRIORITY;
+ }
+ if (facelet_set_priority(facelet, facemgr->default_priority[netdevice_type]) < 0) {
+ ERROR("[facemgr_process_facelet_create_no_family] Error setting default priority");
+ }
+ERR_PRIORITY:
+#endif /* WITH_DEFAULT_PRIORITIES */
+
DEBUG("[facemgr_process_facelet_create_no_family] Default v4");
/* Create default v4 and v6 facelets */
facelet_t * facelet_v4 = facelet_dup(facelet);
@@ -1845,6 +1888,24 @@ facemgr_on_event(facemgr_t * facemgr, facelet_t * facelet_in)
/* Might be because we previously ignored the facelet... */
//ERROR("[facemgr_on_event] Unexpected UPDATE... face does not exist");
//goto ERR;
+
+#ifdef WITH_DEFAULT_PRIORITIES
+ if (facelet_has_netdevice_type(facelet_in) && !facelet_has_netdevice(facelet_in) && facelet_has_priority(facelet_in)) {
+ /* Remember last priority choice for newly created facelets */
+ netdevice_type_t netdevice_type = NETDEVICE_TYPE_UNDEFINED;
+ u32 priority = 0;
+ if (facelet_get_netdevice_type(facelet_in, &netdevice_type) < 0) {
+ ERROR("[facelet_on_event] Error getting netdevice_type");
+ goto ERR;
+ }
+ if (facelet_get_priority(facelet_in, &priority) < 0) {
+ ERROR("[facelet_on_event] Error getting priority");
+ goto ERR;
+ }
+ facemgr->default_priority[netdevice_type] = priority;
+ }
+#endif /* WITH_DEFAULT_PRIORITIES */
+
DEBUG("[facemgr_on_event] UPDATE NEW %s", facelet_s);
INFO("Ignored UPDATE for non-existing face");
break;
diff --git a/hicn-light/src/hicn/config/controlAdd.c b/hicn-light/src/hicn/config/controlAdd.c
index 519e11e40..e10b56e99 100644
--- a/hicn-light/src/hicn/config/controlAdd.c
+++ b/hicn-light/src/hicn/config/controlAdd.c
@@ -72,9 +72,9 @@ static CommandReturn _controlAdd_HelpExecute(CommandParser *parser,
printf(" %s\n", ops_add_route->command);
printf(" %s\n", ops_add_punting->command);
printf(" %s\n", ops_add_listener->command);
-#ifdef WITH_POLICIES
+#ifdef WITH_POLICY
printf(" %s\n", ops_add_policy->command);
-#endif /* WITH_POLICIES */
+#endif /* WITH_POLICY */
printf("\n");
commandOps_Destroy(&ops_add_connection);
diff --git a/hicn-light/src/hicn/processor/fibEntry.c b/hicn-light/src/hicn/processor/fibEntry.c
index 46917a9d2..fe32ada8d 100644
--- a/hicn-light/src/hicn/processor/fibEntry.c
+++ b/hicn-light/src/hicn/processor/fibEntry.c
@@ -249,10 +249,12 @@ fibEntry_GetAvailableNextHops(const FibEntry *fibEntry, unsigned in_connection)
numberSet_Add(available_nexthops, conn_id);
}
+ /* Terminate selection if there are any local face available */
if (numberSet_Length(available_nexthops) > 0){
if(dealloc_nexthops){
numberSet_Release(&nexthops);
}
+ /* No filtering as all local faces are considered equivalent */
return available_nexthops;
}
}