Skip to content

libmbim-glib,device: ignore messages with wrong MBIM message type

The Cinterion mPLS62-w may end up sending messages which are clearly not well formatted MBIM messages, and upon receiving one of them, the mbim-proxy would get completely stuck (e.g. attempting to read a message of >800MB because of the reported length in the first malformed messae).

Try to avoid this, by doing an initial filter by message type, which at least solves the seen problem. Not a fully robust fix yet, though.

E.g. new logs:

[23 jun 2020, 10:43:49] [Debug] [/dev/cdc-wdm1] Sent message (translated)...
<<<<<< Header:
<<<<<<   length      = 48
<<<<<<   type        = command (0x00000003)
<<<<<<   transaction = 20
<<<<<< Fragment header:
<<<<<<   total   = 1
<<<<<<   current = 0
<<<<<< Contents:
<<<<<<   service = 'atds' (5967bdcc-7fd2-49a2-9f5c-b2e70e527db3)
<<<<<<   cid     = 'location' (0x00000002)
<<<<<<   type    = 'query' (0x00000000)

[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 293 bytes in MBIM stream as message type validation fails
[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 200 bytes in MBIM stream as message type validation fails
[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 168 bytes in MBIM stream as message type validation fails
[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 311 bytes in MBIM stream as message type validation fails
[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 311 bytes in MBIM stream as message type validation fails
[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 311 bytes in MBIM stream as message type validation fails
[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 335 bytes in MBIM stream as message type validation fails
[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 277 bytes in MBIM stream as message type validation fails
[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 312 bytes in MBIM stream as message type validation fails
[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 314 bytes in MBIM stream as message type validation fails
[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 312 bytes in MBIM stream as message type validation fails
[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 280 bytes in MBIM stream as message type validation fails
[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 312 bytes in MBIM stream as message type validation fails
[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 312 bytes in MBIM stream as message type validation fails
[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 326 bytes in MBIM stream as message type validation fails
[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 260 bytes in MBIM stream as message type validation fails
[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 244 bytes in MBIM stream as message type validation fails
[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 326 bytes in MBIM stream as message type validation fails
[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 326 bytes in MBIM stream as message type validation fails
[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 326 bytes in MBIM stream as message type validation fails
[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 306 bytes in MBIM stream as message type validation fails
[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 334 bytes in MBIM stream as message type validation fails
[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 324 bytes in MBIM stream as message type validation fails
[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 356 bytes in MBIM stream as message type validation fails
[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 356 bytes in MBIM stream as message type validation fails
[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 191 bytes in MBIM stream as message type validation fails
[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 201 bytes in MBIM stream as message type validation fails
[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 356 bytes in MBIM stream as message type validation fails
[23 jun 2020, 10:43:49] -Warning ** [/dev/cdc-wdm1] discarding 356 bytes in MBIM stream as message type validation fails

Merge request reports