auto-t: hostapd.py: separate GTK and PTK rekeys

REKEY_GTK kicks off the GTK only handshake where REKEY_PTK does
both (via the 4-way). The way this utility was written was causing
hostapd some major issues since both REKEY_GTK and REKEY_PTK was
used.

Instead if address is set only do REKEY_PTK. This will also rekey
the GTK via the 4-way handshake.

If no address is set do REKEY_GTK which will only rekey the GTK.
This commit is contained in:
James Prestwood 2021-10-07 13:49:54 -07:00 committed by Denis Kenzior
parent cc850d3a3d
commit f1b106f6eb
1 changed files with 7 additions and 3 deletions

View File

@ -202,11 +202,15 @@ class HostapdCLI(object):
cmd = self.cmdline + ['req_beacon', addr, request]
ctx.start_process(cmd).wait()
def rekey(self, address):
def rekey(self, address=None):
if address:
cmd = 'REKEY_PTK %s' % address
self.ctrl_sock.sendall(cmd.encode('utf-8'))
self.wait_for_event('EAPOL-4WAY-HS-COMPLETED')
return
cmd = 'REKEY_GTK'
self.ctrl_sock.sendall(cmd.encode('utf-8'))
cmd = 'REKEY_PTK %s' % address
self.ctrl_sock.sendall(cmd.encode('utf-8'))
@property
def bssid(self):