From: claudio Date: Tue, 1 Mar 2022 09:46:22 +0000 (+0000) Subject: Rewrite some comments to hopefully be easier to understand. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=591142c4598a6a0f1610de3339e87106e94adb53;p=openbsd Rewrite some comments to hopefully be easier to understand. No code change. --- diff --git a/usr.sbin/bgpd/rde_decide.c b/usr.sbin/bgpd/rde_decide.c index 9c427589b55..3a0f6eb7f1f 100644 --- a/usr.sbin/bgpd/rde_decide.c +++ b/usr.sbin/bgpd/rde_decide.c @@ -1,4 +1,4 @@ -/* $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 @@ -281,7 +281,7 @@ prefix_cmp(struct prefix *p1, struct prefix *p2, int *testall) 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; @@ -305,7 +305,7 @@ prefix_insert(struct prefix *new, struct prefix *ep, struct rib_entry *re) 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); @@ -339,10 +339,13 @@ prefix_insert(struct prefix *new, struct prefix *ep, struct rib_entry *re) } } 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;