diff options
author | Jordan Augé <jordan.auge+fdio@cisco.com> | 2020-01-21 13:47:18 +0100 |
---|---|---|
committer | Jordan Augé <jordan.auge+fdio@cisco.com> | 2020-01-21 13:47:18 +0100 |
commit | 67c757c4d22a9983d4a87a4ce2476d00c464fc72 (patch) | |
tree | 69bbd4bae0c160e17011a67b5c52344375879cce /hicn-light/src/hicn/core/mapme.c | |
parent | 43980f3096655df2b2ecec50e700dd6989b0e0d6 (diff) |
[HICN-481] Add APIs to trigger MAP-Me updates
Change-Id: I6faefcdcbd6a0e5786b57ca5403804a8fe31dd0d
Signed-off-by: Jordan Augé <jordan.auge+fdio@cisco.com>
Diffstat (limited to 'hicn-light/src/hicn/core/mapme.c')
-rw-r--r-- | hicn-light/src/hicn/core/mapme.c | 42 |
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); } |