I think flipping the logic around makes the statements easier to read.
Also we may need to add an extra role for siblings which behave like
customers (using the downstream algorithm result).

-- 
:wq Claudio

Index: rde.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde.c,v
retrieving revision 1.597
diff -u -p -r1.597 rde.c
--- rde.c       21 Mar 2023 14:52:36 -0000      1.597
+++ rde.c       27 Mar 2023 09:16:49 -0000
@@ -2525,15 +2525,15 @@ rde_aspa_validity(struct rde_peer *peer,
 
        switch (aid) {
        case AID_INET:
-               if (peer->role != ROLE_CUSTOMER)
-                       return asp->aspa_state.onlyup_v4;
-               else
+               if (peer->role == ROLE_CUSTOMER)
                        return asp->aspa_state.downup_v4;
-       case AID_INET6:
-               if (peer->role != ROLE_CUSTOMER)
-                       return asp->aspa_state.onlyup_v6;
                else
+                       return asp->aspa_state.onlyup_v4;
+       case AID_INET6:
+               if (peer->role == ROLE_CUSTOMER)
                        return asp->aspa_state.downup_v6;
+               else
+                       return asp->aspa_state.onlyup_v6;
        default:
                return ASPA_NEVER_KNOWN;        /* not reachable */
        }

Reply via email to