Sorry about sending the previous version without doing any runtime testing. I overlooked the fact that 'struct command_done_message' doesn't include the header like 'struct command_message' does, so the status field parsing was completely off...
BTW, is there a more appropriate mailing list where I should send stuff like this? Changes in v2: - fix the above bug - add command_id to the verbose command done output - fix IP config parsing (missed the prefix length) - add IPv6 configuration output - add support for non-default ip-types I don't really know how the last patch should be implemented. This version is simply a hack I made to be able to test the IPv6 config output. Please modify or drop as you find appropriate. Sample test runs with IPv6 and IPv4v6 contexts (please ignore the bogous IPv6 addresses - that's a bug in my modem firmware. This is tested on a Sierra Wireless EM7345): bjorn@nemi:/usr/local/src/git/umbim$ ./umbim -d /dev/cdc-wdm0 -n -v caps sending (16): 01 00 00 00 10 00 00 00 01 00 00 00 00 04 00 00 header_type: 0001 header_length: 0010 header_transaction: 0001 reading (16): 01 00 00 80 10 00 00 00 01 00 00 00 00 00 00 00 header_type: 80000001 header_length: 0010 header_transaction: 0001 sending (48): 03 00 00 00 30 00 00 00 02 00 00 00 01 00 00 00 00 00 00 00 a2 89 cc 33 bc bb 8b 4f b6 b0 13 3e c2 aa e6 df 01 00 00 00 00 00 00 00 00 00 00 00 header_type: 0003 header_length: 0030 header_transaction: 0002 reading (256): 03 00 00 80 00 01 00 00 02 00 00 00 01 00 00 00 00 00 00 00 a2 89 cc 33 bc bb 8b 4f b6 b0 13 3e c2 aa e6 df 01 00 00 00 00 00 00 00 d0 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 3f 00 00 00 03 00 00 00 01 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00 1e 00 00 00 60 00 00 00 34 00 00 00 94 00 00 00 3c 00 00 00 30 00 31 00 33 00 39 00 33 00 37 00 30 00 30 00 30 00 35 00 33 00 36 00 31 00 39 00 31 00 00 00 46 00 49 00 48 00 37 00 31 00 36 00 30 00 5f 00 56 00 31 00 2e 00 32 00 5f 00 57 00 57 00 5f 00 30 00 31 00 2e 00 31 00 34 00 31 00 35 00 2e 00 30 00 37 00 58 00 4d 00 4d 00 37 00 31 00 36 00 30 00 5f 00 56 00 31 00 2e 00 32 00 5f 00 4d 00 42 00 49 00 4d 00 5f 00 47 00 4e 00 53 00 53 00 5f 00 4e 00 41 00 4e 00 44 00 5f 00 52 00 45 00 header_type: 80000003 header_length: 0100 header_transaction: 0002 command_id: 0001 status_code: 0000 devicetype: 0001 - embedded cellularclass: 0001 voiceclass: 0001 - no-voice simclass: 0002 dataclass: 003F smscaps: 0003 controlcaps: 0001 maxsessions: 0010 deviceid: 013937000536191 firmwareinfo: FIH7160_V1.2_WW_01.1415.07 hardwareinfo: XMM7160_V1.2_MBIM_GNSS_NAND_RE bjorn@nemi:/usr/local/src/git/umbim$ ./umbim -d /dev/cdc-wdm0 -n -t 2 -v subscriber sending (48): 03 00 00 00 30 00 00 00 02 00 00 00 01 00 00 00 00 00 00 00 a2 89 cc 33 bc bb 8b 4f b6 b0 13 3e c2 aa e6 df 02 00 00 00 00 00 00 00 00 00 00 00 header_type: 0003 header_length: 0030 header_transaction: 0002 reading (148): 03 00 00 80 94 00 00 00 02 00 00 00 01 00 00 00 00 00 00 00 a2 89 cc 33 bc bb 8b 4f b6 b0 13 3e c2 aa e6 df 02 00 00 00 00 00 00 00 64 00 00 00 01 00 00 00 1c 00 00 00 1e 00 00 00 3c 00 00 00 28 00 00 00 00 00 00 00 00 00 00 00 32 00 34 00 32 00 30 00 31 00 33 00 30 00 35 00 30 00 31 00 33 00 38 00 31 00 39 00 30 00 00 00 38 00 39 00 34 00 37 00 30 00 33 00 30 00 35 00 31 00 32 00 31 00 30 00 31 00 31 00 30 00 30 00 38 00 31 00 39 00 35 00 header_type: 80000003 header_length: 0094 header_transaction: 0002 command_id: 0002 status_code: 0000 readystate: 0001 - initialized simiccid: 89470305121011008195 subscriberid: 242013050138190 bjorn@nemi:/usr/local/src/git/umbim$ ./umbim -d /dev/cdc-wdm0 -n -t 3 -v attach sending (52): 03 00 00 00 34 00 00 00 03 00 00 00 01 00 00 00 00 00 00 00 a2 89 cc 33 bc bb 8b 4f b6 b0 13 3e c2 aa e6 df 0a 00 00 00 01 00 00 00 04 00 00 00 00 00 00 00 header_type: 0003 header_length: 0034 header_transaction: 0003 reading (76): 03 00 00 80 4c 00 00 00 03 00 00 00 01 00 00 00 00 00 00 00 a2 89 cc 33 bc bb 8b 4f b6 b0 13 3e c2 aa e6 df 0a 00 00 00 00 00 00 00 1c 00 00 00 00 00 00 00 02 00 00 00 20 00 00 00 80 f0 fa 02 00 00 00 00 00 e1 f5 05 00 00 00 00 header_type: 80000003 header_length: 004C header_transaction: 0003 command_id: 000A status_code: 0000 nwerror: 0000 - unknown packetservicestate: 0002 - attached uplinkspeed: 50000000 downlinkspeed: 100000000 bjorn@nemi:/usr/local/src/git/umbim$ ./umbim -d /dev/cdc-wdm0 -n -t 4 -v connect ipv6:telenor.mobil sending (136): 03 00 00 00 88 00 00 00 04 00 00 00 01 00 00 00 00 00 00 00 a2 89 cc 33 bc bb 8b 4f b6 b0 13 3e c2 aa e6 df 0c 00 00 00 01 00 00 00 58 00 00 00 00 00 00 00 01 00 00 00 3c 00 00 00 1a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 7e 5e 2a 7e 4e 6f 72 72 73 6b 65 6e 7e 5e 2a 7e 74 00 65 00 6c 00 65 00 6e 00 6f 00 72 00 2e 00 6d 00 6f 00 62 00 69 00 6c 00 00 00 header_type: 0003 header_length: 0088 header_transaction: 0004 reading (84): 03 00 00 80 54 00 00 00 04 00 00 00 01 00 00 00 00 00 00 00 a2 89 cc 33 bc bb 8b 4f b6 b0 13 3e c2 aa e6 df 0c 00 00 00 00 00 00 00 24 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 02 00 00 00 7e 5e 2a 7e 4e 6f 72 72 73 6b 65 6e 7e 5e 2a 7e 00 00 00 00 header_type: 80000003 header_length: 0054 header_transaction: 0004 command_id: 000C status_code: 0000 sessionid: 0 activationstate: 0001 - activated voicecallstate: 0000 - none nwerror: 0000 - unknown iptype: 0002 - ipv6 bjorn@nemi:/usr/local/src/git/umbim$ ./umbim -d /dev/cdc-wdm0 -n -t 5 -v config sending (108): 03 00 00 00 6c 00 00 00 05 00 00 00 01 00 00 00 00 00 00 00 a2 89 cc 33 bc bb 8b 4f b6 b0 13 3e c2 aa e6 df 0f 00 00 00 00 00 00 00 3c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 header_type: 0003 header_length: 006C header_transaction: 0005 reading (176): 03 00 00 80 b0 00 00 00 05 00 00 00 01 00 00 00 00 00 00 00 a2 89 cc 33 bc bb 8b 4f b6 b0 13 3e c2 aa e6 df 0f 00 00 00 00 00 00 00 80 00 00 00 00 00 00 00 00 00 00 00 07 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 5c 00 00 00 00 00 00 00 70 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 3c 00 00 00 00 00 00 00 00 00 00 00 20 01 46 00 00 04 0f ff 00 00 00 00 00 00 00 54 20 01 46 00 00 04 1f ff 00 00 00 00 00 00 00 54 78 00 00 00 fe 80 00 00 00 00 00 00 00 00 00 2a fd 87 36 01 fe 80 00 00 00 00 00 00 00 00 00 2a fd 87 36 02 header_type: 80000003 header_length: 00B0 header_transaction: 0005 command_id: 000F status_code: 0000 ipv6address: fe80:0:0:0:0:2a:fd87:3601/120 ipv6gateway: fe80:0:0:0:0:2a:fd87:3602 ipv6dnsserver: 2001:4600:4:fff:0:0:0:54 ipv6dnsserver: 2001:4600:4:1fff:0:0:0:54 bjorn@nemi:/usr/local/src/git/umbim$ ./umbim -d /dev/cdc-wdm0 -t 6 -v disconnect sending (108): 03 00 00 00 6c 00 00 00 06 00 00 00 01 00 00 00 00 00 00 00 a2 89 cc 33 bc bb 8b 4f b6 b0 13 3e c2 aa e6 df 0c 00 00 00 01 00 00 00 3c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7e 5e 2a 7e 4e 6f 72 72 73 6b 65 6e 7e 5e 2a 7e header_type: 0003 header_length: 006C header_transaction: 0006 reading (84): 03 00 00 80 54 00 00 00 06 00 00 00 01 00 00 00 00 00 00 00 a2 89 cc 33 bc bb 8b 4f b6 b0 13 3e c2 aa e6 df 0c 00 00 00 00 00 00 00 24 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 02 00 00 00 7e 5e 2a 7e 4e 6f 72 72 73 6b 65 6e 7e 5e 2a 7e 00 00 00 00 header_type: 80000003 header_length: 0054 header_transaction: 0006 command_id: 000C status_code: 0000 sessionid: 0 activationstate: 0003 - deactivated voicecallstate: 0000 - none nwerror: 0000 - unknown iptype: 0002 - ipv6 sending (16): 02 00 00 00 10 00 00 00 07 00 00 00 01 00 00 00 header_type: 0002 header_length: 0010 header_transaction: 0007 reading (16): 02 00 00 80 10 00 00 00 07 00 00 00 00 00 00 00 header_type: 80000002 header_length: 0010 header_transaction: 0007 bjorn@nemi:/usr/local/src/git/umbim$ ./umbim -d /dev/cdc-wdm0 -n -v caps sending (16): 01 00 00 00 10 00 00 00 01 00 00 00 00 04 00 00 header_type: 0001 header_length: 0010 header_transaction: 0001 reading (16): 01 00 00 80 10 00 00 00 01 00 00 00 00 00 00 00 header_type: 80000001 header_length: 0010 header_transaction: 0001 sending (48): 03 00 00 00 30 00 00 00 02 00 00 00 01 00 00 00 00 00 00 00 a2 89 cc 33 bc bb 8b 4f b6 b0 13 3e c2 aa e6 df 01 00 00 00 00 00 00 00 00 00 00 00 header_type: 0003 header_length: 0030 header_transaction: 0002 reading (256): 03 00 00 80 00 01 00 00 02 00 00 00 01 00 00 00 00 00 00 00 a2 89 cc 33 bc bb 8b 4f b6 b0 13 3e c2 aa e6 df 01 00 00 00 00 00 00 00 d0 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 3f 00 00 00 03 00 00 00 01 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 40 00 00 00 1e 00 00 00 60 00 00 00 34 00 00 00 94 00 00 00 3c 00 00 00 30 00 31 00 33 00 39 00 33 00 37 00 30 00 30 00 30 00 35 00 33 00 36 00 31 00 39 00 31 00 00 00 46 00 49 00 48 00 37 00 31 00 36 00 30 00 5f 00 56 00 31 00 2e 00 32 00 5f 00 57 00 57 00 5f 00 30 00 31 00 2e 00 31 00 34 00 31 00 35 00 2e 00 30 00 37 00 58 00 4d 00 4d 00 37 00 31 00 36 00 30 00 5f 00 56 00 31 00 2e 00 32 00 5f 00 4d 00 42 00 49 00 4d 00 5f 00 47 00 4e 00 53 00 53 00 5f 00 4e 00 41 00 4e 00 44 00 5f 00 52 00 45 00 header_type: 80000003 header_length: 0100 header_transaction: 0002 command_id: 0001 status_code: 0000 devicetype: 0001 - embedded cellularclass: 0001 voiceclass: 0001 - no-voice simclass: 0002 dataclass: 003F smscaps: 0003 controlcaps: 0001 maxsessions: 0010 deviceid: 013937000536191 firmwareinfo: FIH7160_V1.2_WW_01.1415.07 hardwareinfo: XMM7160_V1.2_MBIM_GNSS_NAND_RE bjorn@nemi:/usr/local/src/git/umbim$ ./umbim -d /dev/cdc-wdm0 -n -t 2 -v subscriber sending (48): 03 00 00 00 30 00 00 00 02 00 00 00 01 00 00 00 00 00 00 00 a2 89 cc 33 bc bb 8b 4f b6 b0 13 3e c2 aa e6 df 02 00 00 00 00 00 00 00 00 00 00 00 header_type: 0003 header_length: 0030 header_transaction: 0002 reading (148): 03 00 00 80 94 00 00 00 02 00 00 00 01 00 00 00 00 00 00 00 a2 89 cc 33 bc bb 8b 4f b6 b0 13 3e c2 aa e6 df 02 00 00 00 00 00 00 00 64 00 00 00 01 00 00 00 1c 00 00 00 1e 00 00 00 3c 00 00 00 28 00 00 00 00 00 00 00 00 00 00 00 32 00 34 00 32 00 30 00 31 00 33 00 30 00 35 00 30 00 31 00 33 00 38 00 31 00 39 00 30 00 00 00 38 00 39 00 34 00 37 00 30 00 33 00 30 00 35 00 31 00 32 00 31 00 30 00 31 00 31 00 30 00 30 00 38 00 31 00 39 00 35 00 header_type: 80000003 header_length: 0094 header_transaction: 0002 command_id: 0002 status_code: 0000 readystate: 0001 - initialized simiccid: 89470305121011008195 subscriberid: 242013050138190 bjorn@nemi:/usr/local/src/git/umbim$ ./umbim -d /dev/cdc-wdm0 -n -t 3 -v attach sending (52): 03 00 00 00 34 00 00 00 03 00 00 00 01 00 00 00 00 00 00 00 a2 89 cc 33 bc bb 8b 4f b6 b0 13 3e c2 aa e6 df 0a 00 00 00 01 00 00 00 04 00 00 00 00 00 00 00 header_type: 0003 header_length: 0034 header_transaction: 0003 reading (76): 03 00 00 80 4c 00 00 00 03 00 00 00 01 00 00 00 00 00 00 00 a2 89 cc 33 bc bb 8b 4f b6 b0 13 3e c2 aa e6 df 0a 00 00 00 00 00 00 00 1c 00 00 00 00 00 00 00 02 00 00 00 20 00 00 00 80 f0 fa 02 00 00 00 00 00 e1 f5 05 00 00 00 00 header_type: 80000003 header_length: 004C header_transaction: 0003 command_id: 000A status_code: 0000 nwerror: 0000 - unknown packetservicestate: 0002 - attached uplinkspeed: 50000000 downlinkspeed: 100000000 bjorn@nemi:/usr/local/src/git/umbim$ ./umbim -d /dev/cdc-wdm0 -n -t 4 -v connect ipv4v6:telenor.smart sending (136): 03 00 00 00 88 00 00 00 04 00 00 00 01 00 00 00 00 00 00 00 a2 89 cc 33 bc bb 8b 4f b6 b0 13 3e c2 aa e6 df 0c 00 00 00 01 00 00 00 58 00 00 00 00 00 00 00 01 00 00 00 3c 00 00 00 1a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 00 00 00 7e 5e 2a 7e 4e 6f 72 72 73 6b 65 6e 7e 5e 2a 7e 74 00 65 00 6c 00 65 00 6e 00 6f 00 72 00 2e 00 73 00 6d 00 61 00 72 00 74 00 00 00 header_type: 0003 header_length: 0088 header_transaction: 0004 reading (72): 07 00 00 80 48 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 a2 89 cc 33 bc bb 8b 4f b6 b0 13 3e c2 aa e6 df 0a 00 00 00 1c 00 00 00 00 00 00 00 02 00 00 00 20 00 00 00 80 f0 fa 02 00 00 00 00 00 e1 f5 05 00 00 00 00 header_type: 80000007 header_length: 0048 header_transaction: 0000 reading (122): 07 00 00 80 7a 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 a2 89 cc 33 bc bb 8b 4f b6 b0 13 3e c2 aa e6 df 09 00 00 00 4e 00 00 00 00 00 00 00 03 00 00 00 01 00 00 00 20 00 00 00 01 00 00 00 30 00 00 00 0a 00 00 00 3c 00 00 00 12 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 32 00 34 00 32 00 30 00 31 00 00 00 4e 00 20 00 54 00 65 00 6c 00 65 00 6e 00 6f 00 72 00 header_type: 80000007 header_length: 007A header_transaction: 0000 reading (84): 03 00 00 80 54 00 00 00 04 00 00 00 01 00 00 00 00 00 00 00 a2 89 cc 33 bc bb 8b 4f b6 b0 13 3e c2 aa e6 df 0c 00 00 00 00 00 00 00 24 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 03 00 00 00 7e 5e 2a 7e 4e 6f 72 72 73 6b 65 6e 7e 5e 2a 7e 00 00 00 00 header_type: 80000003 header_length: 0054 header_transaction: 0004 command_id: 000C status_code: 0000 sessionid: 0 activationstate: 0001 - activated voicecallstate: 0000 - none nwerror: 0000 - unknown iptype: 0003 - ipv4v6 bjorn@nemi:/usr/local/src/git/umbim$ ./umbim -d /dev/cdc-wdm0 -n -t 5 -v config sending (108): 03 00 00 00 6c 00 00 00 05 00 00 00 01 00 00 00 00 00 00 00 a2 89 cc 33 bc bb 8b 4f b6 b0 13 3e c2 aa e6 df 0f 00 00 00 00 00 00 00 3c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 header_type: 0003 header_length: 006C header_transaction: 0005 reading (196): 03 00 00 80 c4 00 00 00 05 00 00 00 01 00 00 00 00 00 00 00 a2 89 cc 33 bc bb 8b 4f b6 b0 13 3e c2 aa e6 df 0f 00 00 00 00 00 00 00 94 00 00 00 00 00 00 00 07 00 00 00 07 00 00 00 01 00 00 00 64 00 00 00 01 00 00 00 70 00 00 00 6c 00 00 00 84 00 00 00 02 00 00 00 3c 00 00 00 02 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 c1 d5 70 04 82 43 0f c6 20 01 46 00 00 04 0f ff 00 00 00 00 00 00 00 52 20 01 46 00 00 04 1f ff 00 00 00 00 00 00 00 52 18 00 00 00 0a 8a 8a 04 0a 8a 8a 01 78 00 00 00 fe 80 00 00 00 00 00 00 00 00 00 2a fd 84 51 01 0a 8a 8a 04 fe 80 00 00 00 00 00 00 00 00 00 01 header_type: 80000003 header_length: 00C4 header_transaction: 0005 command_id: 000F status_code: 0000 ipv4address: 10.138.138.4/24 ipv4gateway: 10.138.138.1 ipv4dnsserver: 193.213.112.4 ipv4dnsserver: 130.67.15.198 ipv6address: fe80:0:0:0:0:2a:fd84:5101/120 ipv6gateway: a8a:8a04:fe80:0:0:0:0:1 ipv6dnsserver: 2001:4600:4:fff:0:0:0:52 ipv6dnsserver: 2001:4600:4:1fff:0:0:0:52 bjorn@nemi:/usr/local/src/git/umbim$ ./umbim -d /dev/cdc-wdm0 -t 6 -v disconnect sending (108): 03 00 00 00 6c 00 00 00 06 00 00 00 01 00 00 00 00 00 00 00 a2 89 cc 33 bc bb 8b 4f b6 b0 13 3e c2 aa e6 df 0c 00 00 00 01 00 00 00 3c 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7e 5e 2a 7e 4e 6f 72 72 73 6b 65 6e 7e 5e 2a 7e header_type: 0003 header_length: 006C header_transaction: 0006 reading (84): 03 00 00 80 54 00 00 00 06 00 00 00 01 00 00 00 00 00 00 00 a2 89 cc 33 bc bb 8b 4f b6 b0 13 3e c2 aa e6 df 0c 00 00 00 00 00 00 00 24 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 03 00 00 00 7e 5e 2a 7e 4e 6f 72 72 73 6b 65 6e 7e 5e 2a 7e 00 00 00 00 header_type: 80000003 header_length: 0054 header_transaction: 0006 command_id: 000C status_code: 0000 sessionid: 0 activationstate: 0003 - deactivated voicecallstate: 0000 - none nwerror: 0000 - unknown iptype: 0003 - ipv4v6 sending (16): 02 00 00 00 10 00 00 00 07 00 00 00 01 00 00 00 header_type: 0002 header_length: 0010 header_transaction: 0007 reading (16): 02 00 00 80 10 00 00 00 07 00 00 00 00 00 00 00 header_type: 80000002 header_length: 0010 header_transaction: 0007 Bjørn Mork (7): fix subscriber response segfault add command done status to verbose output avoid parsing InformationBuffer unless status is "success" add command_id to verbose output fix IP configuration prefix output support IPv6 configuration support non default ip-types cli.c | 55 ++++++++++++++++++++++++++++++++++++++++++++----------- mbim-dev.c | 11 +++++++++-- mbim-msg.c | 19 +++++++++++++++++++ mbim-msg.h | 2 ++ 4 files changed, 74 insertions(+), 13 deletions(-) -- 2.1.4 _______________________________________________ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel