-/* $OpenBSD: rde_decide.c,v 1.87 2022/02/06 09:51:19 claudio Exp $ */
+/* $OpenBSD: rde_decide.c,v 1.88 2022/03/01 09:46:22 claudio Exp $ */
/*
* Copyright (c) 2003, 2004 Claudio Jeker <claudio@openbsd.org>
if (i > 0)
return -1;
- /* XXX RFC7911 does not specify this but it is needed. */
+ /* RFC7911 does not specify this but something like this is needed. */
/* 13. lowest path identifier wins */
if (p1->path_id < p2->path_id)
return 1;
struct prefix *xp, *np, *tailp = NULL, *insertp = ep;
int testall, selected = 0;
- /* start scan at the entry point (ep) or if the head if ep == NULL */
+ /* start scan at the entry point (ep) or the head if ep == NULL */
if (ep == NULL)
ep = LIST_FIRST(&re->prefix_h);
}
} else {
/*
- * p is less preferred, remember insertion point
- * If p got selected during a testall traverse
- * do not alter the insertion point unless this
- * happened on an actual MED check.
+ * xp is preferred over new.
+ * Remember insertion point for later unless the
+ * traverse is just looking for a possible MED
+ * inversion (selected == 1).
+ * If the last comparison's tie-breaker was the MED
+ * check reset selected and with it insertp since
+ * this was an actual MED priority inversion.
*/
if (testall == 2)
selected = 0;