aboutsummaryrefslogtreecommitdiffstats
path: root/hicn-light
diff options
context:
space:
mode:
authorMichele Papalini <micpapal@cisco.com>2020-01-21 16:48:00 +0000
committerGerrit Code Review <gerrit@fd.io>2020-01-21 16:48:00 +0000
commitbf366088b56e7f2e793e7026d9c655e26fe4a67a (patch)
tree8ffbec1e68088a2c6b0441f9f4db340be2f4f264 /hicn-light
parent50bedb707155de675121a556a8b129280440cdf5 (diff)
parent67c757c4d22a9983d4a87a4ce2476d00c464fc72 (diff)
Merge "[HICN-481] Add APIs to trigger MAP-Me updates"
Diffstat (limited to 'hicn-light')
-rw-r--r--hicn-light/src/hicn/core/mapme.c42
-rw-r--r--hicn-light/src/hicn/core/mapme.h10
-rw-r--r--hicn-light/src/hicn/processor/fibEntry.c2
-rw-r--r--hicn-light/src/hicn/processor/fibEntry.h2
4 files changed, 35 insertions, 21 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);
}
diff --git a/hicn-light/src/hicn/core/mapme.h b/hicn-light/src/hicn/core/mapme.h
index 81977ab2e..503b22568 100644
--- a/hicn-light/src/hicn/core/mapme.h
+++ b/hicn-light/src/hicn/core/mapme.h
@@ -69,6 +69,16 @@ void mapme_Process(const MapMe *mapme, const uint8_t *msgBuffer,
unsigned conn_id);
/**
+ * @function mapme_send_updates
+ * @abstract Trigger the update for specified FIB entry and nexthops
+ * @param [in] mapme - Pointer to the MAP-Me data structure.
+ * @param [in] fibEntry - The FIB entry to consider
+ * @param [in] nexthops - NumberSet holding the next hops on which to send the
+ * update.
+ */
+void mapme_send_updates(const MapMe * mapme, FibEntry * fibEntry, const NumberSet * nexthops);
+
+/**
* @function mapme_reconsiderFibEntry
* @abstract Process a fib entry for changes that might trigger new updates
* @param [in] mapme - Pointer to the MAP-Me data structure.
diff --git a/hicn-light/src/hicn/processor/fibEntry.c b/hicn-light/src/hicn/processor/fibEntry.c
index be7278987..2c41f1c7b 100644
--- a/hicn-light/src/hicn/processor/fibEntry.c
+++ b/hicn-light/src/hicn/processor/fibEntry.c
@@ -478,7 +478,7 @@ fibEntry_GetPreviousNextHops(const FibEntry *fibEntry)
#endif /* WITH_POLICY */
void
-fibEntry_SetPreviousNextHops(FibEntry *fibEntry, NumberSet * nexthops)
+fibEntry_SetPreviousNextHops(FibEntry *fibEntry, const NumberSet * nexthops)
{
if (fibEntry->previous_nexthops)
numberSet_Release(&fibEntry->previous_nexthops);
diff --git a/hicn-light/src/hicn/processor/fibEntry.h b/hicn-light/src/hicn/processor/fibEntry.h
index 1bd917bc2..13f002eb9 100644
--- a/hicn-light/src/hicn/processor/fibEntry.h
+++ b/hicn-light/src/hicn/processor/fibEntry.h
@@ -121,7 +121,7 @@ void fibEntry_SetPolicy(FibEntry *fibEntry, policy_t policy);
void fibEntry_UpdateStats(FibEntry *fibEntry, uint64_t now);
NumberSet * fibEntry_GetAvailableNextHops(const FibEntry *fibEntry, unsigned in_connection);
NumberSet * fibEntry_GetPreviousNextHops(const FibEntry *fibEntry);
-void fibEntry_SetPreviousNextHops(FibEntry *fibEntry, NumberSet * nexthops);
+void fibEntry_SetPreviousNextHops(FibEntry *fibEntry, const NumberSet * nexthops);
void fibEntry_OnTimeout(FibEntry *fibEntry, const NumberSet *egressId);
const NumberSet *fibEntry_GetNexthopsFromForwardingStrategy(