summaryrefslogtreecommitdiffstats
path: root/hicn-light/src/hicn/core/mapme.c
diff options
context:
space:
mode:
Diffstat (limited to 'hicn-light/src/hicn/core/mapme.c')
-rw-r--r--hicn-light/src/hicn/core/mapme.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/hicn-light/src/hicn/core/mapme.c b/hicn-light/src/hicn/core/mapme.c
index e426e7575..93a01bb0d 100644
--- a/hicn-light/src/hicn/core/mapme.c
+++ b/hicn-light/src/hicn/core/mapme.c
@@ -480,29 +480,16 @@ static bool mapme_hasLocalNextHops(const MapMe *mapme,
}
void
-mapme_reconsiderFibEntry(const MapMe *mapme, FibEntry * fibEntry)
+mapme_send_updates(const MapMe * mapme, FibEntry * fibEntry, const NumberSet * nexthops)
{
- /*
- * Skip entries that do not correspond to a producer ( / have a locally
- * served prefix / have no local connection as next hop)
- */
- if (!mapme_hasLocalNextHops(mapme, fibEntry))
- return;
-
- /* Apply the policy of the fibEntry over all neighbours */
- NumberSet * available_nexthops = fibEntry_GetAvailableNextHops(fibEntry, ~0);
- NumberSet * previous_nexthops = fibEntry_GetPreviousNextHops(fibEntry);
-
/* Detect change */
- if (numberSet_Equals(available_nexthops, previous_nexthops)) {
- numberSet_Release(&available_nexthops);
+ NumberSet * previous_nexthops = fibEntry_GetPreviousNextHops(fibEntry);
+ if (numberSet_Equals(nexthops, previous_nexthops)) {
INFO(mapme, "[MAP-Me] No change in nexthops");
return;
}
- fibEntry_SetPreviousNextHops(fibEntry, available_nexthops);
-
+ fibEntry_SetPreviousNextHops(fibEntry, nexthops);
- /* Advertise prefix on all available next hops */
if (!TFIB(fibEntry)) /* Create TFIB associated to FIB entry */
mapme_CreateTFIB(fibEntry);
TFIB(fibEntry)->seq++;
@@ -510,14 +497,31 @@ mapme_reconsiderFibEntry(const MapMe *mapme, FibEntry * fibEntry)
const Name *name = fibEntry_GetPrefix(fibEntry);
char *name_str = name_ToString(name);
bool clear_tfib = true;
- for (size_t j = 0; j < numberSet_Length(available_nexthops); j++) {
- unsigned nexthop_id = numberSet_GetItem(available_nexthops, j);
+ for (size_t j = 0; j < numberSet_Length(nexthops); j++) {
+ unsigned nexthop_id = numberSet_GetItem(nexthops, j);
INFO(mapme, "[MAP-Me] sending IU/IN for name %s on connection %d", name_str,
nexthop_id);
mapme_setFacePending(mapme, name, fibEntry, nexthop_id, true, true, clear_tfib, 0);
clear_tfib = false;
}
free(name_str);
+}
+
+void
+mapme_reconsiderFibEntry(const MapMe *mapme, FibEntry * fibEntry)
+{
+ /*
+ * Skip entries that do not correspond to a producer ( / have a locally
+ * served prefix / have no local connection as next hop)
+ */
+ if (!mapme_hasLocalNextHops(mapme, fibEntry))
+ return;
+
+ /* Apply the policy of the fibEntry over all neighbours */
+ NumberSet * available_nexthops = fibEntry_GetAvailableNextHops(fibEntry, ~0);
+
+ /* Advertise prefix on all available next hops (if needed) */
+ mapme_send_updates(mapme, fibEntry, available_nexthops);
numberSet_Release(&available_nexthops);
}