SEDbgMuxApp: handle ConnEstablished with DPRef=0xffff

This format string found in firmware image of a modem:

  DebugMux[DL,HandleConnectReq] Could not find DPRef 0x%04X;
                                sending Connect Response with ConnRef=0xFFFF

gives us a hint on what happens when ConnEstablish message contains
an unknown DPRef that was not announced or has became inactive.
This commit is contained in:
Vadim Yanitskiy 2022-01-17 01:36:03 +06:00 committed by Vadim Yanitskiy
parent 4d19f594c3
commit e09c227661
1 changed files with 5 additions and 0 deletions

View File

@ -124,6 +124,11 @@ class SEDbgMuxApp(cmd2.Cmd):
f = self.peer.recv()
assert(f['MsgType'] == DbgMuxFrame.MsgType.ConnEstablished)
ConnRef = DbgMuxFrame.MsgConnEstablished.parse(f['MsgData'])['ConnRef']
if ConnRef == 0xffff:
log.warning("Connection failed: unknown DPRef=0x%04x?", opts.DPRef)
self.peer.send(DbgMuxFrame.MsgType.Ack)
return
log.info("Connection established (ConnRef=0x%04x)", ConnRef)
# Read the messages