[11/15] mka: Fix a few minor bugs in CP state machine

Message ID 20180302201103.16264-12-msiedzik@extremenetworks.com
State New
Headers show
Series
  • MKA bugfixes and enhancements
Related show

Commit Message

Michael Siedzik March 2, 2018, 8:10 p.m.
From: Mike Siedzik <msiedzik@extremenetworks.com>

All fixes per IEEE802.1X-2010 Figure 12-2 - CP state machine.

1) Upon entering RETIRE, deleteSAs(oki)
2) RECEIVING to TRANSMIT, add !controlledPortEnabled to branching logic
3) READY should move to ABANDON (not RECEIVE) when new_sak or
   changed_connect is true.
4) READY to TRANSMIT, add !controlledPortEnabled to branching logic

Signed-off-by: Michael Siedzik <msiedzik@extremenetworks.com>
---
 src/pae/ieee802_1x_cp.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

--
2.11.1

Patch

diff --git a/src/pae/ieee802_1x_cp.c b/src/pae/ieee802_1x_cp.c
index e6b2767e2..05eab7e4b 100644
--- a/src/pae/ieee802_1x_cp.c
+++ b/src/pae/ieee802_1x_cp.c
@@ -319,8 +319,11 @@  SM_STATE(CP, RETIRE)
        SM_ENTRY(CP, RETIRE);
        /* RETIRE state machine not keep with Figure 12-2 in
         * IEEE Std 802.1X-2010 */
-       os_free(sm->oki);
-       sm->oki = NULL;
+       if (sm->oki) {
+               ieee802_1x_kay_delete_sas(sm->kay, sm->oki);
+               os_free(sm->oki);
+               sm->oki = NULL;
+       }
        sm->orx = FALSE;
        sm->otx = FALSE;
        ieee802_1x_kay_set_old_sa_attr(sm->kay, sm->oki, sm->oan,
@@ -382,7 +385,7 @@  SM_STEP(CP)
                if (!sm->elected_self)
                        SM_ENTER(CP, READY);
                if (sm->elected_self &&
-                   (sm->all_receiving || !sm->transmit_when))
+                   (sm->all_receiving || !sm->controlled_port_enabled || !sm->transmit_when))
                        SM_ENTER(CP, TRANSMIT);
                break;

@@ -405,8 +408,8 @@  SM_STEP(CP)

        case CP_READY:
                if (sm->new_sak || changed_connect(sm))
-                       SM_ENTER(CP, RECEIVE);
-               if (sm->server_transmitting)
+                       SM_ENTER(CP, ABANDON);
+               if (sm->server_transmitting || !sm->controlled_port_enabled)
                        SM_ENTER(CP, TRANSMIT);
                break;
        case CP_ABANDON: