* differs from the rib/normal set of nexthops.
*/
#define ROUTE_ENTRY_USE_FIB_NHG 0x40
+/*
+ * Route entries that are going to the dplane for a Route Replace
+ * let's note the fact that this is happening. This will
+ * be useful when zebra is determing if a route can be
+ * used for nexthops
+ */
+#define ROUTE_ENTRY_ROUTE_REPLACING 0x80
/* Sequence value incremented for each dataplane operation */
uint32_t dplane_sequence;
resolved = 0;
- /* Only useful if installed */
- if (!CHECK_FLAG(match->status, ROUTE_ENTRY_INSTALLED)) {
+ /*
+ * Only useful if installed or being Route Replacing
+ * Why Being Route Replaced as well?
+ * Imagine a route A and route B( that depends on A )
+ * for recursive resolution and A already exists in the
+ * zebra rib. If zebra receives the routes
+ * for resolution at aproximately the same time in the [
+ * B, A ] order on the workQ. If this happens then
+ * normal route resolution will happen and B will be
+ * resolved successfully and then A will be resolved
+ * successfully. Now imagine the reversed order [A, B].
+ * A will be resolved and then scheduled for installed
+ * (Thus not having the ROUTE_ENTRY_INSTALLED flag ). B
+ * will then get resolved and fail to be installed
+ * because the original below test. Let's `loosen` this
+ * up a tiny bit and allow the
+ * ROUTE_ENTRY_ROUTE_REPLACING flag ( that is set when a
+ * Route Replace operation is being initiated on A now )
+ * to now satisfy this situation. This will allow
+ * either order in the workQ to work properly.
+ */
+ if (!CHECK_FLAG(match->status, ROUTE_ENTRY_INSTALLED) &&
+ !CHECK_FLAG(match->status,
+ ROUTE_ENTRY_ROUTE_REPLACING)) {
if (IS_ZEBRA_DEBUG_RIB_DETAILED)
zlog_debug(
- "%s: match %p (%pNG) not installed",
+ "%s: match %p (%pNG) not installed or being Route Replaced",
__func__, match, match->nhe);
goto done_with_match;
}
snprintfrr(
- buf, len, "%s%s%s%s%s%s%s",
+ buf, len, "%s%s%s%s%s%s%s%s",
CHECK_FLAG(re->status, ROUTE_ENTRY_REMOVED) ? "Removed " : "",
CHECK_FLAG(re->status, ROUTE_ENTRY_CHANGED) ? "Changed " : "",
CHECK_FLAG(re->status, ROUTE_ENTRY_LABELS_CHANGED)
? "Label Changed "
: "",
CHECK_FLAG(re->status, ROUTE_ENTRY_QUEUED) ? "Queued " : "",
+ CHECK_FLAG(re->status, ROUTE_ENTRY_ROUTE_REPLACING)
+ ? "Replacing"
+ : "",
CHECK_FLAG(re->status, ROUTE_ENTRY_INSTALLED) ? "Installed "
: "",
CHECK_FLAG(re->status, ROUTE_ENTRY_FAILED) ? "Failed " : "",
if (old) {
SET_FLAG(old->status, ROUTE_ENTRY_QUEUED);
+ SET_FLAG(re->status, ROUTE_ENTRY_ROUTE_REPLACING);
/* Free old FIB nexthop group */
UNSET_FLAG(old->status, ROUTE_ENTRY_USE_FIB_NHG);
SET_FLAG(re->status, ROUTE_ENTRY_INSTALLED);
UNSET_FLAG(re->status, ROUTE_ENTRY_QUEUED);
+ UNSET_FLAG(re->status, ROUTE_ENTRY_ROUTE_REPLACING);
for (ALL_NEXTHOPS(re->nhe->nhg, nhop)) {
if (CHECK_FLAG(nhop->flags, NEXTHOP_FLAG_RECURSIVE))
} else {
if (!zrouter.asic_offloaded ||
(CHECK_FLAG(re->flags, ZEBRA_FLAG_OFFLOADED) ||
- CHECK_FLAG(re->flags, ZEBRA_FLAG_OFFLOAD_FAILED)))
+ CHECK_FLAG(re->flags,
+ ZEBRA_FLAG_OFFLOAD_FAILED))) {
+ UNSET_FLAG(re->status,
+ ROUTE_ENTRY_ROUTE_REPLACING);
UNSET_FLAG(re->status, ROUTE_ENTRY_QUEUED);
+ }
}
}
}
/* Ensure we clear the QUEUED flag */
- if (!zrouter.asic_offloaded)
+ if (!zrouter.asic_offloaded) {
UNSET_FLAG(re->status, ROUTE_ENTRY_QUEUED);
+ UNSET_FLAG(re->status, ROUTE_ENTRY_ROUTE_REPLACING);
+ }
/* Is this a notification that ... matters? We mostly care about
* the route that is currently selected for installation; we may also