Switch role logic in rde_aspa_validity() since this may need to be extended.
authorclaudio <claudio@openbsd.org>
Tue, 28 Mar 2023 08:32:42 +0000 (08:32 +0000)
committerclaudio <claudio@openbsd.org>
Tue, 28 Mar 2023 08:32:42 +0000 (08:32 +0000)
OK tb@ mbuhl@

usr.sbin/bgpd/rde.c

index d8cb4b9..8d7897e 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: rde.c,v 1.597 2023/03/21 14:52:36 claudio Exp $ */
+/*     $OpenBSD: rde.c,v 1.598 2023/03/28 08:32:42 claudio Exp $ */
 
 /*
  * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -2525,15 +2525,15 @@ rde_aspa_validity(struct rde_peer *peer, struct rde_aspath *asp, uint8_t aid)
 
        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 */
        }