Skip to content

Commit b7773b1

Browse files
authored
Merge pull request #132 from MichaelWasher/upgrade_chewie
BUGFIX: Fix EAP Response to Preemptive Requests from Chewie
2 parents 5648a1a + 5d18597 commit b7773b1

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

chewie/state_machines/eap_state_machine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ def event(self, event):
740740
# TODO remove and refactor code - Just placing here to separate main pipeline for internals of SM
741741
if (isinstance(event, EventPreemptiveEAPResponseMessageReceived)
742742
and event.preemptive_eap_id != self.current_id):
743-
self.logget.info("Resetting eap due to recieved response to preemtive request")
743+
self.logger.info("Resetting eap due to received response to preemtive request")
744744
self.eap_restart = True
745745
self.override_current_id = event.preemptive_eap_id
746746

test/test_chewie.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,42 @@ def test_success_dot1x(self):
343343
'00:00:00:00:00:01').state,
344344
FullEAPStateMachine.SUCCESS2)
345345

346+
347+
348+
349+
@patch_things
350+
@setup_generators(sup_replies_success, radius_replies_success)
351+
def test_chewie_identity_response_dot1x(self):
352+
"""test port status api and that identity request is sent after port up"""
353+
354+
global TO_SUPPLICANT
355+
pool = eventlet.GreenPool()
356+
pool.spawn(self.chewie.run)
357+
eventlet.sleep(1)
358+
self.chewie.port_down("00:00:00:00:00:01")
359+
360+
self.chewie.port_up("00:00:00:00:00:01")
361+
362+
while not self.fake_scheduler.jobs:
363+
eventlet.sleep(SHORT_SLEEP)
364+
self.fake_scheduler.run_jobs(num_jobs=1)
365+
366+
# check preemptive sent directly after port up
367+
out_packet = TO_SUPPLICANT.get()
368+
self.assertEqual(out_packet,
369+
bytes.fromhex('0180C2000003000000000001888e010000050167000501'))
370+
371+
# Send a response to the request
372+
FROM_SUPPLICANT.put_nowait(bytes.fromhex("0000000000010242ac17006f888e010000050167000501"))
373+
eventlet.sleep(2)
374+
375+
self.assertEqual(
376+
self.chewie.get_state_machine('02:42:ac:17:00:6f',
377+
'00:00:00:00:00:01').state,
378+
FullEAPStateMachine.AAA_IDLE)
379+
380+
381+
346382
@patch_things
347383
def test_port_status_changes(self):
348384
"""test port status api and that identity request is sent after port up"""

0 commit comments

Comments
 (0)