From e09c227661bd7b67f00d4ec85290507aa1f96ac9 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Mon, 17 Jan 2022 01:36:03 +0600 Subject: [PATCH] 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. --- sedbgmux.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sedbgmux.py b/sedbgmux.py index dd4194e..38ec71c 100644 --- a/sedbgmux.py +++ b/sedbgmux.py @@ -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